Click or drag to resize
SoHeightFieldRender Class

Heightfield rendering node.

Inheritance Hierarchy

Namespace: OIV.VolumeViz.Nodes
Assembly: OIV.VolumeViz (in OIV.VolumeViz.dll) Version: 2023.1.3.0 (2023.1.3)
Syntax
public class SoHeightFieldRender : SoSlice

The SoHeightFieldRender type exposes the following members.

Constructors
  NameDescription
Public methodSoHeightFieldRender

Constructor.

Top
Methods
  NameDescription
Public methodAffectsState

Overrides default method on OIV.Inventor.Nodes.SoNode.

(Inherited from SoShape.)
Public methodBeginShape(SoAction, SoShapeTriangleShapes)
Calls BeginShape(action, shapeType, (OIV.Inventor.Details.SoFaceDetail ^)nullptr).
(Inherited from SoShape.)
Public methodBeginShape(SoAction, SoShapeTriangleShapes, SoFaceDetail)

These methods can be used by subclasses to generate triangles more easily when those triangles are part of a larger structure, such as a triangle strip, triangle fan, or triangulated polygon, according to the TriangleShape enumerated type.

(Inherited from SoShape.)
Public methodCallback

Implements primitive generation for all shapes.

(Inherited from SoShape.)
Public methodComputeBBox(SoAction, SbXfBox3d, SbVec3d)

Compute object oriented bounding box (OOB) for subclass using information in the given action (which may not necessarily be an OIV.Inventor.Actions.SoGetBoundingBoxAction).

(Inherited from SoShape.)
Public methodComputeBBox(SoAction, SbBox3f, SbVec3f)

Computes the bounding box.

(Overrides SoVolumeShapeComputeBBox(SoAction, SbBox3f, SbVec3f).)
Public methodCopy
Calls Copy(false).
(Inherited from SoNode.)
Public methodCopy(Boolean)

Creates and returns an exact copy of the node.

(Inherited from SoNode.)
Public methodCopyFieldValues(SoFieldContainer)
Calls CopyFieldValues(fc, false).
(Inherited from SoFieldContainer.)
Public methodCopyFieldValues(SoFieldContainer, Boolean)

Copies the contents of fc's fields into this object's fields.

(Inherited from SoFieldContainer.)
Public methodDispose
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.)
Public methodDistribute
(Inherited from SoNode.)
Public methodDoAction
(Inherited from SoNode.)
Public methodEnableNotify

Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false).

(Inherited from SoFieldContainer.)
Public methodEndShape

end shape previously started with OIV.Inventor.Nodes.SoShape.BeginShape(OIV.Inventor.Actions.SoAction, OIV.Inventor.Nodes.SoShape.TriangleShapes, OIV.Inventor.Details.SoFaceDetail).

(Inherited from SoShape.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFieldsAreEqual

Returns true if this object's fields are exactly equal to fc's fields.

(Inherited from SoFieldContainer.)
Public methodGet

Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.

(Inherited from SoFieldContainer.)
Public methodGetAllFields

Returns a list of fields, including the eventIn's and eventOut's.

(Inherited from SoFieldContainer.)
Public methodGetAlternateRep

This method is called by actions to allow the node to provide an "alternate representation" when appropriate (typically depending on the action type).

(Inherited from SoNode.)
Public methodGetBoundingBox
Public methodGetEventIn

Returns a the eventIn with the given name.

(Inherited from SoFieldContainer.)
Public methodGetEventOut

Returns the eventOut with the given name.

(Inherited from SoFieldContainer.)
Public methodGetField

Returns a the field of this object whose name is fieldName.

(Inherited from SoFieldContainer.)
Public methodGetFieldName

Returns the name of the given field in the fieldName argument.

(Inherited from SoFieldContainer.)
Public methodGetFields

Appends references to all of this object's fields to resultList, and returns the number of fields appended.

(Inherited from SoFieldContainer.)
Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetMatrix
(Inherited from SoNode.)
Public methodGetName

Returns the name of an instance.

(Inherited from SoBase.)
Public methodGetPrimitiveCount

Counts number of primitives produced by this shape.

(Inherited from SoShape.)
Public methodGetRenderEngineMode

Returns the supported Render engine mode.

(Inherited from SoNode.)
Public methodGetRenderUnitID
(Inherited from SoVolumeShape.)
Public methodGetShapeType

Gets the current shape Full Scene Antialiasing type.

(Inherited from SoShape.)
Public methodGetStringName (Inherited from SoBase.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGLRender
(Inherited from SoSlice.)
Public methodGLRenderBelowPath
(Inherited from SoNode.)
Public methodGLRenderInPath
(Inherited from SoNode.)
Public methodGLRenderOffPath
(Inherited from SoNode.)
Public methodGrabEventsCleanup
(Inherited from SoNode.)
Public methodGrabEventsSetup
(Inherited from SoNode.)
Public methodHandleEvent
(Inherited from SoNode.)
Public methodHasDefaultValues

Returns true if all of the object's fields have their default values.

(Inherited from SoFieldContainer.)
Public methodIsBoundingBoxIgnoring

Used by BoundingBoxAction to know if bounding box computation should be ignored or not.

(Inherited from SoShape.)
Public methodIsNotifyEnabled

Notification is the process of telling interested objects that this object has changed.

(Inherited from SoFieldContainer.)
Public methodIsOverride

Returns the state of the override flag.

(Inherited from SoNode.)
Public methodStatic memberIsSupported
Calls IsSupported((OIV.Inventor.Misc.SoState )nullptr).
Public methodStatic memberIsSupported(SoState)

Returns true if graphic card can render an OIV.VolumeViz.Nodes.SoHeightFieldRender.

Public methodIsSynchronizable

Gets the ScaleViz synchronizable state of this object.

(Inherited from SoBase.)
Public methodPick
(Inherited from SoNode.)
Public methodRayPick

Depth of drawn horizon is saved in a texture and then, the depth of the picked point is recovered With screen coordinate,.

(Overrides SoShapeRayPick(SoRayPickAction).)
Public methodSearch
(Inherited from SoNode.)
Public methodSet

Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.

(Inherited from SoFieldContainer.)
Public methodSetName (Inherited from SoBase.)
Public methodSetOverride

Turns the override flag on or off.

(Inherited from SoNode.)
Public methodSetShapeType

set the antialiasing type for this shape.

(Inherited from SoShape.)
Public methodSetSynchronizable

Sets this to be a ScaleViz synchronizable object.

(Inherited from SoBase.)
Public methodSetToDefaults

Sets all fields in this object to their default values.

(Inherited from SoFieldContainer.)
Public methodShapeVertex

add a primitive vertex to the shape prevously started with OIV.Inventor.Nodes.SoShape.BeginShape(OIV.Inventor.Actions.SoAction, OIV.Inventor.Nodes.SoShape.TriangleShapes, OIV.Inventor.Details.SoFaceDetail).

(Inherited from SoShape.)
Public methodToString
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.)
Public methodTouch

Marks an instance as modified, simulating a change to it.

(Inherited from SoNode.)
Public methodWrite
(Inherited from SoNode.)
Top
Properties
  NameDescription
Public propertyalphaUse

Specifies how to use the alpha component of each voxel's RGBA value.

(Inherited from SoSlice.)
Public propertyalternateRep

This field optionally holds a subgraph containing only core Open Inventor nodes that can be used for rendering when VolumeViz is not available.

(Inherited from SoSlice.)
Public propertyboundaryCells

Boundary cells mode.

Public propertyboundingBoxIgnoring

Whether to ignore this node during bounding box traversal.

(Inherited from SoShape.)
Public propertybumpScale

Specifies the intensity of the bump mapping effect.

(Inherited from SoSlice.)
Public propertycellOutline

If true, draw outline of each heightField cell (default is false).

Public propertycellOutlineColor

When OIV.VolumeViz.Nodes.SoHeightFieldRender.cellOutline is true, this value specifies the cell outline color.

Public propertycellOutlineWidth

When OIV.VolumeViz.Nodes.SoHeightFieldRender.cellOutline is true, this value specifies the cell outline width in pixels.

Public propertycomposition Obsolete.

Specifies color composition mode.

(Inherited from SoVolumeShape.)
Public propertyenableBumpMapping

Specifies if a bump mapping effect will be applied to the slice.

(Inherited from SoSlice.)
Public propertyinterpolation

Interpolation mode.

(Inherited from SoVolumeShape.)
Public propertyIsDisposable
ISafeDisposable interface implementation.
(Inherited from SoDisposable.)
Public propertylargeSliceSupport

Activate/deactivate direct loading of full resolution slice data.

(Inherited from SoSlice.)
Public propertyUserData
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.)
Public propertyuseRGBA

Specifies whether to create RGBA textures.

(Inherited from SoSlice.)
Top
Remarks

OIV.VolumeViz.Nodes.SoHeightFieldRender displays a uniform grid in the XY plane whose vertices are height (Z) values stored in 2D LDM format (any LDM data set with the Z dimension equal to 1). Adding the combination of LDM data management with advanced GPU features provides a way to handle extremely large surfaces. Just as with volume data, LDM uses tiles of data and multiple levels of resolution to enable interactive frame rates even for data sets that cannot fit in system memory.

This node is used similarly to other VolumeViz shapes, but instead of an OIV.VolumeViz.Nodes.SoVolumeData node, you use an OIV.VolumeViz.Nodes.SoHeightFieldGeometry for the data set (height values) and optionally one or more OIV.VolumeViz.Nodes.SoHeightFieldProperty nodes for property data sets. When one or more OIV.VolumeViz.Nodes.SoHeightFieldProperty nodes are used, because there are multiple data nodes, they must be children of an OIV.LDM.Nodes.SoMultiDataSeparator node and the rules for multiple data sets apply (see OIV.VolumeViz.Nodes.SoVolumeData the parent class of OIV.VolumeViz.Nodes.SoHeightFieldGeometry). Otherwise, if no OIV.VolumeViz.Nodes.SoHeightFieldProperty nodes are used and only an OIV.VolumeViz.Nodes.SoHeightFieldGeometry node is present, the following rules apply:

Note that OIV.VolumeViz.Nodes.SoHeightFieldRender is derived from OIV.VolumeViz.Nodes.SoSlice and those inherited fields affect the rendering. In particular note that the alphaUse field applies to height field rendering and the default value (since Open Inventor 10.0) is ALPHA_OPAQUE. It means, for example, that the transparency in the color map will not affect rendering of the height map unless alphaUse is set to ALPHA_AS_IS.

Data set values are converted to height values in 3D space in two ways depending on the data type:

  • Integer values are normalized between [0,1] ([-1,1] for signed types) based on the range of values for the specific data type. For example, for UNSIGNED BYTE values the range 0..255 is mapped to 0..1.

  • Floating point values are not normalized (are used "as is").

Any height value in the OIV.VolumeViz.Nodes.SoHeightFieldGeometry data set that is equal to the "undefined" value will be rendered as a hole in the mesh. The undefined value can be specified during the LDM conversion using the "-u" option to the LDM converter:

      convert -u 127 -b 1 inputFile.lst
Or by setting the undefinedValue field of the OIV.VolumeViz.Nodes.SoHeightFieldGeometry node. The default value is NaN (Not a Number).

An OIV.VolumeViz.Nodes.SoHeightFieldPropertyMask node can also be used to specify undefined cells in the mesh. An undefined cell effectively removes the four corresponding height values from the mesh. (OIV.VolumeViz.Nodes.SoVolumeMask does not apply to height field rendering.)

A lighted heightfield

VolumeViz provides default shaders that conveniently color the surface using a single property, as shown in the 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.

The field OIV.VolumeViz.Nodes.SoHeightFieldRender.cellOutline enables drawing the edges of the mesh cells. BoundaryCells are cells close to an undefined value. If the OIV.VolumeViz.Nodes.SoHeightFieldRender.boundaryCells field is set to ALWAYS, these cells must always be considered at all resolution levels to avoid artifacts. In SMART mode, the default, we don't take this into account for distant views.

Normally this node uses the OpenGL tessellation shader extension to speed up rendering and automatically adjust the number of generated triangles depending on the camera position and orientation. In this mode, to change the number of generated triangles, use an OIV.Inventor.Nodes.SoComplexity node. A value of 1 means a full tessellation with a maximum of 4 triangles per pixel and a value of 0.5 means a maximum of 1 triangle per pixel.

If tessellation shaders are not available, a value of 1 means full resolution data is used to generate triangles (a grid of 10x10 will then generate 10x10 x2 triangles). A value of 0 means the lower resolution will be used.

To check if tessellation shaders are supported, use the method isAvailable( "GL_ARB_tessellation_shader" ) of OIV.Inventor.Devices.SoGLExtension class

When no OIV.VolumeViz.Nodes.SoHeightFieldProperty nodes are used and only an OIV.VolumeViz.Nodes.SoHeightFieldGeometry node is defined, the standard VolumeViz rules apply to the creation of a scene graph using OIV.VolumeViz.Nodes.SoHeightFieldRender. A minimal scene graph displaying a height field in this case is:

EXAMPLE

SoHeightFieldGeometry HFGeom = new SoHeightFieldGeometry();
 HFGeom.fileName.Value = "$OIVHOME/examples/data/VolumeViz/horizon.ldm";

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 Complexity = new SoComplexity();
 Complexity.value.Value = 0.25;

SoSeparator volSep = new SoSeparator();
 volSep.AddChild(HFGeom);
 volSep.AddChild(Material);
 volSep.AddChild(Complexity);
 volSep.AddChild(TF);
 volSep.AddChild(HFRend);
root.AddChild( volSep );

When one or more OIV.VolumeViz.Nodes.SoHeightFieldProperty nodes are used, multidata rules apply to the creation of a scene graph using OIV.VolumeViz.Nodes.SoHeightFieldRender and an OIV.LDM.Nodes.SoMultiDataSeparator node must be used instead of OIV.Inventor.Nodes.SoSeparator. A minimal scene graph displaying a heightfield in this case is:

EXAMPLE

SoHeightFieldGeometry HFGeom = new SoHeightFieldGeometry();
 HFGeom.fileName.Value = "$OIVHOME/examples/data/VolumeViz/horizon.ldm";
 HFGeom.dataSetId.Value = 1;

SoHeightFieldProperty HFProp = new SoHeightFieldProperty();
 HFProp.fileName.Value = "$OIVHOME/examples/data/VolumeViz/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 Complexity = new SoComplexity();
 Complexity.value.Value = 0.25;

SoMultiDataSeparator volSep = new SoMultiDataSeparator();
 volSep.AddChild(HFGeom);
 volSep.AddChild(HFProp);
 volSep.AddChild(Material);
 volSep.AddChild(Complexity);
 volSep.AddChild(TF);
 volSep.AddChild(HFRend);
root.AddChild( volSep );

Shaders

When used with an OIV.VolumeViz.Nodes.SoVolumeShader, a new shader function is available to compute lighting:

  • vec4 VVizComputeFrontColor(vec3 normal, vec4 color)): Add lighting to the color col.

The following shader code will light a heightfield:

vec4 VVizComputeFrontColor(vec3 n, vec4 col);

void main()
{
 vec3 tCoord0 = VVizComputeCoordinates(OivFragmentTexCoord(0).xyz);
 vec3 normal = normalize(VVizComputeNormal(texCoord));

 float sf = VVizCombineData(tCoord0);
 vec4 col = VVizComputeFragmentColor(vox, texCoord);

 col = VVizComputeFrontColor(normal, col);
 VVizOutputColor(col);
}

Multiple Data:

Using an OIV.LDM.Nodes.SoMultiDataSeparator, it is possible to combine datasets that have different dimensions or tile sizes. For instance, an OIV.VolumeViz.Nodes.SoHeightFieldGeometry dataset can be used with an OIV.VolumeViz.Nodes.SoHeightFieldProperty even if they don't have the same dimensions or tile sizes.

Composition with VolumeData:

It is possible to color a height field according to the values of a volume data. To do such rendering, the HeightField datasets and the OIV.VolumeViz.Nodes.SoVolumeData nodes must be in the same OIV.LDM.Nodes.SoMultiDataSeparator. A custom shader must also be defined to fetch values from the right datasets using their dataSetId. This is demonstrated in the HorizonInVolume example.

In addition, texture coordinates conversion functions are provided in the VolumeViz/vvizStructure.h shader include in order to help fetch the correct VolumeData values in custom shaders. For instance,

vec3 VVizTextureToTextureVec(in VVizDataSetId datasetSrc, in VVizDataSetId datasetDst, in vec3 texCoord);
can be used to convert texture coordinates related to one dataset to texture coordinates related to another dataset. The conversion is based solely on the transformations applied to each dataset, which are defined by their model matrix and their extent. Please note that the model matrix of a dataset is defined by the OIV.Inventor.Nodes.SoTransformation nodes that are placed before the OIV.LDM.Nodes.SoDataSet node in the order of the traversal.

Picking:

Similar to other geometry, OIV.Inventor.SoPickedPoint can return an OIV.Inventor.Details.SoDetail object specific to the OIV.VolumeViz.Nodes.SoHeightFieldRender node. The specific class is OIV.VolumeViz.Details.SoHeightFieldDetail.

Only GPU picking is supported. This means that the OIV.Inventor.Actions.SoRayPickAction used for picking must have its scene manager initialized using the method OIV.Inventor.Actions.SoAction.SetSceneManager(OIV.Inventor.SoSceneManager). OIV.Inventor.Actions.SoHandleEventAction does this automatically, so it is not necessary for the application to take any action when using (for example) an OIV.Inventor.Nodes.SoEventCallback node and calling the getPickedPoint() method. However if the application creates its own OIV.Inventor.Actions.SoRayPickAction then it must set the scene manager. If no scene manager is specified, a warning message is issued.

Limitations:

FILE FORMAT/DEFAULT

HeightFieldRender {
alphaUse ALPHA_OPAQUE
alternateRep NULL
bumpScale 1.0
cellOutline false
enableBumpMapping false
useRGBA falseOIV.Inventor.Fields.SoSFBool enableBumpMapping OIV.Inventor.Fields.SoSFFloat bumpScale OIV.Inventor.Fields.SoSFNode alternateRep OIV.Inventor.Fields.SoSFBool useRGBA OIV.Inventor.Fields.SoSFBool largeSliceSupport
}

See Also