Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoMaterial

The SoMaterial node specifies the “base” color and opacity for VolumeViz primitives. Unless the voxel color and opacity are set directly by a custom shader function, the inherent color and opacity of each voxel is computed from the data range, transfer function and other factors discussed in this chapter. But the final color and opacity of each voxel on the screen is modulated by the base color and opacity. Specifically the base color is the first (or only) value in the diffuseColor field and the base opacity is one minus the first (or only) value in the transparency field (in other words transparency value converted to alpha value).

The base opacity feature can be used to globally modify the opacity of volume primitives. This is effectively a scale factor applied to the alpha value of each entry in the color map. Or if you think in terms of an opacity curve in the transfer function, it effectively shifts the entire opacity curve up or down without changing the color map. Globally modifying the opacity can be useful with volume rendering (SoVolumeRender) for initial exploration of a volume. Remember that transparency is the inverse of opacity. The default base opacity is 1.0 (because the default transparency is 0.0), so if there is no SoMaterial node there is no effect on the opacity of volume primitives. Setting transparency to 0.8 effectively scales all opacity values by 0.2.

Similarly the base color feature can be used to globally bias or shift the color of volume primitives. However the important thing to note is that the default base color is 80% gray (because the SoMaterial node’s default diffuse color is 0.8, 0.8, 0.8). So effectively the default brightness of volume primitives is reduced by 20%. Most VolumeViz applications should start by adding an SoMaterial node with the diffuseColor field set to full white (1,1,1).

VolumeViz supports the complete Open Inventor lighting model (which is the same as the OpenGL lighting model). So when lighting is enabled, you can also control the ambientColor, specularColor, shininess and other properties of voxels using an SoMaterial node. Lighting is enabled by default for slice and height field primitives, but must be explicitly enabled for volume rendering (see the section called “Lighting”). Multiple lights are supported for slice and height field primitives, but volume rendering only uses a single light (the first one traversed). The light color and intensity (see SoLight and subclasses) affects slice and height field primitives, but not volume rendering. Two-sided lighting is automatically enabled for slice primitives, but not for height field primitives (and is not relevant to volume rendering).