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.
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.
Volume rendering tends to look better with darker backgrounds, so reverse VisIt's default foreground and background colors:
- Start Visit
- Open Controls->Annotation->Color tab
- Change background color to black
- Change foreground color to white
- Click Apply
Axes annotations can be distracting, remove them for these examples:
- Change to the 3D tab in the Annotation Window
- Uncheck 'Show axes'
- Click Apply and Dismiss the Annotation Window
Create an initial volume plot:
- Open CThead_mid.silo
- Create a Volume plot of head
- Click Draw
- 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.
- Add a Box operator by selecting Box from the Operators->Selection sub menu
- Open the Box operator attributes window by selecting OpAtts->Selection->Box from the Main menu
- Type 13 for X-minimum
- Type 95 for X-maximum
- Type 0 for Y-minimum
- Type 120 for Y-maximum
- Type 0 for Z-minimum
- Type 113 for Z-maximum
- Click Apply, then Dismiss the Box window
- Click Draw
The bounding box did not change! The View extents need to be changed to use Actual spatial extents:
- Open Controls->View->Advanced tab
- Change 'View based on' to 'Actual spatial extents' by using the drop down
- Click Apply and Dismiss the View window
To improve the quality of the image, increase the number of sample points:
- Open the Volume plot attributes window
- Change the number of sample points to 1000000. Click Apply
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.
- Change the Rendering Method to 3D Texturing. Click Apply
- Change the Number of slices to 800. Click Apply
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. You will also to use a smaller window with Ray casting until all settings are just-right.
- Make the Window smaller by dragging a corner.
- Change the Rendering Method to Ray casting: compositing. Click Apply
Ray casting: integration
This method is similar to the compositing flavor, but will create an X-Ray like image.
- Change the Rendering Method to Ray casting: integration (grey scale). Click Apply
The second example uses data with a wider density in order to illustrate the use of opacity transfer functions.
- Click 'Reset' in the Volume plot attributes window
- Delete the plot
- Close the active source
- Open noise.silo
- Create a Volume plot of hardyglobal
- Change the Rendering method to 3D texturing. Click Apply
- 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.
- In the Opacity section, click on the black box to clear out the opacity curves
- Using the mouse and clicking on different sections, create opacity curves. (Right-Click to start, move the mouse, release to end.)
- Click Apply
- Click the Gaussian radio button to change to a Gaussian opacity curve
- Create some curves by clicking in the opacity control. Move the control points for the curves to change their shapes
- Change the opacity attenuation to 40%
- Click Apply
Color tables with transparency built in can also be used for a transfer function. Create a color table based off the hot table:
- Open Controls->Color table
- If is it not already selected, select hot
- In the Name field, enter hot_with_opacity
- Click New
- Select the Cyan control point, change its alpha value to 10
- Select the Green control point, change its alpha value to 5
- Select the Yello control point, chage its alpha vlue to 10
- Click Apply and Dismiss the Color table window
Now use that newly created color table for the Volume plot:
- From the 1D transfer function tab, change the Color table to hot_with_opacity
- In the Opacity section, click the From Color table radio button
- Click Apply
Saving/Loading Volume attributes
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.
- Click Save
- Browse to desired location and enter a name
- Click Save
Now load the settings you just saved:
- Click Reset
- Click Load
- Browse to location where you saved previously, highlight the appropriate file name and click Open
- Click Apply
SLIVR Rendering method
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.
- Change Rendering method to SLIVR. Click Apply.
- Click 'Auto apply' in the main gui window to see future changes immediately.
- Change Transfer function to 2D
- Switch to the 2D transfer function tab
- Click a widget button in the Widget list.
- Play with its control points and change its color.
- Select another widget and play with its controls & color.
- Switch back to the Render Options tab.
- 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
- Open the Renderer options tab.
- Change rendering method to Ray-casting: compositing. Click Apply.
- Change sampling method to Trilinear Click apply.
- Change Reduction factor to High. Click Apply.