Visit-tutorial-Volume-Rendering

Revision as of 15:57, 7 October 2015 by Kat (talk | contribs)

The Volume plot uses a visualization technique known as volume-rendering, which assigns color and opacity values to a range of data values. The colors and opacities are collectively known as a volume transfer function. The volume transfer function determines the colors of the plot and which parts are visible.

Volume rendering is one of the few visualization techniques for 3D data that, with proper configuration, can wind up incorporating all the input data in the final rendered image. With traditional opaque surface based techniques, the final rendered images contain only what is visible from a given eye point.

As a general rule of thumb, until you are ready to generate a final image, start with a small render window (visit -small) and/or reduce the size of your data being rendered.

Setup for the examples

Change the view to use Acutal spatial extents:

  1. Start Visit with a small window (visit -small).
  2. Open Controls->View->Advanced tab.
  3. Change 'View based on' to 'Actual spatial extents' by using the drop down.
  4. Click Apply and Dismiss the View window.

Reverse foreground and background colors:

  1. Open Controls->Annotation->Color tab
  2. Change background color to black.
  3. Change foreground color to white.

Remove axis annotations:

  1. Change to the 3D tab in the Annotation Window
  2. Uncheck 'Show axes'
  3. Click Apply and Dismiss the Annotation Window.

Rendering Methods

Splatting

Splatting, low quality.
Splatting, higher quality.

The first volume rendering method, hardware-accelerated splatting, resamples the entire database onto a small rectilinear grid and then, at each node in the grid, draws a small textured polygon. The polygon gets its colors and opacity from the transfer function. This method is fast due to its use of graphics hardware but it can require a large number of points in the resampled mesh to look accurate.

  1. Open CThead_mid.silo.
  2. Create a Volume plot of head.
  3. Click Draw.
  4. Rotate the view until the skull is facing mostly forward.

Notice the extra space surrounding the skull. Before using more expensive (time/memory) rendering methods, reduce the data being rendered by applying the Box operator.

  1. Add a Box operator by selecting Box from the Operators->Selection sub menu.
  2. Open the Box operator attributes window by selecting OpAtts->Selection->Box from the Main menu.
  3. Type 13 for X-minimum.
  4. Type 95 for X-maximum.
  5. Type 0 for Y-minimum.
  6. Type 120 for Y-maximum.
  7. Type 0 for Z-minimum.
  8. Type 113 for Z-maximum.
  9. Click Apply, then Dismiss the Box window.
  10. Click Draw.

To improve the quality of the image, increase the number of sample points.

  1. Open the Volume plot attributes window.
  2. Change the number of sample points to 1000000. Click Apply.


3D Texturing

3D Texturing.

Like the first volume rendering method, the second method, hardware-accelerated 3D Texturing, resamples the entire database onto a small rectilinear grid. Once the data has been resampled, it is converted into a 3D texture using the Volume plot's volume-transfer function and gets loaded into the video card's texture memory. The Volume plot then draws a set of planes that are perpendicular to the view vector from back to front, with each plane getting the pre-loaded texture mapped onto it. The resulting image is very crisp and captures details not evident when the splatting method is used.

  1. Change the Rendering Method to 3D Texturing. Click Apply.
  2. Change the Number of slices to 800. Click Apply.



Ray Casting

Ray cast: compositing.

The third volume-rendering technique, called ray-casting, used by the Volume plot is not hardware accelerated. In ray-casting, a ray is followed in reverse from the computer screen into the dataset. As a ray progresses through the dataset, sample points are taken and the sample values are used to determine a color and opacity value for the sample point. Each sample point along the ray is composited to form a final color for the screen pixel. Rays are traced from closest to farthest to allow for early ray termination which stops the sampling process when the pixel opacity gets above a certain threshold. This method of volume-rendering yields superior pictures at the cost of speed and memory use.

This method requires recalculation each time the view is changed, so you probably want to use Splatting or 3D Texturing to get the view just-right before changing to this method.

  1. Change the Rendering Method to Ray casting: compositing. Click Apply.



Ray casting: integration

Ray cast: integration.

This method is similar to the composting flavor, but will create an X-Ray like image.

  1. Change the Rendering Method to Ray casting: integration (grey scale). Click Apply.








Transfer functions

Freeform opacity.
Gaussian opacity controls.

The second example uses data with a wider density in order to illustrate the use of opacity transfer functions.

  1. Click 'Reset' in the Volume plot attributes window.
  2. Delete the plot.
  3. Close the active source.
  4. Open noise.silo
  5. Create a Volume plot of 'hardyglobal'.
  6. Change the Rendering method to 3D texturing. Click Apply.
  7. Click on the 1D transfer function tab.

The black parts of the Opacity widget represent a histogram of the data being plotted. When creating opacity curves, if the curve reaches to the top of the opacity widget, that portion of the data will be fully opaque in the volume plot. Sections with no opacity curve will be fully transparent.

  1. In the Opacity section, click on the black box to clear out the opacity curves
  2. Using the mouse and clicking on different sections, create opacity curves. (Right-Click to start, move the mouse, release to end.)
  3. Click Apply.
  4. Click the Gaussian radio button to change to a Gaussian opacity curve.
  5. Create some curves by clicking in the opacity control. Move the control points for the curves to change their shapes.
  6. Change the opacity attenuation to 40%
  7. Click Apply


Saving/Loading Volume attributes

noise.silo, loaded opacity.
noise.silo, ray-cast from saved opacity.

Volume attributes can be saved for later use, or passed to others for their use. They are stored as an XML file. The rendering method is also saved, so be aware if you are saving with Ray casting turned on.

Keep in mind that transfer functions are data-specific, so what looks good with one simulation may not look good with another.

  1. Click Save
  2. Browse to desired location and enter a name.
  3. Click Save
  4. Click Reset
  5. Click Load.
  6. Browse to location where you saved previously, highlight the appropriate file name and click Open.
  7. Click Apply.



SLIVR Rendering method

2D Transfer functions.
SLIVR using 2D transfer function.

SLIVR is a hardware accelerated volume rendering library developed at the SCI Institute at the University of Utah. SLIVR uses shaders on the graphics card to produce images approximating high-quality software volume rendering. Developed through the DoE Office of Science SciDAC program in partnership with the University of Utah.

The SLIVR method supports 2D transfer functions, and control over different lighting settings.


  1. Change Rendering method to SLIVR. Click Apply.
  2. Click 'Auto apply' in the main gui window to see future changes immediately.
  3. Change Transfer function to 2D
  4. Switch to the 2D transfer function tab
  5. Click a widget button in the Widget list.
  6. Play with its control points and change its color.
  7. Select another widget and play with its controls & color.
  8. Switch back to the Render Options tab.
  9. Using up/down arrow keys for the lighting options, play with each setting and watch how the changes affect the plot.


Gradient methods for Ray casting

  1. Open the Renderer options tab.
  2. Change rendering method to Ray-casting: compositing. Click Apply.
  3. Change sampling method to Trilinear Click apply.
  4. Change Reduction factor to High. Click Apply.