SoHeightFieldRender Class Reference
[Nodes]

VolumeViz Heightfield rendering node. More...

#include <VolumeViz/nodes/SoHeightFieldRender.h>

Inheritance diagram for SoHeightFieldRender:
SoSlice SoVolumeShape SoLdmShape SoShape SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Public Types

enum  BoundaryCells {
  ALWAYS,
  SMART,
  NONE
}

Public Member Functions

virtual SoType getTypeId () const
 SoHeightFieldRender ()

Static Public Member Functions

static SoType getClassTypeId ()
static SbBool isSupported (SoState *state=NULL)

Public Attributes

SoSFBool cellOutline
SoSFFloat cellOutlineWidth
SoSFColor cellOutlineColor
SoSFEnum boundaryCells

Detailed Description

VolumeViz Heightfield rendering node.

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 other VolumeViz shapes, 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. Because there are multiple data nodes, they must be children of an SoMultiDataSeparator node and the rules for multiple data sets apply (see SoVolumeData the parent class of SoHeightFieldGeometry).

Note that SoHeightFieldRender is derived from 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 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:

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 can also 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.)

horizon.jpg
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, 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 SoGLExtension class

Multidata rules apply to the creation of a scene graph using SoHeightFieldRender and an SoMultiDataSeparator node must be used instead of SoSeparator. A minimal scene graph displaying a heightfield is:

EXAMPLE

Shaders

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

The following shader code 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);
 }

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:

FILE FORMAT/DEFAULT

SEE ALSO

SoHeightFieldProperty, SoHeightFieldPropertyMask, SoHeightFieldRender, SoHeightFieldGeometry, SoMultiDataSeparator

See related examples:

HorizonIsolines, HorizonGpuCompose, SimpleHorizon, SimpleHorizonInMemory, SimpleHorizonRGBA


Member Enumeration Documentation

Boundary cells mode.

Enumerator:
ALWAYS 

Always compute boundary cells.

SMART 

Compute boundary cells according to the distance to the view.

NONE 

Never compute boundary cells.


Constructor & Destructor Documentation

SoHeightFieldRender::SoHeightFieldRender (  ) 

Constructor.


Member Function Documentation

static SoType SoHeightFieldRender::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoSlice.

virtual SoType SoHeightFieldRender::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoSlice.

static SbBool SoHeightFieldRender::isSupported ( SoState state = NULL  )  [static]

Returns true if graphic card can render a SoHeightFieldRender.

GPU must support geometry shaders, floating point textures and vertex buffer objects (VBO) and tessellation shaders


Member Data Documentation

Boundary cells mode.

Setting this field to SMART will not compute boundary cells for distant views. Use enum BoundaryCells. Default is SMART.

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

When cellOutline is TRUE, this value specifies the cell outline color.

Default is black : (0, 0, 0).

NOTE: field available since Open Inventor 9.7

When cellOutline is TRUE, this value specifies the cell outline width in pixels.

Default is 2 pixels.

NOTE: field available since Open Inventor 9.7


The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 6 Oct 2020
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/