I came across this term when searching for ways to visualize collection of voxels. What is volumetric rendering ? How is it different from normal surface rendering ? Are there any special advantages of using volumetric rendering ?
Volume rendering is a general term that refers to any method of taking a 3D volume of data and projecting it to 2D (i.e. approximating the integration of rays cast into the volume). It's typically used to render transparent effects or data that happens to be stored as a 3D image, such as medical or scientific data.
The 3D data can be represented in a few ways:
- A block or regular grid of 3D voxel data.
- An implicit 3D function, e.g. f(x, y, z).
- An atlas consisting of indexed blocks (or bricks) of the original dataset, in the case that the dataset is too large to store completely.
- A point cloud, where the dataset consists of 3D position values with associated data value.
Each voxel or function value is often a scalar, although gradient values may be precomputed as well and stored alongside it. This value may represent some property of the underlying system or anatomy in the case of medical/scientific imaging, such as proton density in MRI. To be more useful in visualization, we need to map it to a color and opacity using a transfer function. The job of the transfer function is to highlight interesting features in the range of possible values. For example, bone or certain tissues distinguishable by scalar value could be mapped to high opacity, while air would typically be given zero opacity. Now that we have a means of obtaining color/opacity values, we can start to render the volume.
One approach to rendering is called direct volume rendering, where the volume data itself is used without transforming it into a different form:
- Ray marching: This is an image-based method, where each pixel corresponds to a ray from the viewer into the scene containing the volume. Rendering consists of stepping along the ray and accumulating the color/opacity contribution from each point.
- Texture slicing: This method uses proxy geometry in the form of slices through the volume as a way to optimize the process of composition on modern graphics hardware tuned for blending large amounts of texture-mapped geometry.
Another approach is transforming the volume into a polygonal/mesh representation, often using the marching cubes algorithm. This is seen in a number of voxel-based games with 'smooth' geometry and can be done on the fly in modern hardware.
Volumetric rendering refers to a technique for generating a visual representation of data that is contained in a three dimensional space (volume). Examples of this are atmospheric effects such as smoke and fog and techniques applied to scientific visualization such as marching cubes to generate surfaces from volumetric data. In marching cubes, data is represented as voxels, but in the sense that we store some floating point value in a structured grid in three dimensions.
Volume rendering is contrasted with Surface rendering because the data that is being rendered is coming from a three dimensional data set rather than a two dimensional data set (a surface). In surface rendering, we are only concerned with the effects of lighting interacting with a material at a surface and how to best describe the color at a particular surface. In volume rendering, we are interested in some data at a given location in 3D space, and we must figure out how to convey its meaning visually.
For example, if we wanted to render cigarette smoke, we might use a volume rendering technique known as ray marching. We shoot a ray into our scene, and then we move slowly along the ray. At each step, we see how much smoke density there is at that particular position in 3D space based on some data set. From this density, we can choose how much opacity this sample contributes to the final pixel value.
In terms of game development, my experience tells me that volume rendering is rarely used. Dealing with three dimensional data sets and the algorithms used for getting good visual results are usually detrimental to real-time performance both in terms of memory and computational efficiency. The advantages of volume rendering come from their use in the scientific computing community and their ability to very accurately depict data in a visual way. There is a saying in computer graphics that "if something looks right, it is right". This saying gains criticism in the scientific visualization community where "if it is right, it is right".