Anwendungsbeispiel für Raycasting
← Raymarching mit OpenGL | ● | Volume Raycasting →
Layered Fog:
That is fog with a certain density μ 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−μ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.
Live Demo: Volume Slicing (T#A17a & T#A17b)
← Raymarching mit OpenGL | ● | Volume Raycasting →