6.2. Elevation Management

The first step consists of initializing the TerrainViz module by calling the static method init() of the SoTViz class.

The SoTVizRender class is the main node that manages data and textures. It can be tuned by adjusting the number of displayed triangles and turning the frustum culling on/off (enabled by default).

The terrain is managed by being divided into patches so as to split the tessellation work. Frustum culling eliminates the patches of the terrain outside the view volume so as to concentrate on the visible region. So, fewer patches are tessellated and the same number of triangles required are displayed but in the visible region.

The tessellator refines parts of the terrain depending on the gradient of elevation and on the size of the on-screen projection. This means that a mountain will be more refined than a flat lake, even if it is farther away because its on-screen projection is greater than that of a flat region.

[Warning]

The triangle size attenuation and the distance attenuation parameters are deprecated beginning with TerrainViz 2.0. The new tessellation engine no longer uses these parameters.

TerrainViz mesh density

Figure 6.2.  TerrainViz mesh density


In the following example, this node uses a regular grid elevation file (susanville.dat) that can be binary or ASCII. The data is handled by an SbTVizRegularGridData object. Sampling steps for X, Y, Z, and offset (translation) of the terrain must be provided.

Example 6.1.  A simple example using SoTVizRender