Volumetric Rendering

Volumetric render of the Marschner-Lobb function surrounded by CT scanned Bonsai trees. Please note frame rate may appear lower due to gif format.

This project implements front-to-back volumetric ray tracing to visualize signed distance functions (SDFs) and CT scan data in real time. Using ray marching and an absorption-emission model, this shader accumulates color along rays, allowing for realistic volumetric rendering of 3D structures.

This is how I approached this project:

Step 1: Signed Distance Function (SDF) Representation

• Defined SDF primitives (sphere and box) to model 3D objects.

• Converted negative SDF values into color using a palette function. (Credit to Inigo Quilez: https://iquilezles.org/articles/palettes/)

• Set density to 1.0 inside the object and 0.0 outside.

Step 2: Visualizing CT Data

• Sampled density values from a 3D texture (iVolume).

• Mapped density values to color using the same palette function.

• Applied a scaling factor to enhance contrast in visualization.

Step 3: Volumetric Ray Marching with Front-to-Back Accumulation

• Marched rays through the scene, sampling density at multiple depths.

• Computed absorption and emission using:

Where C is the accumulated color, T is transmittance, and sigma represents the density.

• Combined SDF-based objects and CT scan data in a single rendering pass.

Step 4: Interactive Camera and Real-Time Rendering

• Implemented a rotating camera for dynamic visualization.

• Adjusted sampling resolution for smooth rendering.

This project demonstrates volumetric rendering techniques for both synthetic objects and real-world imaging.

Since this technique can render CT scans, there are many practical applications of volumetric rendering. For instance, volumetric rendering can be incredibly useful in medical imaging. In the example below, I rendered an SDF sphere as well as a CT scanned foot. Looking at the foot, volumetric rendering allows us to even see as far as the bones, providing many practical uses for medical professionals.

Tags:

Leave a comment