SoHeightFieldRender Class |
Heightfield rendering node.
Namespace: OIV.VolumeViz.Nodes
The SoHeightFieldRender type exposes the following members.
Name | Description | |
---|---|---|
SoHeightFieldRender | Constructor. |
Name | Description | |
---|---|---|
AffectsState | Overrides default method on OIV.Inventor.Nodes.SoNode. | |
BeginShape(SoAction, SoShapeTriangleShapes) | Calls BeginShape(action, shapeType, (OIV.Inventor.Details.SoFaceDetail ^)nullptr). (Inherited from SoShape.) | |
BeginShape(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. | |
Callback | Implements primitive generation for all shapes. | |
ComputeBBox(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). | |
ComputeBBox(SoAction, SbBox3f, SbVec3f) | Computes the bounding box. | |
Copy | Calls Copy(false). (Inherited from SoNode.) | |
Copy(Boolean) | Creates and returns an exact copy of the node. | |
CopyFieldValues(SoFieldContainer) | Calls CopyFieldValues(fc, false). (Inherited from SoFieldContainer.) | |
CopyFieldValues(SoFieldContainer, Boolean) | Copies the contents of fc's fields into this object's fields. | |
Dispose |
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.) | |
Distribute | (Inherited from SoNode.) | |
DoAction | (Inherited from SoNode.) | |
EnableNotify | Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false). | |
EndShape | end shape previously started with OIV.Inventor.Nodes.SoShape.BeginShape(OIV.Inventor.Actions.SoAction, OIV.Inventor.Nodes.SoShape.TriangleShapes, OIV.Inventor.Details.SoFaceDetail). | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
FieldsAreEqual | Returns true if this object's fields are exactly equal to fc's fields. | |
Get | Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. | |
GetAllFields | Returns a list of fields, including the eventIn's and eventOut's. | |
GetAlternateRep | This method is called by actions to allow the node to provide an "alternate representation" when appropriate (typically depending on the action type). | |
GetBoundingBox | (Overrides SoVolumeShapeGetBoundingBox(SoGetBoundingBoxAction).) | |
GetEventIn | Returns a the eventIn with the given name. | |
GetEventOut | Returns the eventOut with the given name. | |
GetField | Returns a the field of this object whose name is fieldName. | |
GetFieldName | Returns the name of the given field in the fieldName argument. | |
GetFields | Appends references to all of this object's fields to resultList, and returns the number of fields appended. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetMatrix | (Inherited from SoNode.) | |
GetName | Returns the name of an instance. | |
GetPrimitiveCount | Counts number of primitives produced by this shape. | |
GetRenderEngineMode | Returns the supported Render engine mode. | |
GetRenderUnitID | (Inherited from SoVolumeShape.) | |
GetShapeType | Gets the current shape Full Scene Antialiasing type. | |
GetStringName | (Inherited from SoBase.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GLRender | (Inherited from SoSlice.) | |
GLRenderBelowPath | (Inherited from SoNode.) | |
GLRenderInPath | (Inherited from SoNode.) | |
GLRenderOffPath | (Inherited from SoNode.) | |
GrabEventsCleanup | (Inherited from SoNode.) | |
GrabEventsSetup | (Inherited from SoNode.) | |
HandleEvent | (Inherited from SoNode.) | |
HasDefaultValues | Returns true if all of the object's fields have their default values. | |
IsBoundingBoxIgnoring | Used by BoundingBoxAction to know if bounding box computation should be ignored or not. | |
IsNotifyEnabled | Notification is the process of telling interested objects that this object has changed. | |
IsOverride | Returns the state of the override flag. | |
IsSupported | Calls IsSupported((OIV.Inventor.Misc.SoState )nullptr). | |
IsSupported(SoState) | Returns true if graphic card can render an OIV.VolumeViz.Nodes.SoHeightFieldRender. | |
IsSynchronizable | Gets the ScaleViz synchronizable state of this object. | |
Pick | (Inherited from SoNode.) | |
RayPick | Depth of drawn horizon is saved in a texture and then, the depth of the picked point is recovered With screen coordinate,. | |
Search | (Inherited from SoNode.) | |
Set | 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. | |
SetName | (Inherited from SoBase.) | |
SetOverride | Turns the override flag on or off. | |
SetShapeType | set the antialiasing type for this shape. | |
SetSynchronizable | Sets this to be a ScaleViz synchronizable object. | |
SetToDefaults | Sets all fields in this object to their default values. | |
ShapeVertex | 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). | |
ToString |
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.) | |
Touch | Marks an instance as modified, simulating a change to it. | |
Write | (Inherited from SoNode.) |
Name | Description | |
---|---|---|
alphaUse | Specifies how to use the alpha component of each voxel's RGBA value. | |
alternateRep | This field optionally holds a subgraph containing only core Open Inventor nodes that can be used for rendering when VolumeViz is not available. | |
boundaryCells | Boundary cells mode. | |
boundingBoxIgnoring | Whether to ignore this node during bounding box traversal. | |
bumpScale | Specifies the intensity of the bump mapping effect. | |
cellOutline | If true, draw outline of each heightField cell (default is false). | |
cellOutlineColor | When OIV.VolumeViz.Nodes.SoHeightFieldRender.cellOutline is true, this value specifies the cell outline color. | |
cellOutlineWidth | When OIV.VolumeViz.Nodes.SoHeightFieldRender.cellOutline is true, this value specifies the cell outline width in pixels. | |
composition | Obsolete. Specifies color composition mode. | |
enableBumpMapping | Specifies if a bump mapping effect will be applied to the slice. | |
interpolation | Interpolation mode. | |
IsDisposable | ISafeDisposable interface implementation.
(Inherited from SoDisposable.) | |
largeSliceSupport | Activate/deactivate direct loading of full resolution slice data. | |
UserData |
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.) | |
useRGBA | Specifies whether to create RGBA textures. |
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:
If an OIV.LDM.Nodes.SoTransferFunction node is on the state, then the OIV.VolumeViz.Nodes.SoHeightFieldGeometry node is also used as a property node and the height field is colored according to the height values and the transfer function, just as if an OIV.VolumeViz.Nodes.SoHeightFieldProperty node was defined with the same data.
If no OIV.LDM.Nodes.SoTransferFunction node is on the state, then the height field is colored using the current material on state.
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.lstOr 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:
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:
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); }
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);
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:
At least one OIV.VolumeViz.Nodes.SoHeightFieldProperty which defines a property data set associated with the grid must be in the state.
If an OIV.LDM.Nodes.SoROI is in the state, OIV.VolumeViz.Nodes.SoHeightFieldRender renders only one box of the ROI (ie: correct rendering only if OIV.LDM.Nodes.SoROI's flag field is set to SUB_VOLUME)
Only OIV.VolumeViz.Nodes.SoHeightFieldGeometry data sets with a depth of 1 (Z dimension = 1) can be rendered.
The OIV.VolumeViz.Nodes.SoHeightFieldProperty and OIV.VolumeViz.Nodes.SoHeightFieldPropertyMask data sets must have exactly the same dimensions as the OIV.VolumeViz.Nodes.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 OIV.Inventor.Nodes.SoShapeHints node to enable two-sided lighting.
The enableBumpMapping field is not supported on this node
OIV.VolumeViz.Nodes.SoHeightFieldPropertyMask and OIV.VolumeViz.Nodes.SoHeightFieldRender.cellOutline can be used only if tesselation shaders are supported. Use the OIV.Inventor.Devices.SoGLExtension method isAvailable( "GL_ARB_tessellation_shader" ) to check this support.
HeightFieldRender {
alphaUse | ALPHA_OPAQUE | ||
alternateRep | NULL | ||
bumpScale | 1.0 | ||
cellOutline | false | ||
enableBumpMapping | false | ||
useRGBA | false | OIV.Inventor.Fields.SoSFBool enableBumpMapping OIV.Inventor.Fields.SoSFFloat bumpScale OIV.Inventor.Fields.SoSFNode alternateRep OIV.Inventor.Fields.SoSFBool useRGBA OIV.Inventor.Fields.SoSFBool largeSliceSupport |