materialLightMap
Provides the final calculated Light Map color, which has already combined the map and intensity, used for adding pre-baked lighting and shadows to a scene.
Core Advantages
Completely encapsulates the logic of light map texture sampling (usually on UV2) and intensity blending, and seamlessly integrates with the material's `.lightMap` property, allowing developers to use baked lighting in a high-level, composable way.
Common Uses
Adding realistic global illumination and soft shadows to static scenes (like architecture).
Procedurally generating lighting effects, such as simulating top-down skylight.
Blending static baked lighting with dynamic real-time lighting.
Adding fixed, stylized shadows for toon shading.
Debugging the light map's UV channel by outputting UV2 coordinates.
How to adjust
Use by setting `material.lightMap` and `material.lightMapIntensity`. In TSL, the default behavior can be completely overridden by assigning a node (e.g., `texture`, `mix`) to `material.lightMapNode` to achieve advanced effects like procedural tinting and blending.
Code Examples
1// Mix between day and night lightmaps for a dynamic day-night cycle
2const dayNightFactor = timerLocal( 5 ).sin().abs(); // 5-second cycle
3
4material.lightMapNode = mix(
5 texture( dayLightMap, uv( 1 ) ),
6 texture( nightLightMap, uv( 1 ) ),
7 dayNightFactor
8);