Class SoVolumeRenderingQuality

  • All Implemented Interfaces:
    SafeDisposable

    public class SoVolumeRenderingQuality
    extends SoVolumeShader
    Volume rendering quality property mode. This property node causes subsequent SoVolumeRender nodes to be drawn with different rendering effects and/or levels of quality.

    NOTE:

    • Only one (or none) of the following nodes can be active at a time: SoVolumeShader or SoVolumeRenderingQuality. However since Open Inventor 7.1, both SoVolumeRenderingQuality and SoVolumeIsosurface may applied to the same SoVolumeRender node.
    • If the application simply needs to replace one or more of the VolumeViz shader rendering functions with a customized shader, you can use either SoVolumeShader or SoVolumeRenderingQuality. However if the application needs the advanced rendering features of SoVolumeRenderingQuality, e.g. lighting, in addition to the customized behavior, then you should use this node (which is derived from SoVolumeShader). Using the shader rendering framework is explained on the SoVolumeShader page.
    • The SoVolumeRenderingQuality node must be before the SoVolumeRender and after the SoTransferFunction.
    • This is a shader node!
      The effect will usually be undesirable if it is applied to standard geometry (polygons, lines, etc). Therefore applications should generally keep the volume visualization nodes and standard geometry nodes separate in the scene graph (i.e. under different SoSeparator nodes).
    • Please read the comments for each field.
      Some options only apply to gradient lighting and have no effect on deferred lighting.

      Pre-integrated and lighted rendering

      Various enhanced rendering modes for volume rendering are available:

      • Pre-integrated volume rendering
      • Lighted volume rendering

    The pre-integrated mode (preIntegrated field) generally provides higher image quality for the same number of slices. Most applications should enable this field. However, note that pre-integration integrates between color map values. For typical scalar data containing sampled values, this provides a beneficial smoothing. It is especially useful when the color changes sharply between adjacent color map entries. However, when the color changes sharply between adjacent voxels, it can can cause values that are not actually in the original data to be displayed. This is undesireable for some data, for example "label" volumes resulting from segmentation. Pre-integration is not recommended for such data. Also note:

    When lighting is enabled for volume rendering, VolumeViz applies the same lighting equation used for polygonal geometry, including (optionally) specular highlights. The base voxel color comes from the SoTransferFunction node or (optionally) from a custom shader function provided by the application. This color is modified using the current material (SoMaterial), a vector simulating a "normal vector" and one or more directional light nodes (SoDirectionalLight) found in the scene graph. Voxels can also cast and receive shadows (see SoShadowGroup).

    Limitation: Pre-integrated and lighted rendering are not supported if using custom fragment shaders and redefining FRAGMENT_COMPUTE_COLOR slot.

    VolumeViz supports two lighting modes using either the lighting field or the deferredLighting field. In both cases lighting is computed on the GPU as part of the rendering process. (Do NOT use the lighting field in the SoVolumeRendering node. This field enables a CPU lighting computation that is slow.)

    • Gradient lighting
      The lighting field enables gradient based lighting, where the "normal vector" at each sample along the ray is a gradient vector computed from the data values in the volume. Gradient based lighting only supports a single light source and only the first light in the scene graph (typically the viewer's "headlight") is used. No other lights affect the volume in this case. The gradientQuality field controls the algorithm used to compute gradient vectors. Several other fields affect the gradient computation including gradientThreshold, surfaceScalarExponent and unnormalizedGradientExponent. Setting surfaceScalarExponent to a small value, for example 2.0, is recommended.

    • Deferred lighting
      The deferredLighting field enables screen space lighting, where the "normal vector" is computed from the final image depth buffer. Deferred lighting is faster and supports multiple light sources, but works best when the transfer function makes each data value either opaque or transparent. Deferred lighting is not affected by gradient related fields.

    Unlike other primitives (including other VolumeViz primitives), volume lighting is not affected by an SoLightModel node. Also unlike other primitives, if lighting is enabled and there are no light nodes in the scene graph, the voxel color is taken from the transfer function or custom shader function "as is" (other primitives would be black in this case).

    Each light node's direction and intensity fields are used, but the color field is not currently used. The current SoMaterial specifies the ambient, specular, diffuse, and emissive color values for the lighting equation. Note that the default diffuse color is "light gray" (0.8), not full white. This allows specular lighting to push the color toward full white (as expected). If specular lighting is not desired, then changing this to full white (1.0) is recommended in order to see the true colors specified in the transfer function.

    The following figures show the same volume data:

      Default volume rendering Pre-integrated volume rendering Lighted pre-integrated volume rendering

    Quality enhancement parameters

    Jittering: When jittering is set to true, a random offset is added to texture coordinates in order to decrease "ring" artifacts without the cost of drawing a higher number of slices. Note that this creates a "noisy" image. Instead we recommend setting the SoVolumeRender.samplingAlignment field to BOUNDARY_ALIGNED.

      No Jittering With Jittering

    Gradient quality: When gradient lighting (lighting field) is enabled, the gradientQuality field allows you to choose between various gradient computation techniques. The computational cost increases with the quality. Has no effect on deferred lighting.

      Low quality Medium quality High quality

    Surface scalar: When gradient lighting (lighting field) is enabled or edgeDetect2DMethod is GRADIENT, the surfaceScalarExponent field disables lighting (or edge detection) on uniform surfaces in order to avoid noise in these area. This field should not be mixed with unnormalizedGradientExponent. The default value is zero, but a small value, for example 2.0, is recommended. Has no effect on deferred lighting.

      Surface Scalar disabled Surface Scalar enabled

    Unnormalized gradient : When gradient lighting (lighting field) is enabled, if unnormalizedGradientExponent is not 0, voxels with small gradients will get more contribution from the ambient light than voxels with high gradients. It is similar to surfaceScalarExponent but uses the ambient light instead of the transfer function color for uniform surfaces. Has no effect on deferred lighting.

    Gradient threshold: When gradient lighting is enabled, gradients with a length less than gradientThreshold are ignored during the lighting computation. This avoids doing lighting on noise while still lighting important data. In the following screenshots, setting a threshold of 0.1 removed lighting on the noise surrounding the spheres. Has no effect on deferred lighting.

    Image enhancement parameters

    Various image enhancement techniques are available in this node and in SoTransferFunction.

    • Ambient occlusion
      The ambientOcclusion field enables a rendering technique that simulates self-shadowing of the volume. In other words, the amount of ambient (global) light in the scene reaching each sample is reduced by neighboring voxels. This effect makes it much easier to see the relative depth of features in the volume. Generally we recommend using this effect rather than the following effects.
      Both lighting and/or shadow casting may also be enabled, but neither is required to use ambient occlusion. This effect works best when the volume data contains surfaces (region boundaries with relatively sharp gradients) or in voxelized rendering mode. In both cases it works best when voxels are either transparent or nearly opaque. If you use ambientOcclusion, you should set the SoVolumeRender.samplingAlignment field to BOUNDARY_ALIGNED to reduce "slicing" artifacts.

    • Boundary opacity
      boundaryOpacity increases opacity depending on the length of the gradient vector. Areas with large gradient changes will have their opacity increased according to the boundaryOpacityIntensity. Note that this option has a significant performance penalty.

    • Edge coloring
      When edgeColoring is on, the color of each voxel may be mixed with the edgeColor. Areas where the normal (computed from the gradient) is facing the camera will have an unmodified color, whereas areas where the normal is more perpendicular to the view direction will tend towards edgeColor.

    • Edge detection
      When edgeDetect2D is enabled, an image space filter is applied on the volume rendering image in order to detect edges, which will be highlighted. The results are affected by the edgeDetect2DInnerThreshold and edgeDetect2DOuterThreshold fields. The edgeDetect2DMethod bitmask allows to apply the edge detection on the image's luminance, depth and/or gradient. The gradient method may give noisy result, the surfaceScalarExponent may help to improve the result in this case. The gradient method has a significant performance penalty.

    The following table shows the available edge detection techniques (explanation of faux shading is in SoTransferFunction):

    Because this node is derived from SoVolumeShader, IVVR_FIRST_RESERVED_TEXTURE_UNIT applies to it. See SoVolumeShader for more information.

    Volume projection

    Volume projection (SoProjection or derived classes) is incompatible with some options enabled by this node.
    Do not enable the preIntegrated, jittering or edgeDetect2D fields when using projection.

    File format/default:

    VolumeRenderingQuality {

      lighting false
      preIntegrated true
      jittering false
      gradientThreshold 0.0001
      edgeColoring false
      edgeColor (0, 0, 0)
      edgeThreshold 0.2
      boundaryOpacity false
      boundaryOpacityIntensity 1.5
      boundaryOpacityThreshold 1.5
      edgeDetect2D false
      edgeDetect2DInnerThreshold 0.1
      edgeDetect2DOuterThreshold 0.1
      edgeDetect2DMethod LUMINANCE
      gradientQuality MEDIUM
      colorInterpolation true
      unnormalizedGradientExponent 0
      surfaceScalarExponent 5
      segmentedInterpolation false
      segmentedInterpolationThreshold 0.5
      voxelizedRendering false
      voxelOutline false
      voxelOutlineThreshold 2.
      voxelOutlineWidth 2.
      voxelOutlineColor (0, 0, 0)
      ambientOcclusion false
      deferredLighting true
      interpolateOnMove true
    }

    Action behavior:

    SoGLRenderAction
    Sets volume rendering quality parameters in the traversal state.

    See Also:
    SoVolumeRender, SoVolumeShader, SoVolumeIsosurface, SoTransferFunction
    • Field Detail

      • lighting

        public final SoSFBool lighting
        Enable gradient based lighting (computed on the GPU). Default is false. Gradient based lighting is computed using the direction and magnitude of gradient vectors computed from the data values in place of "normal vectors" in the lighting equation. A gradient vector is computed for each sample point along the rays cast through the volume.

        VolumeViz also supports screen space lighting (see the deferredLighting field).

        Notes:

        • The result of the gradient lighting computation is affected by how the gradient vectors are computed. See the gradientQuality field.
        • Gradient lighting may produce "noisy" results when the gradient magnitudes are small and/or the gradient directions are not consistent. This often happens, for example, in relatively homogeneous regions of a volume. Several fields are provided to compensate for this effect. See gradientThreshold and surfaceScalarExponent.
        • Both gradient lighting and deferred lighting may be enabled at the same time, but the intent is that the application should use one or the other.
        • In any case, do not use the SoVolumeRender.lighting field.

        LIMITATIONS

        • Only directional lights (SoDirectionalLight) are supported.
        • Only one light source, the first one traversed in the scene graph, is supported.
      • preIntegrated

        public final SoSFBool preIntegrated
        Enable pre-integrated volume rendering.
        Pre-integrated rendering can significantly increase image quality (at the cost of slightly lower performance). Default is true.

        Limitations:

        • Pre-integration integrates between color map values. For typical scalar data containing sampled values, this provides a beneficial smoothing. When the color changes sharply between adjacent voxels, it can can cause values that are not actually in the original data to be displayed. This is undesireable for some data, for example "label" volumes resulting from segmentation. Pre-integration is not recommended for such data.
        • The preIntegrated field has no effect on SoVolumeIsosurface rendering.
        • The preIntegrated field is only considered when SoVolumeRendering.renderMode is set to VOLUME_RENDERING (the default).
      • jittering

        public final SoSFBool jittering
        Enable jittering.
        If set to true, a random offset is added to texture coordinates in order to decrease ringing artifacts (boundary edge artifacts) without the cost of drawing a higher number of slices. Note that this creates a "noisy" image. Instead we recommend setting the SoVolumeRender.samplingAlignment field to BOUNDARY_ALIGNED. Note: Jittering is only available when pre-integrated rendering is enabled. Default is false.

        Since:
        Open Inventor 7.0

      • gradientThreshold

        public final SoSFFloat gradientThreshold
        Ignore all gradients with a magnitude less than the specified threshold.
        Default is 0.0001, meaning that all gradients are used in the lighting computation. Maximum useful value is 1.0, because gradient vectors are normalized. Only affects gradient based lighting (lighting field).

        Since:
        Open Inventor 7.0

      • edgeColoring

        public final SoSFBool edgeColoring
        Enable edge coloring.
        If true, changes the color based on the gradient direction (normal). Edges will be highlighted with the color specified in edgeColor. Areas where the normal (computed from the gradient) is facing the camera will have an unmodified color, whereas areas where the normal is more perpendicular to the view direction will tend towards edgeColor. Default is false.

        Since:
        Open Inventor 7.0

      • edgeThreshold

        public final SoSFFloat edgeThreshold
        If this value is low, more edges will be detected. Default is 0.2. Min value is 0. There is no max, but most of the time a value between 0 and 1 is good.

        Since:
        Open Inventor 7.0

      • boundaryOpacity

        public final SoSFBool boundaryOpacity
        Enable boundary opacity.
        If true, increases boundary opacity based on the gradient magnitude. Default is false.

        This effect has a significant performance penalty.

        SoVolumeRender.subdivideTile will be disabled if set to true.

        Since:
        Open Inventor 7.0

      • boundaryOpacityIntensity

        public final SoSFFloat boundaryOpacityIntensity
        Applies when boundaryOpacity is true. If > 1, this increases the boundary opacity globally. If < 1, decreases it. Default is 1.5.

        Since:
        Open Inventor 7.0

      • boundaryOpacityThreshold

        public final SoSFFloat boundaryOpacityThreshold
        Applies when boundaryOpacity is true. If this value is low (near 0), only regions with a high gradient will be enhanced. Default is 1.5.

        Since:
        Open Inventor 7.0

      • edgeDetect2D

        public final SoSFBool edgeDetect2D
        Enable 2D edge detection.
        If this field is true, a 2D edge detection algorithm is used to highlight edges in the rendered image of the volume. Default is false.

        Since:
        Open Inventor 7.0

      • edgeDetect2DInnerThreshold

        public final SoSFFloat edgeDetect2DInnerThreshold
        Increase this value to decrease noise on silhouette edges. 1 = remove all edges, 0 = remove nothing. Default is 0.1

        Since:
        Open Inventor 7.0

      • edgeDetect2DOuterThreshold

        public final SoSFFloat edgeDetect2DOuterThreshold
        Increase this value to decrease noise on edges in the volume. 1 = remove all edges, 0 = remove nothing. Default is 0.1

        Since:
        Open Inventor 7.0

      • edgeDetect2DMethod

        public final SoSFBitMask<SoVolumeRenderingQuality.EdgeDetect2DMethods> edgeDetect2DMethod
        Method used for 2D edge detection.
        Specifies the edge detection algorithm used when edgeDetect2D is true. Edge detection can work on the image luminance, depth buffer and/or gradient. For example, gradients may be too noisy to give interesting edges and may be ignored with this field. The gradient method is also the slowest (luminance being the fastest) because it needs more texture fetchs. See EdgeDetect2DMethod. Default is LUMINANCE and GRADIENT.

        Since:
        Open Inventor 8.1

      • colorInterpolation

        public final SoSFBool colorInterpolation
        Controls interpolation of data values used for color lookup.
        If false, interpolation is not done on data values used to access the colormap but is still done when computing gradient for lighting. This may be used to render a segmented dataset where interpolation is not appropriate. Default is true. Only affects gradient based lighting (lighting field).

        Generally it's better to set the SoVolumeRender.interpolation field to NEAREST, unless you really want to use gradient based lighting.

        Since:
        Open Inventor 7.2

      • surfaceScalarExponent

        public final SoSFFloat surfaceScalarExponent
        If this field is greater than or equal to 1, a surface with a small gradient will be less lighted than a surface with a high gradient. The resulting color is a mix between the lighted voxel color and the non-lighted voxel color (ie: the corresponding entry in the colormap). If the value is less than 1, the field is ignored. Values higher than 256 will apply lighting on almost all surfaces. For most datasets, values between 2 and 16 should be enough. Default is 5.
        Only affects gradient based lighting (lighting field).

        Since:
        Open Inventor 8.1

      • unnormalizedGradientExponent

        public final SoSFFloat unnormalizedGradientExponent
        When unnormalizedGradientExponent is not 0, surfaces with high gradients will be more lighted than surfaces with small gradients. Voxels with small gradients will have less diffuse and specular than other with high gradients (ie: ambient color will be the biggest contributor). This lighting contribution can be controlled with this field. If this value is high, smaller gradients will contribute to lighting. Values higher than 256 will apply lighting on almost all surfaces. For most dataset, values between 2 and 16 should be enough. Default is 0.
        Only affects gradient based lighting (lighting field).

        Since:
        Open Inventor 8.1

      • segmentedInterpolation

        public final SoSFBool segmentedInterpolation
        Allow correct interpolation when rendering segmented data. NOTE: Only available on SoVolumeIsosurface.

        Since:
        Open Inventor 8.5

      • segmentedInterpolationThreshold

        public final SoSFFloat segmentedInterpolationThreshold
        Defines the iso distance used when segmentedInterpolation is true.
        Default is 0.5. value must be in the range [0 .. 1] NOTE: Only available on SoVolumeIsosurface.

        Since:
        Open Inventor 8.6

      • voxelizedRendering

        public final SoSFBool voxelizedRendering
        If true, SoVolumeRender displays voxels as individual cubes. Default is false.

        Limitations:

        • When using multiple independent volumes (different dimensions or extents) inside a SoMultiDataSeparator, this feature is not supported. Only the last volume in the scenegraph will be displayed.

        Since:
        Open Inventor 9.0

    • voxelOutline

      public final SoSFBool voxelOutline
      If true, draw the outline of voxels (default is false). Notes:
      • Since Open Inventor 9.6, this mode applies to volume slice primitives (SoOrthoSlice etc) in addition to volume rendering.
      • In the case of SoObliqueSlice, you may see triangles, quadrilaterals and even irregular pentagons in some cases. These lines are correct and correspond to the intersections between the voxels and the oblique slice. For example:

      Since:
      Open Inventor 9.0

  • voxelOutlineThreshold

    public final SoSFFloat voxelOutlineThreshold
    When voxelOutline is true, this threshold specifies the minimum size of a voxel, in screen pixels, for the voxel outline to be visible. Default is 2, meaning that outline is visible only if a single voxel is bigger than 2 screen pixels.

    Since:
    Open Inventor 9.2

  • voxelOutlineWidth

    public final SoSFFloat voxelOutlineWidth
    When voxelOutline is true, this value specifies the voxel outline width in pixels. Default is 2 pixels.

    Since:
    Open Inventor 9.6

  • voxelOutlineColor

    public final SoSFColor voxelOutlineColor
    When voxelOutline is true, this value specifies the voxel outline color. Default is black : (0, 0, 0).

    Since:
    Open Inventor 9.6

  • ambientOcclusion

    public final SoSFBool ambientOcclusion
    If true, apply an ambient occlusion effect (default is false). Ambient occlusion is an shading effect that approximates attenuation of light due to neighboring voxels. It works best when the volume data contains surfaces (region boundaries with relatively sharp gradients), or in voxelized rendering mode, and those voxels are opaque.

    If you use ambientOcclusion, you should set the SoVolumeRender.samplingAlignment field to BOUNDARY_ALIGNED to reduce "slicing" artifacts.

    Notes:

    • This effect is only applied on voxels that are considered to be "solid" (non-transparent).
      The "solid" transparency threshold is controlled by the value of SoVolumeRender.opacityThreshold.

    Since:
    Open Inventor 9.1

  • deferredLighting

    public final SoSFBool deferredLighting
    Enable screen space lighting (computed on the GPU). Default is true. Deferred lighting is computed based on the final image depth buffer instead using the data gradients. It is much faster than gradient based lighting (see the lighting field) and supports multiple light sources (up to 8). Because it is not based on data gradients, it does not have problems with small/random gradients and it gives a much better result when using clipping nodes like SoVolumeClippingGroup or SoUniformGridClipping. Light sources are defined by Open Inventor SoDirectionalLight nodes.

    Notes:

    • Since Open Inventor 9.3, deferred lighting supports up to 8 light sources.
    • Both deferred lighting and gradient lighting may be enabled at the same time, but the intent is that the application should use one or the other.
    • Gradient related fields, e.g. surfaceScalarExponent, have no effect on deferred lighting.
    • In any case, do not use the SoVolumeRender.lighting field.
    • The lighting model used by deferred lighting is the Phong reflection model. Its parameters are defined by the current SoMaterial on state.
    • This effect is only applied on voxels that are considered to be "solid" (non-transparent).
      The "solid" transparency threshold is controlled by the value of SoVolumeRender.opacityThreshold.

    LIMITATIONS

    • Only directional lights (SoDirectionalLight) are supported.
    • If you use deferredLighting, you should set the SoVolumeRender.samplingAlignment field to BOUNDARY_ALIGNED or SMOOTH_BOUNDARY_ALIGNED to reduce "slicing" artifacts.
    • The light color is taken into account, but not the light intensity field. You can get the same effect as reduced intensity by reducing the light color values.
    • Deferred lighting works best when
      • The volume data can be considered to contain "surfaces", for example bones (etc) in medical data or metal parts in NDT data, and
      • The transfer function makes the surface material relatively opaque and the surrounding material relatively transparent.

    Since:
    Open Inventor 9.2

  • cubicInterpolation

    @Deprecated
    public final SoSFBool cubicInterpolation
    Deprecated.
    As of Open Inventor 9300. Use SoVolumeShape.interpolation field instead.
    Enable cubic interpolation of data values.

    Warning Heavy GPU usage. Primarily useful for still image rendering. Default is false.

    Since:
    Open Inventor 7.0

    Warning Deprecated since Open Inventor 9300. Use SoVolumeShape.interpolation field instead.

  • lightingModel

    @Deprecated
    public final SoSFEnum<SoVolumeRenderingQuality.LightingModels> lightingModel
    Deprecated.
    As of Open Inventor 10000. No longer used. OPENGL mode is always used.
    Sets the lighting model. For backward compatibility with Open Inventor v6. Applications should set this field to OPENGL. Only affects gradient based lighting (lighting field).

    . Default is OIV6.

    Since:
    Open Inventor 7.0

    Warning Deprecated since Open Inventor 10000. No longer used. OPENGL mode is always used.

  • Constructor Detail

    • SoVolumeRenderingQuality

      public SoVolumeRenderingQuality()
      Constructor.