Click or drag to resize
SoHeightFieldRender Class

Heightfield rendering node.

Inheritance Hierarchy

Namespace: OIV.VolumeViz.Nodes
Assembly: OIV.VolumeViz (in OIV.VolumeViz.dll) Version: 9.9.36.0 (9.9.36.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 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 methodCallShouldGLRender Obsolete.
Calls CallShouldGLRender(action, false).
(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 SoGetBoundingBoxAction).

(Inherited from SoShape.)
Public methodComputeBBox(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 beginShape().

(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

Implements bounding box method using virtual computeBBox() method.

(Inherited from SoVolumeShape.)
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 methodGetRenderUnitID
(Inherited from SoNode.)
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 methodHandleInvisibleOrBBox Obsolete.
Calls HandleInvisibleOrBBox(action, false).
(Inherited from SoShape.)
Public methodHasDefaultValues

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

(Inherited from SoFieldContainer.)
Public methodIntersect

Returns true if the shape intersects the given tile.

(Inherited from SoLdmShape.)
Public methodIsBoundingBoxIgnoring

This method is used by getBoundingBox action traversal to know if the current node must be traversed or not, ie the bounding should be ignored.

(Inherited from SoNode.)
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 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 beginShape().

(Inherited from SoShape.)
Public methodShouldGLRender Obsolete.
Calls ShouldGLRender(action, false).
(Inherited from SoShape.)
Public methodShouldGLRenderCore(SoGLRenderAction) Obsolete.
Calls ShouldGLRenderCore(action, false, false).
(Inherited from SoShape.)
Public methodShouldGLRenderCore(SoGLRenderAction, Boolean) Obsolete.
Calls ShouldGLRenderCore(action, isPointsOrLines, false).
(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 cellOutline is true, this value specifies the cell outline color.

Public propertycellOutlineWidth

When 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 propertynormalPrecision Obsolete.

Obsoletesince Open Inventor 9300 No longer used.

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

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 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). Undefined or undesired points may be excluded by setting their value to the "undefined" value in the SoHeightFieldGeometry data set. In addition, undefined or undesired cells may be excluded by specifying a binary mask using an 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 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 SoHeightFieldGeometry node. The default value is NaN (Not a Number).

An 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. (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 cellOutline enables drawing the edges of the mesh cells. BoundaryCells are cells close to undefined value. If the 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 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 SoComplexity node to control and limit the number of generated triangles. Use the 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 SoHeightFieldRender. SoMultiDataSeparator must be used instead of SoSeparator. A minimal scene graph displaying a heightfield is:

EXAMPLE

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

SoHeightFieldProperty HFProp = new SoHeightFieldProperty();
 HFProp.fileName.Value = "$OIVHOME/examples/source/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 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 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, SoPickedPoint can return an SoDetail object specific to the SoHeightFieldRender node. The specific class is SoHeightFieldDetail.

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

Limitations:

At least one SoHeightFieldProperty which defines a property data set associated with the grid must be in the state.

If an SoROI is in the state, SoHeightFieldRender renders only one box of the ROI (ie: correct rendering only if SoROI's flag field is set to SUB_VOLUME)

Only SoHeightFieldGeometry data sets with a depth of 1 (Z dimension = 1) can be rendered.

The SoHeightFieldProperty and SoHeightFieldPropertyMask data sets must have exactly the same dimensions as the SoHeightFieldGeometry.

Triangle orientation after GPU tessellation cannot be controlled. Undefined value rendering is indeterministic.

For low resolution, undefined values can be taken into account in the property but not in the geometry. In such cases, coloring artifacts can appear.

Lighting is limited to directional lights and base color. Other kinds of lights can be implemented manually using a custom shader.

By default, two-sided lighting is not enabled ("back" side of surface will not be lighted). Use an SoShapeHints node to enable two-sided lighting.

The enableBumpMapping field is not supported on this node

SoHeightFieldPropertyMask and cellOutline can be used only if tesselation shaders are supported. Use the SoGLExtension method isAvailable( "GL_ARB_tessellation_shader" ) to check this support.

FILE FORMAT/DEFAULT

HeightFieldRender {
enableBumpMapping false
bumpScale 1.0
alternateRep NULL
useRGBA false
normalPrecision HIGH
cellOutline false
}

See Also