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

SoHeightFieldRender displays a uniform grid in the XY plane whose vertices are height (Z) values stored in a volume data set with the Z dimension equal to 1. This node is used similar to SoVolumeRender, but instead of an SoVolumeData node, you use an SoHeightFieldGeometry for the data set (height values) and one or more SoHeightFieldProperty nodes for property data sets. Generally it obeys the same rules regarding multiple data sets (see SoMultiDataSeparator).

Any grid vertices whose value is equal to the "undefined" value will be rendered as holes in the grid. The undefined value can be specified during the LDM conversion using the "-u" option to the LDM converter. Or by setting the undefinedValue field in the SoHeightFieldGeometry node. The default value is NaN (Not a Number).

VolumeViz provides default shaders that conveniently color the surface using a single property, as shown in the UserGuide_Images. However it is also possible to combine multiple properties using a custom shader program, in the same way that you would combine multiple volumes.

Use the static method isSupported() to test if height field rendering is supported on the current system. Most graphics board should work, but it does require support for floating point textures and vertex buffer objects (VBO).

In these UserGuide_Images we can see that reducing the number of triangles by an order of magnitude only has a small effect on the appearance of the surface. In this example the height field contains some “undefined” values which are not rendered.

figure_c908a71a-6b8b-4c4e-9201-3005bf0a0d13Height field 300,000 trianglesFigure 1.89. Height field 300,000 triangles figure_08b6bc08-8890-4477-8a97-3c6dbceab68eHeight field 30,000 trianglesFigure 1.90. Height field 30,000 triangles

Code example:

C++ :

/ Create nodes SoHeightFieldGeometry* pHFGeom = new SoHeightFieldGeometry;
pHFGeom->fileName = "$OIVHOME/src/VolumeViz/Data/horizon.ldm";
pHFGeom->dataSetId = 1;
SoHeightFieldProperty* pHFProp = new SoHeightFieldProperty;
pHFProp->fileName = "$OIVHOME/src/VolumeViz/Data/horizon.ldm";
pHFProp->dataSetId = 2;
SoMaterial* pMaterial = new SoMaterial;
pMaterial->diffuseColor.setValue( 1, 1, 1 );
SoTransferFunction* pTF = new SoTransferFunction;
pTF->predefColorMap = SoTransferFunction::STANDARD;
SoHeightFieldRender* pHFRend = new SoHeightFieldRender;
// SoComplexity node is used to adjust tessellation level
// of HeightFieldRender and simplify rendering.
SoComplexity* complexity = new SoComplexity;
// Build scene graph
SoSeparator* pRoot = new SoSeparator;
SoMultiDataSeparator* pVolSep = new SoMultiDataSeparator;
pVolSep->addChild( pHFGeom );
pVolSep->addChild( pHFProp );
pVolSep->addChild( pMaterial );
pVolSep->addChild( pTF );
pVolSep->addChild( pHFRend );
pRoot->addChild( complexity );
pRoot->addChild( pVolSep );

C# :

// Create nodes
SoHeightFieldGeometry HFGeom = new SoHeightFieldGeometry();
HFGeom.fileName.Value = "$OIVHOME/src/VolumeViz/Data/horizon.ldm";
HFGeom.dataSetId.Value = 1;
SoHeightFieldProperty HFProp = new SoHeightFieldProperty();
HFProp.fileName.Value = "$OIVHOME/src/VolumeViz/Data/horizon.ldm";
HFProp.dataSetId.Value = 2;
SoMaterial Material = new SoMaterial();
Material.diffuseColor.SetValue( 1, 1, 1 );
SoTransferFunction TF = new SoTransferFunction();
TF.predefColorMap.Value = SoTransferFunction.PredefColorMaps.STANDARD;
SoHeightFieldRender HFRend = new SoHeightFieldRender();
// SoComplexity node is used to adjust tessellation level
// of HeightFieldRender and simplify rendering.
SoComplexity complexity = new SoComplexity();
// Build scene graph
SoSeparator Root = new SoSeparator();
SoMultiDataSeparator VolSep = new SoMultiDataSeparator();
VolSep.AddChild( HFGeom );
VolSep.AddChild( HFProp );
VolSep.AddChild( Material );
VolSep.AddChild( TF );
VolSep.AddChild( HFRend );
Root.AddChild( complexity );
Root.AddChild( VolSep );

Java :

// Create nodes
SoHeightFieldGeometry HFGeom = new SoHeightFieldGeometry();
HFGeom.fileName.setValue( "$OIVHOME/src/VolumeViz/Data/horizon.ldm" );
HFGeom.dataSetId.setValue( 1 );
SoHeightFieldProperty HFProp = new SoHeightFieldProperty();
HFProp.fileName.setValue( "$OIVHOME/src/VolumeViz/Data/horizon.ldm" );
HFProp.dataSetId.setValue( 2 );
SoMaterial material = new SoMaterial();
material.diffuseColor.setValue( 1, 1, 1 );
SoTransferFunction TF = new SoTransferFunction();
TF.predefColorMap.setValue( SoTransferFunction.PredefColorMaps.STANDARD );
SoHeightFieldRender HFRend = new SoHeightFieldRender();
// SoComplexity node is used to adjust tessellation level
// of HeightFieldRender and simplify rendering.
SoComplexity complexity = new SoComplexity();
// Build scene graph
SoSeparator root = new SoSeparator();
SoMultiDataSeparator volSep = new SoMultiDataSeparator();
volSep.addChild( HFGeom );
volSep.addChild( HFProp );
volSep.addChild( material );
volSep.addChild( TF );
volSep.addChild( HFRend );
root.addChild( complexity );
root.addChild( volSep );