Chair of Computer Graphics and Visualization

Sheet 6: Volume Rendering 2

Exercise: Volumetric Shadows (20 points)

In this exercise you will extend the direct volume renderer from the previous sheet with simple single-scattering style illumination. The primary raycaster is already implemented and still uses the analytic sphere, wave pattern, and shell volumes.

Your task is to complete the function traceShadowRay in Shader/cubeFS.glsl. The surrounding code already sends the light direction, ambient and direct light colors, shadow density scale, shadow alpha threshold, and shadow step count to the shader.

Implement shadow-ray transmittance:

The primary ray only traces a shadow ray for samples whose alpha is above shadowAlphaThreshold. This avoids unnecessary work in transparent regions and makes the transfer function control both visible opacity and shadow casting.

The most relevant shader functions are:

Test the result with the sphere first: with the light initially coming from above, the top should be brighter and the lower parts should darken. Then rotate the volume and adjust the light direction to check that the shadow follows the light, not the camera.

Reference Solution

Loading

V toggle volume, R reset, T toggle transfer-function editor
1 clip in X, 2 clip in Y, 3 clip in Z
4 move clip in X, 5 move clip in Y, 6 move clip in Z
Q increase oversampling, W decrease oversampling
J/L move light in X, I/K move light in Y, U/O move light in Z
Up zoom in, Down zoom out
Left mouse drag rotate, Right mouse drag quick edit transfer function