fog
Applies scene-wide global fog to an object's final color, simulating atmospheric perspective where distant objects fade into the fog color.
Core Advantages
Automation and decoupling. Developers simply set `scene.fog`, and the TSL rendering system automatically appends this node's logic to all materials, perfectly separating material calculations from scene-wide atmospheric effects without manual management.
Common Uses
Large outdoor landscapes
Underwater scene simulation
Creating suspenseful or horror atmospheres
Performance optimization and visual culling
How to adjust
Developers do not configure this node directly, but control the fog globally by modifying the `scene.fog` object's properties in JavaScript. Adjust `scene.fog.color` to change the fog's color and scene mood; adjust `near` and `far` (for linear fog) or `density` (for exponential fog) to control the fog's start distance, end distance, and concentration.
Code Examples
1// This node is applied automatically by the system. Its core logic is:
2// output.color is the final color after lighting calculations
3// fogColor and fogFactor are provided by scene.fog properties
4output.color = mix( output.color, fogColor, fogFactor );