Voxel Ray Caster

For my Computer Graphics II course, I chose to do a project on rendering voxels. I created two demos showing some of the ways that voxels can be rendered. This demo performs ray casting on the GPU to render voxel data held in a 3D texture.


This demo allows the user to maneuver the camera around a 3D rendering of an x-ray of a foot. There are controls to adjust the density, and also to control minimum and maximum density thresholds. In addition, instead of sampling the foot x-ray data, a density function may be used. This is known as hypertexturing.

Implementation (both C++/DirectX and C++/OpenGL)

First, volume data is loaded into a 3D texture from a file. The data for the foot was found at http://www.volvis.org/. Next, a cube is rendered using pixel and vertex shaders, and the rest of the work being done by the pixel shader. For each pixel, a ray is calculated using the position of the pixel and the position of the camera. The 3D texture is sampled at many points along each ray, and the samples are blended together to calculate the color of the pixel. To create the spherical image below, the sampling of the texture was replaced with the evaluation of a function to calculate the density.