A view onto a 3D terrain mesh.
At runtime, the application loop callbacks of all terrain views of a terrain mesh must be called, as described by IApplication and ApplicationLoop.MainLoop. The time deltas that are passed to IUpdateableFrameTime.UpdateFrameTime will be processed so that all terrain views receive the same time delta for each update cycle.
Updating the terrain views of a terrain mesh with IUpdateableFrameTime.UpdateFrameTime will trigger calls to MeshBuffer.MeshUpdate, to make sure that exactly one mesh buffer update is performed at the beginning of each update cycle. If there are no terrain views, the MeshBuffer.MeshUpdate method will not be called automatically.
For rendering, the terrain feature level (see ITerrainFeatureLevels.FeatureLevel) is clamped to ITerrainFeatureLevels.FeatureLevelMin and ITerrainFeatureLevels.FeatureLevelMax and the clamped feature level is used to create the terrain render effect (see TerrainParameters.FeatureLevel). Each time the terrain render effect is (re-)created, the triangle mode of the triangulation buffer (see TriangulationBuffer) is reset to the default value of the feature level, which is TriangleMode.SectorList for TerrainFeatureLevel.DX11 or higher and TriangleMode.TriangleStrip otherwise.
The terrain view provides a number of aggregated helper objects, which can be used to access / configure specific aspects of the terrain view:
Global settings for image-based high-dynamic range lighting
Coordinate system settings for material-based texturing on curved surfaces.
The helper for performing cascaded shadow-mapping.
Visual settings for the sky background.
The render stage that is used for rendering.
The buffer that holds the result of terrain mesh triangulation.
The camera viewport of the terrain view.
The vertex visibility check that is used by terrain mesh refinement.
Use the following properties to control the terrain view behaviour:
Sets the pixel bounds of the terrain view.
Controls the granularity of terrain mesh processing.
The GPU feature level to use for the terrain view.
Sets the terrain view behaviour flags.
Controls the scene fog.
The default flags.
A profiler value that groups values of the render pipeline.
CPU time spent on preparing the terrain, for example culling or texturing (milli-seconds).
CPU time spent on rendering 3D models and planting (milli-seconds).
CPU time spent preparing instanced 3D models and planting (milli-seconds).
A profiler value that groups values that are related to terrain processing.
Resource cache utilization (percent).
Texture tile utilization of the texture atlas (percent).
- See also
Visible vertices in the terrain mesh buffer (percent).
Estimated cache locality of current terrain.
- See also
Creates a new instance of TerrainView.
Queries terrain view flags.
Updates terrain view flags.
Produces profiler variable values.
The screen bounds of this terrain view.
- See also
The cone angle to use for culling, see ConeCulling.ConeAngle.
The distance to use for culling, see DistanceCulling.Distance.
When this property is set to
0, the culling distance will be computed automatically.
The tessellation threshold for GPU terrain displacement, given as the average edge length of the triangles in the terrain mesh.
The behaviour flags of this terrain view.
Defaults to FlagsDefault.
The fog distance.
0 to compute a nice fog distance automatically.
Defines the north-direction in terrain-space to use for setting up the local coordinate system for lighting and material coordinates.
If the Vec4D.W component of this vector is zero, this vector is normalized and used as the north-direction.
If the Vec4D.W component of this vector is not zero, this vector will be scaled by 1/W (resulting in the north position) and the north-direction is computed so that it points from the current camera position towards the north position.
The local coordinate system for lighting and material coordinates is defined as follows:
The Y-axis is mapped to the up-vector of the terrain.
For planar terrains, the up-vector is computed via IGeometry.ComputeUp.
For geocentric terrains, the up-vector is computed by normalizing the terrain-space position.
The X-axis is mapped to the cross product of the north-direction and the up-vector.
The Z-axis is mapped to the cross product of the side-vector and the up-vector.
The coordinate origin is coincident with the camera position in terrain-space.
A terrain is considered to be geocentric iff IGeometry.ToGeocentric returns a non-null value; otherwise it is considered to be planar.
Defaults to Vec4D.Zero
Returns the helper object that provides coordinate transformation methods between terrain-space, light-space and material-space.
The aggregated ShadowMapping object.
Tweaks the shadow cascade range by setting the lower bound (see ShadowMapping.Cascade).
Returns the TerrainSky object that represents the sky background for the terrain.
The IRenderStage object that is used by this terrain view.
Returns the overall detail of unique terrain texturing.
- See also
Returns the overall progress of unique terrain texturing.
If the terrain does not have any unique texturing layers, this property will return 100.
Returns the triangulation buffer that this view is using to render the terrain.
Returns the viewport of this terrain view.