Builtin Library
- ..
- README.md2.4 KB
- preview.png3.5 KB
- properties.yaml1.1 KB
- shader.wgsl2.5 KB
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
| Property | Type | Default | Meaning |
|---|---|---|---|
base_color | color | 1,1,1,1 | Flat colour, multiplied by base_color_texture. |
emissive | color | 0,0,0,1 | Added on top (multiplied by emissive_texture). |
alpha_cutoff | range | 0 | >0 enables masked transparency (discard below the cutoff). |
uv_scale | float2 | 1,1 | UV tiling, applied as uv * uv_scale + uv_offset. |
uv_offset | float2 | 0,0 | UV translation. |
base_color_texture | texture | white | Albedo texture. |
emissive_texture | texture | white | Emissive mask/texture. |
instance_color_lane | float | -1 | Which of the instance's four shader-data lanes colours it (rgb colour, a coverage). -1 reads none. |
instance_emission | float | 0 | How 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