Raycasting Beispiel
← Raymarching mit OpenGL | ● | Volume Raycasting →
Layered Fog:
That is fog with a certain density $\mu$ that stretches up to a particular height level $h$. Everything below that level $h$ is foggy and attenuated with the factor $w$:
$w = 1-e^{-\mu d}$
But what is $d$, which corresponds to the length a viewing ray travels through the fog layer? This can be computed as the length $d$ of a ray cast into the scene until it hits the top level plane of the layered fog.
With that ray length $d$ the factor $w$ is used to linearily interpolate the scene with a white background:
$I' = wI + (1-w)1$
The above is usually implemented via a fragment shader plus blending.
← Raymarching mit OpenGL | ● | Volume Raycasting →