UnlitMaterial constructor

UnlitMaterial({
  1. Color albedoColor = const Color(0xFFFFFFFF),
  2. Texture? albedoTexture,
})

A material that renders textures without any lighting calculations.

Unlike SpatialMaterial, this material outputs the texture color multiplied by albedoColor directly, with no PBR shading, tone mapping, or gamma correction. This makes it ideal for:

  • 2D canvas content rendered onto 3D surfaces
  • UI panels and HUD elements in 3D space
  • Emissive/self-lit surfaces
  • Sky boxes and debug rendering

Implementation

UnlitMaterial({
  this.albedoColor = const Color(0xFFFFFFFF),
  Texture? albedoTexture,
}) : albedoTexture = albedoTexture ?? Texture.standard,
     super(
       vertexShader: VertexShader.fromAsset(
         'packages/flame_3d/assets/shaders/unlit_material.shaderbundle',
         slots: ['VertexInfo', 'JointMatrices'],
       ),
       fragmentShader: FragmentShader.fromAsset(
         'packages/flame_3d/assets/shaders/unlit_material.shaderbundle',
         slots: ['albedoTexture', 'Material'],
       ),
     );