shown in other instead.
Terrain occluder provides the cheaper and more efficient way of handling intersections with the terrain, especially when they are large-scaled and have a lot of objects placed upon it. Invisible objects that are culled by the occluder are not sent to the GPU, which increases performance.
When to Use Terrain Occluder
To provide increased performance, terrain occluders should be used wisely.
Terrain Occluder Texture
Terrain Occluder is a RGB8 texture automatically generated from the downsized height map. It contains:
- Red channel - a height map
- Green and Blue channels - a cone map (radius and height of cones).
To create the occluder texture, the engine is fed with a height map, the same as for the occluded terrain, but downsized. The smaller the imported height map, the better. If the visible relief is falsely culled by the occluder, use the bigger sized height map. For example, the 8193x8193 terrain can be occluded with the use of 256x256 or 512x512 height map.
On the base of a downsized height map, the cone map is automatically calculated and the height map is replaced with the occluder texture.
The simple approach to calculate intersection with the terrain occluder is to trace a ray from the camera and use a fixed step to advance it, until it intersects with the height map. This approach has the disadvantages of both slow speed, a lot of texture fetches and low accuracy.
Instead, cone-step mapping provides a more effective solution that uses a precomputed cone map to substantially accelerate calculations. A cone map places an inverted cone with a vertex on each of the height map texels. The radius of the cone is expanded until it hits any of surrounding heights with its side.
- This maximum wide angle is stored in the green channel of the occluder texture - the cone map.
- The height of the cone is stored in the blue channel.
When the ray is traced along the viewing direction, it intersects with a cone and instead of continuing to sample within it, it leaps straight to its outside. Searching inside the cone can be safely omitted since no intersections with the height field are guaranteed within it. The next tracing point to leap to along the ray is the outside of the next cone, thus skipping large areas of texture space. This approach is both cheap, fast and accurate.
|Size||Size of the terrain occluder box along X, Y and Z axis.
To avoid the visual artifacts, it is strongly recommended to place terrain occluder node slightly lower than the occluded terrain.
|Radius||The distance from the camera to perform the occlusion. Up to this distance the ray is traced. Most of the geometry is culled by the foreground objects, so the occlusion by the distant objects can be disregarded to save performance.|
|Distance||The terrain occluder is completely disabled when the camera moves away from its box on the specified distance.|
Cone-step mapping is a time consuming operation. If there are no changes in terrain relief, do not assign heights texture each time on world load. Instead, simply specify the occluder texture directly for faster loading.