Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit65083fe8f2

README.md

Unlit

The minimal unlit surface shader: it emits `base_color * base_color_texture

  • emissive` with no lighting. Use it for UI-in-world, flat-shaded props, emissive signage, debug geometry — anything that should display its own colour regardless of scene lights.

It is the deliberate counterpart to pbr: where PBR carries the full StandardMaterial parameter set (roughness, metallic, normal, clearcoat, transmission, …), unlit declares only what an unlit surface uses. Authored as a self-shading fragment() shader, so it owns the final pixel and works in both the forward and deferred paths via the engine-generated entry points.

Properties

PropertyTypeDefaultMeaning
base_colorcolor1,1,1,1Flat colour, multiplied by base_color_texture.
emissivecolor0,0,0,1Added on top (multiplied by emissive_texture).
alpha_cutoffrange0>0 enables masked transparency (discard below the cutoff).
uv_scalefloat21,1UV tiling, applied as uv * uv_scale + uv_offset.
uv_offsetfloat20,0UV translation.
base_color_texturetexturewhiteAlbedo texture.
emissive_texturetexturewhiteEmissive mask/texture.
instance_color_lanefloat-1Which of the instance's four shader-data lanes colours it (rgb colour, a coverage). -1 reads none.
instance_emissionfloat0How much of the lane colour is added again on top where it covers.

Entity tint (the per-instance Model/SkinnedModel tint) is applied by the engine after fragment() returns, so this shader does not handle it.

Per-instance colour

instance_color_lane names one of the four shader-data lanes every drawn instance carries (renderer.instanceData.set for an entity, the instanceDataBuffer of renderer.mesh.drawInstanced for a population). The lane's rgb is this instance's colour and its a how much of it covers the material's own colour, which is the mix Model.tint makes, so the picture is the one a tint of the same colour and blend gives. It is the UNLIT_INSTANCE_COLOR feature, so a material that leaves the property at -1 draws a program without it. @builtin::materials.instance_color_unlit is this material ready made, reading lane 2.

renderer.instanceData.set(cell, 2, heat, 0, 1 - heat, 1)   -- blue cold, red hot