Volume Rendering

Keywords: Volume Rendering, Volumetric Rendering, CT, MRI, efficient, fast, OpenGL

This page lists features and specifications of a highly efficient and feature rich volume rendering library developed by Reto Koradi, who holds all copyrights on the code.

Commercial inquiries are welcome. Please send e-mail to volume-rendering@retokoradi.com.


Hardware and Platforms


Hardware: GPU with support for OpenGL 3.2 (core profile) or higher.
Operating System: 32-bit and 64-bit Windows.
Most recent OS version tested: Windows 8.1.
Development Environment: Visual Studio Express 2012.


Hardware: GPU with support for OpenGL 3.2 (core profile) or higher.
Operating System: OS X 10.7 or higher.
Most recent OS version tested: OS X 10.9.1.
Development Environment: make, clang.


Hardware: A7 CPU.
Operating System: iOS 7.
Most recent OS version tested: iOS 7.0.6.
Development Environment: Xcode 5.0.2.

Data Formats and Inputs

Volume data types:

  •  8 bit unsigned integer.
  • 16 bit unsigned integer.
  • 16 bit RGBA color, using 4 bit unsigned integer per color component.
  • 32 bit RGBA color, using 8 bit unsigned integer per color component.

Volume sizes:

  • Mainly limited by amount of system and graphics memory on 64-bit systems.
  • Exact amount of memory used depends on data format (8 bit or 16 bit) and features used (e.g. lighting, segmentation).
  • Typical usage requires 512 MBytes of graphics memory for 512x512x512 volumes, 4 GBytes of graphics memory for 1024x1024x1024 volumes.
  • Automatic downsampling of datasets that are larger than specified limit.

Data input:

  • Raw 8 bit files (with optional header).
  • Raw 16 bit files (with optional header).
  • DICOM (subset).
  • In-memory data.
  • Additional formats can be implemented outside the library by subclassing base input classes from the library.

Transfer Functions

Arbitrary types of transfer functions are supported by the rendering code. Each intensity value can be mapped to any RGBA value. The same volume can be displayed with different transfer functions in different views, or multiple times in the same view, without replicating the volume data.

The current version of the library contains code to build the following types of transfer functions:

  • Linear, defined by window/level and three colors.
  • Iso-surface, defined by value and color.
  • Colors specified independently for each value.
  • Read from text file with RGBA values.
  • Customized by subclassing.

Rendering Features


The image below shows an example of basic rendering without explicit lighting.


The following lighting parameters are supported for explicit lighting based on volume gradients:

  • Standard Gouraud shading.
  • Hemispherical lighting.
  • Global parameters: ambient intensity, hemispherical diffuse/specular intensities.
  • Unlimited number of directional light sources.
  • Light source parameters: direction, diffuse reflection, specular reflection, shininess.
  • Real-time editing of light parameters.

The image below shows an example of rendering with explicit lighting.


Pre- and Post-integration

Aside from the standard post-integration rendering method, which is suitable for transfer functions that change slowly, the code also supports pre-integration. Pre- integration is needed to support transfer functions with sharp transitions. For example, it allows the use of a transfer function that is opaque for only one single intensity, for rendering iso-surfaces directly from volume data.

The image below shows an iso-surface rendered directly from volume data on the left. On the right, it shows a triangulated iso-surface that was extracted from the same volume, and then rendered as a triangle mesh. As expected, the two images obtained with very different rendering methods look almost identical.


Segmentation and Masking

When segmentation information is available, e.g. for different tissue types in a medical dataset, a separate transfer function can be applied for each of the segments. This allows e.g. to show different tissue types in different colors. Up to 128 segments are supported.

Similarly, parts of the volume can be masked, e.g. to support clipping and punching.


Slices in arbitrary direction can be rendered directly from the volume.

Combination with Geometry Rendering

Volume rendering can be combined with arbitrary geometry rendered with standard OpenGL rendering primitives, like triangle meshes. Overlap between volumes and the extra geometry is displayed correctly. The only restriction for correct rendering is that the extra geometry has to be opaque.

Multiple Volumes and Views

The library supports display of multiple volumes and views in arbitrary combinations:

  • Unlimited number of views with volume display.
  • Display of same volume in multiple views (with different attributes).
  • Display of multiple independent volumes in same view (can be overlapping).

Volume data and graphics resources (e.g. textures) are not replicated when a volume is displayed in multiple views. Resources are automatically shared by the rendering library, and released when not used anymore.


Rendering is implemented using OpenGL 3.2 (core profile) or OpenGL ES 3.0, using 3D textures for representing volumes, and optimized shaders.

Beyond a typical volume rendering implementation, the library contains proprietary algorithms and methods to greatly enhance rendering speed. With all optimizations enabled, it typically renders at around 5 times the speed of a moderately optimized implementation using standard methods.

Auxiliary Functionality

In addition to the core volume rendering functionality, the library contains some functionality that is often useful in conjunction with volume rendering:

  • Picking: Finds position in volume corresponding to window position selected by user.
  • Punching: Builds volume mask to cut away parts of volume inside/outside an arbitrary polygon outline.
  • Extraction of triangle meshes for explicit iso-surfaces.

Source Code

The library is implemented entirely in C++, and can be compiled for 32-bit and 64-bit architectures. It uses the OpenGL graphics API, with a minimum version of OpenGL 3.2 required for desktop systems (Windows, Mac), and OpenGL ES 3.0 for iOS. No other external libraries beyond OpenGL and standard C++ libraries are used.

The library is designed for easy integration into existing applications that are e.g. using scene graphs on top of OpenGL.

Demo applications exist, but are not very refined at this point. The main focus has been on developing rendering code, with the demo applications intended primarily for testing and benchmarking the code.

2 thoughts on “Volume Rendering”

Leave a Reply

Your email address will not be published. Required fields are marked *