densityFogFactor
Calculates a fog mixing factor based on the Exponential Squared (EXP2) model, simulating how an object's color fades into the fog color with distance in a visually smooth and physically plausible way.
Core Advantages
Encapsulates a physically more realistic EXP2 fog algorithm into a single node, simplifying development. Its composability allows for easy combination with nodes like noise and time to create dynamic, procedural fog, greatly enhancing scene atmosphere and realism.
Common Uses
Creating depth in outdoor scenes
Simulating underwater turbidity
Volumetric smoke/haze in sci-fi/industrial scenes
Performance optimization: smoothly hiding the far plane
How to adjust
Controlled primarily by adjusting its single input parameter, `density` (a float node). A smaller `density` value results in thinner fog and clearer visibility; a larger value creates denser fog and lower visibility. Providing a dynamic value composed of noise and time nodes can create flowing, non-uniform fog effects.
Code Examples
1// fogDensity is a float node controlling the concentration
2const fogFactor = densityFogFactor( fogDensity );
3
4// Mix the object's color with the fog color using the fogFactor
5outputNode.color = mix( outputNode.color, fogColor, fogFactor );