Difference between revisions of "Visit-tutorial-Volume-Rendering"

m
 
(8 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
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.
 
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.
 +
 +
== Tutorial Data ==
 +
Volume Rendering Tutorial Example Dataset (CThead_mid.silo):
 +
*Tarball: [http://portal.nersc.gov/project/visit/cyrush/tutorial_data/volume_rendering_tutorial_data.tar.gz volume_rendering_tutorial_data.tar.gz] (588 KB)
 +
*Zip: [http://portal.nersc.gov/project/visit/cyrush/tutorial_data/volume_rendering_tutorial_data.zip volume_rendering_tutorial_data.zip] (588 KB)
  
 
==Rendering Methods==
 
==Rendering Methods==
Line 83: Line 88:
 
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.  
 
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.
+
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 want to use a smaller window with Ray casting until all settings are just-right.
  
 
<ol>
 
<ol>
Line 116: Line 121:
  
 
[[Image:vol_opac_01.png|200px|thumb|right|Gaussian opacity controls.]]
 
[[Image:vol_opac_01.png|200px|thumb|right|Gaussian opacity controls.]]
 +
[[Image:Color_table_with_opactiy.png|200px|thumb|right|Creating color table with opacity]]
 +
[[Image: vol_opac_04.png|200px|thumb|right|Opacity using color table]]
  
[[Image:Color_table_with_opactiy.png|200px|thumb|right|Creating color table with opacity]]
 
  
[[Image:vol_opac_04.png|200px|thumb|right|Opacity from color table]]
 
  
 
The second example uses data with a wider density in order to illustrate the use of opacity transfer functions.
 
The second example uses data with a wider density in order to illustrate the use of opacity transfer functions.
Line 136: Line 141:
 
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.
 
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.
  
 +
 +
Freeform:
 
<ol>
 
<ol>
 
<li>In the Opacity section, click on the black box to clear out the opacity curves</li>
 
<li>In the Opacity section, click on the black box to clear out the opacity curves</li>
 
<li>Using the mouse and clicking on different sections, create opacity curves. (Right-Click to start, move the mouse, release to end.)</li>
 
<li>Using the mouse and clicking on different sections, create opacity curves. (Right-Click to start, move the mouse, release to end.)</li>
 
<li>Click Apply</li>
 
<li>Click Apply</li>
 +
</ol>
 +
<br>
 +
 +
Gaussian:
 +
<ol>
 
<li>Click the Gaussian radio button to change to a Gaussian opacity curve</li>
 
<li>Click the Gaussian radio button to change to a Gaussian opacity curve</li>
 
<li>Create some curves by clicking in the opacity control. Move the control points for the curves to change their shapes</li>
 
<li>Create some curves by clicking in the opacity control. Move the control points for the curves to change their shapes</li>
Line 145: Line 157:
 
<li>Click Apply</li>
 
<li>Click Apply</li>
 
</ol>
 
</ol>
 +
  
 
Color tables with transparency built in can also be used for a transfer function.  Create a color table based off the ''hot'' table:
 
Color tables with transparency built in can also be used for a transfer function.  Create a color table based off the ''hot'' table:
Line 164: Line 177:
 
<li>In the Opacity section, click the ''From Color table'' radio button</li>
 
<li>In the Opacity section, click the ''From Color table'' radio button</li>
 
<li>Click Apply</li>
 
<li>Click Apply</li>
 +
</ol>
  
 
+
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
  
  
Line 192: Line 216:
 
</ol>
 
</ol>
  
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
  
 +
==More options==
  
 +
Gradient methods:
 +
#Centered difference
 +
#Sobel
  
==SLIVR Rendering method==
+
Ray Casting Sampling methods:
 +
#Rasterization
 +
#Kernel
 +
#Trilinear
  
[[Image:Vol_2d_transfer.png|200px|thumb|right|2D Transfer functions.]]
+
[[Category: VisIt Tutorial]]
 
 
[[Image:noise_slivr_2dTransfer.png|200px|thumb|right|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.
 
 
 
 
 
<ol>
 
<li>Change Rendering method to SLIVR. Click Apply.</li>
 
<li>Click 'Auto apply' in the main gui window to see future changes immediately.</li>
 
<li>Change Transfer function to 2D</li>
 
<li>Switch to the 2D transfer function tab</li>
 
<li>Click a widget button in the Widget list.</li>
 
<li>Play with its control points and change its color.</li>
 
<li>Select another widget and play with its controls & color.</li>
 
<li>Switch back to the Render Options tab.</li>
 
<li>Using up/down arrow keys for the lighting options, play with each setting and watch how the changes affect the plot.</li>
 
</ol>
 
 
 
 
 
==Gradient methods for Ray casting==
 
<ol>
 
<li>Open the Renderer options tab.</li>
 
<li>Change rendering method to Ray-casting: compositing. Click Apply.</li>
 
<li>Change sampling method to Trilinear Click apply.</li>
 
<li>Change Reduction factor to High. Click Apply.</li>
 
</ol>
 

Latest revision as of 01:44, 27 July 2021

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.

Tutorial Data

Volume Rendering Tutorial Example Dataset (CThead_mid.silo):

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.

Volume rendering tends to look better with darker backgrounds, so reverse VisIt's default foreground and background colors:

  1. Start Visit
  2. Open Controls->Annotation->Color tab
  3. Change background color to black
  4. Change foreground color to white
  5. Click Apply

Axes annotations can be distracting, remove them for these examples:

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

Create an initial volume plot:

  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

The bounding box did not change! The View extents need to be changed to use Actual spatial extents:

  1. Open Controls->View->Advanced tab
  2. Change 'View based on' to 'Actual spatial extents' by using the drop down
  3. Click Apply and Dismiss the View window

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. You will also want to use a smaller window with Ray casting until all settings are just-right.

  1. Make the Window smaller by dragging a corner.
  2. Change the Rendering Method to Ray casting: compositing. Click Apply



Ray casting: integration

Ray cast: integration.

This method is similar to the compositing 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.
Creating color table with opacity
Opacity using color table


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.


Freeform:

  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


Gaussian:

  1. Click the Gaussian radio button to change to a Gaussian opacity curve
  2. Create some curves by clicking in the opacity control. Move the control points for the curves to change their shapes
  3. Change the opacity attenuation to 40%
  4. 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:

  1. Open Controls->Color table
  2. If is it not already selected, select hot
  3. In the Name field, enter hot_with_opacity
  4. Click New
  5. Select the Cyan control point, change its alpha value to 10
  6. Select the Green control point, change its alpha value to 5
  7. Select the Yello control point, chage its alpha vlue to 10
  8. Click Apply and Dismiss the Color table window

Now use that newly created color table for the Volume plot:

  1. From the 1D transfer function tab, change the Color table to hot_with_opacity
  2. In the Opacity section, click the From Color table radio button
  3. 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

Now load the settings you just saved:

  1. Click Reset
  2. Click Load
  3. Browse to location where you saved previously, highlight the appropriate file name and click Open
  4. Click Apply






More options

Gradient methods:

  1. Centered difference
  2. Sobel

Ray Casting Sampling methods:

  1. Rasterization
  2. Kernel
  3. Trilinear