--- description: All world/item shaders must respect night darkness unless unlit or bloom. alwaysApply: true --- # Shaders respect darkness Lit world and item shaders **must** apply the scene darkness value (e.g. `u_darkness` / ambient night darkening) unless explicitly exempt. ## Must darken - Entity sprites, equipment overlays, ground items - Ground/block tiles (atlas or individual), water, wade foam, coastline foam - Potion liquid recolor / tint passes drawn in the lit world Compose effects **before** darkness when possible: tint/foam/recolor first, then `mix(rgb, vec3(0.0), darkness)`. ## Exempt (unlit) - Bloom-layer sprites (`RENDER_LAYER_BLOOM` / bloom companions) - Explicitly unlit utilities (chunk edges, editor overlays, UI chrome) - Pure UI elements not drawn through the world lit pipeline (DOM inventory panels may tint without world darkness; world-dropped potions still must darken) ```text # ❌ BAD — fancy tint ignores night rgb = mix(rgb, potionColor, 1.0); gl_FragColor = vec4(rgb, a); # ✅ GOOD — tint then darkness rgb = mix(rgb, potionColor, fill); rgb = mix(rgb, vec3(0.0), u_darkness); gl_FragColor = vec4(rgb, a); ``` When adding a new fragment shader for the game world, default to respecting darkness; document any unlit exception in code comments.