Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

heightFog

The render pass behind the HeightFog component and the fog module.

One compute pass after lighting reconstructs each pixel's world position from @scene.depth and the drawn camera's inverse view-projection (@frame.camera), integrates the height-falloff density along the view ray analytically, and blends the surface toward the fog medium by the resulting transmittance. The in-scattering term is a Henyey-Greenstein lobe around the direction to the sun, normalised against the isotropic phase so the strength knob means the same thing at any anisotropy.

Working in world space is what lets density vary with altitude and what lets the medium respond to view direction — neither is expressible from screen depth alone.

Parameters arrive through the heightfog_params buffer, packed by the fog module. Sky pixels are passed through untouched.

Because the camera rides @frame.camera, the fog is correct in offscreen captures and render-to-texture cameras at their own resolutions, not only in the live viewport.