Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
Volume rendering effects

Volume rendering effects are enabled using fields in the SoVolumeRenderingQuality node. In this section we discuss the following effects:

Lighting

Lighting is a key technique for “illuminating” the shapes of objects and the spatial relationship of objects in the scene. As much as possible, lighting of volumes is consistent with lighting of polygonal geometry in core Open Inventor. However there are some issues specific to volume rendering and some differences from lighting of VolumeViz slice primitives.

Unlike other Open Inventor geometry (including slice primitives), the appearance of volume rendering primitives is not automatically affected by lighting. Lighting must be explicitly enabled using the SoVolumeRenderingQuality node. Enabling volume lighting will reduce rendering performance. Unlike other Open Inventor geometry, if there is no light in the scene the voxels in the volume will still be rendered in their basic color defined by the transfer function and the SoMaterial node (if any). Volume lighting is not affected by the SoLightModel node.

Volume lighting supports directional, point and spot lights like other geometry. But unlike other Open Inventor geometry (including slice primitives), only one light is used to computing lighting for volume rendering. Volume rendering will use the first light traversed in the scene graph. This will normally be the viewer's "headlight", but does not have to be. The light direction (if applicable) affects volume rendering, but the light color and intensity are not considered for volume rendering.

Like other Open Inventor geometry, when lighting is enabled volume rendering primitives can cast and receive shadows. Shadows may be useful in some applications to give visual cues about the relationships (particularly depth ordering) of objects in the scene. To enable shadows, put the SoVolumeRender node under an SoShadowGroup node and set the shadow group’s method field to VARIANCE_SHADOW_MAP.

Lighting is enabled by adding an SoVolumeRenderingQuality node to the scene graph and setting its lighting field to true. Do NOT use the lighting field in the SoVolumeRender node (this enables a deprecated software lighting algorithm). When lighting is enabled, VolumeViz computes gradients and computes the lighting equation on the GPU during rendering.

Open Inventor uses the Phong lighting model (same as OpenGL) for geometry and for volume rendering. This means the appearance of the volume is affected by the SoMaterial node fields ambientColor, diffuseColor, specularColor, emissiveColor, shininess and transparency. The basic diffuseColor and opacity of a voxel is determined by the SoDataRange and SoTransferFunction nodes.

These values are multiplied with the material node settings, i.e voxelAlpha = materialAlpha * transferFunctionAlpha where materialAlpha = 1 - transparency. So materialAlpha is effectively a global setting for the entire volume.

The effect of light on an object depends on the normal vector at each point on the surface. Classic polygonal and NURBS geometry defines true surfaces. Surface normal vectors can be computed from the geometry, for example by using cross product on each face then averaging the face normals at each vertex. Volume data may or may not contain surfaces. If it does we may be able to detect the surface indirectly as a significant transition from one material (voxel value) to another. Therefore we use the gradient of the voxel values as an approximation of a normal vector. For various algorithms we may be interested in the direction or the magnitude of the gradient vector or both. Illuminating transitions between different materials in the volume can be very effective for volumes containing sharp gradients such as bone to soft tissue in medical (CT) data or metal to air in materials data. There are many ways (with various tradeoffs) to compute the gradient at a voxel. VolumeViz provides several common algorithms through the gradientQuality field. It is also possible to skip or modify lighting according to the gradient magnitude.

Using the gradient vector as the surface normal for lighting can be problematic in some cases. The gradient vector will be approximately zero length in homogeneous regions where there is very little or no change in voxel values, making the normal vector undefined. And in practice, volume data sets contain noise which may cause small randomly oriented gradient vectors to be computed in relatively homogeneous regions. This can result in surfaces that should be relatively smooth appearing rough. VolumeViz provides several options to deal with this problem including the gradientThresold, surfaceScalarExponent and unnormalizedGradientExponent fields discussed in the following text.

| | | | — | — | |

surfaceScalarExponent blend factor

When the unnormalizedGradientExponent field (SoVolumeRenderingQuality) is greater than 0, the contribution of diffuse and specular lighting is reduced for voxels with small gradients. In other words ambient color will be the biggest contributor to the color of these voxels. The higher this value is, the more smaller gradients will contribute to lighting. Like surfaceScalarExponent, the reduction factor is computed from the gradient magnitude using an inverse power function where unnormalizedGradientExponent is the exponent value. Unlike surfaceScalarExponent, which affects all lighting factors, this field only affects the diffuse and specular values. Values higher than 256 will apply lighting on almost all surfaces. For most datasets, values between 2 and 16 should be enough. The default is 0.

Edge coloring

This effect highlights the “edges” of structures in the volume by blending the voxel color with an edge color. Highlighting edges can be useful to visually separate structures inside the volume. For the edge coloring effect, edges are identified based on the gradient direction (normal vector). This effect is independent of lighting, but depends on the gradientQuality field (the section called “Lighting”) and related gradient computation options. Voxels whose normal vector is facing the camera are not modified. Voxels whose normal vector is more perpendicular to the view direction will tend towards the color specified in the edgeColor field. Edge coloring is most effective for voxels with relatively high opacity.

Edge coloring is enabled by setting the SoVolumeRenderingQuality field edgeColoring to true (default is false). The color used to highlight edges can be specified using the SoVolumeRenderingQuality field edgeColor (default is black). The intensity of the edge coloring effect can be specified using the SoVolumeRenderingQuality field edgeThreshold (default is 0.2). The minimum value is 0. There is no maximum, but in most cases a value between 0 and 1 is appropriate.

Edges can also be highlighted using boundary opacity and 2D edge detection (the section called “Edge detection (2D)”).

| | | | — | — | |

BoundaryOpacityItensity scale factor

Edge detection (2D)

This effect highlights the "edges" of structures in the volume by darkening the voxel color. For the edge detection effect, edges are identified using a 2D image processing step based on change in luminance, depth and/or gradient. This effect depends on lighting (the section called “Lighting”) for the LUMINANCE method and depends on the gradientQuality field and related gradient computation options for the GRADIENT method. Edge detection is most effective for voxels with relatively high opacity.

Edge detection is enabled by setting the SoVolumeRenderingQuality field edgeDetect2D to true (default is false). The edge detection method can be specified using the SoVolumeRenderingQuality field edgeDetect2DMethod (default is LUMINANCE). The GRADIENT method is the most computationally expensive and the gradient changes may be too noisy to give interesting edges. The LUMINANCE (brightness) method has very little impact on rendering performance but can also detect edges that are really noise. The DEPTH method is in-between in performance impact, but the results are generally better. “Noise” edges can be reduced in all cases using the SoVolumeRenderingQuality fields edgeDetect2DInnerThreshold (default is 0.1) and edgeDetect2DOuterThreshold (default is 0.1).

Edges can also be highlighted using edge coloring (the section called “Edge coloring”) and boundary opacity.

figure_e1b4509d-432f-49c6-b6a9-e054ee63b378Edge detection OFFFigure 1.66. Edge detection OFF figure_af3be4da-d852-4844-bb3e-61c89fb9f9b9Edge detection by DEPTHFigure 1.67. Edge detection by DEPTH
figure_065c0a70-2862-4ec5-8cbf-4dc146f2ec3bEdge detection by LUMINANCEFigure 1.68. Edge detection by LUMINANCE figure_6bab42ea-79fe-4971-80b2-98ef756cc7b7Edge detection by GRADIENTFigure 1.69. Edge detection by GRADIENT