Click or drag to resize
SoHeightFieldRender Class

Heightfield rendering node.

Inheritance Hierarchy

Namespace: OIV.VolumeViz.Nodes
Assembly: OIV.VolumeViz (in OIV.VolumeViz.dll) Version: 10.3.0.0 (10.3.0.0)
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)

Compute 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 a 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 drown horizon is save 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.m_cellOutline is true, this value specifies the cell outline color.

Public propertycellOutlineWidth

When OIV.VolumeViz.Nodes.SoHeightFieldRender.m_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 similar to OIV.VolumeViz.Nodes.SoVolumeRender, but instead of an OIV.VolumeViz.Nodes.SoVolumeData node, you use an OIV.VolumeViz.Nodes.SoHeightFieldGeometry for the data set (height values) and one or more OIV.VolumeViz.Nodes.SoHeightFieldProperty nodes for property data sets. Generally it obeys the same rules regarding multiple data sets (see OIV.LDM.Nodes.SoMultiDataSeparator). Undefined or undesired points may be excluded by setting their value to the "undefined" value in the OIV.VolumeViz.Nodes.SoHeightFieldGeometry data set. In addition, undefined or undesired cells may be excluded by specifying a binary mask using an OIV.VolumeViz.Nodes.SoHeightFieldPropertyMask node.

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 values in the OIV.VolumeViz.Nodes.SoHeightFieldGeometry data set that are equal to the "undefined" value will be rendered as holes 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 may 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.)

  <TABLE border=1 cellspacing=0 cellpadding=5>
    <TR><TD valign=_top> @image html horizon.jpg
    <TR><TD valign=_top> A lighted heightfield
 </TABLE>

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.m_cellOutline enables drawing the edges of the mesh cells. BoundaryCells are cells close to undefined value. If the OIV.VolumeViz.Nodes.SoHeightFieldRender.m_boundaryCells field is set to ALWAYS, these cells must be always 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, use the OIV.LDM.SoLDMGlobalResourceParameters method setMaxNumTriangles() to limit the number of generated triangles. Use the OIV.Inventor.Devices.SoGLExtension method isAvailable( "GL_ARB_tessellation_shader" ) to check if tessellation shaders are supported.

Multidata rules apply to the creation of a scene graph using a OIV.VolumeViz.Nodes.SoHeightFieldRender. OIV.LDM.Nodes.SoMultiDataSeparator must be used instead of OIV.Inventor.Nodes.SoSeparator. A minimal scene graph displaying a heightfield 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 code will light a heightfield:

vec4 VVizComputeVolumeRendering(float sf);
float VVizCombineData(vec2 tcoord);
vec3 VVizComputeCoordinates(const vec3);
void VVizOutputColor(vec4 color);
vec4 VVizComputeFrontColor(vec3 n, vec4 col);
vec3 VVizComputeGradient(vec3 tcoord);

void main()
{
 vec3 tCoord0 = VVizComputeCoordinates(gl_TexCoord[0].xyz);
 vec3 grad = VVizComputeGradient(tCoord0);
 vec3 normal = normalize(gl_NormalMatrix*grad);

 float sf = VVizCombineData(tCoord0.xy);
 vec4 col = VVizComputeVolumeRendering(sf);

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

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) a 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 {
enableBumpMapping false
bumpScale 1.0
alternateRep NULL
useRGBA false
cellOutline false
}

See Also