Increasing Altitude Precision

By default, NavData is only guaranteed to follow the vertical altitude of your terrain meshes with a limited degree of accuracy. Since the NavMesh are intended as an abstract representation of the navigability and topology of the terrain, Autodesk Navigation runtime components do not need them to follow the exact altitude of the terrain very closely as long as they successfully distinguish navigable areas from non-navigable areas.

However, in some cases you may find that it is more convenient to have accurate altitude information embedded directly in your NavMesh. For example, to adjust the altitude of your characters so that they appear to stay clamped to the ground as they walk around, you may find it much cheaper in CPU time to use the altitude of the NavMesh rather than using physics raycasts, even if the results are typically somewhat less precise.

When you need greater precision, the NavData generation system offers the ability to constrain the altitude of the NavMesh to follow the altitude of the original terrain mesh within a tolerance that you specify. This typically produces a NavMesh with more, smaller triangles.

How vertical accuracy is ensured

After the NavData generation system creates the NavData for your terrain, it conducts a post-processing step that adjusts the altitude of the NavMesh to match the altitude of the original terrain mesh more closely.

The system first creates a horizontal sampling grid with a configurable spacing. In order to ensure that this grid matches the original rasterization, the spacing is adjusted internally to a multiple of the pixel size originally set for the rasterization of the terrain mesh. At each of these sampling points, the difference in altitude between the terrain mesh and the NavMesh is examined.

Example

To visualize the difference between the default NavMesh and a vertically accurate NavMesh, take the following sample terrain.

Assuming the movement model configured for the NavData generation system allows the character to traverse these pyramids freely, the following NavMesh is generated by default.

The NavMesh shown above accurately represents the navigability of the area, and can be used at runtime by your bots without problems. However, although the general shape of the terrain can be seen in the NavMesh, it does not reflect the altitude of the original terrain mesh very closely. If you were to use the altitude of this NavMesh to determine the altitude of your characters without using a collision system to clamp their feet to the actual ground altitude, your characters’ feet would alternately hover a little above the ground or a little below the pyramids. (Note that to avoid Z-fighting, the Navigation Lab offsets the altitude of the NavMesh a little from the altitude of the terrain for display purposes. The real altitude of the NavMesh crosses under the terrain mesh in places.)

You can therefore decrease the vertical tolerance (and the horizontal sampling step) in order to increase the precision with which the NavMesh follows the terrain. If necessary, you can achieve a very high fidelity like in the following image:

Keep in mind that as you decrease the tolerance:

Setting the altitude tolerance

You can set the altitude tolerance in both the Autodesk Navigation Lab and the API of the NavData generation system.

Using the Navigation Lab

To set up the altitude tolerance in the Navigation Lab:

Using the Generator in C++

To set up the altitude tolerance in the Generator:

Decreasing the default altitude precision

You can decrease the default altitude precision by setting a desired value in the Altitude tolerance (m) control.

Although, this will decrease generation time somewhat, and may also decrease the final size of your NavData, it is not recommended in most cases. In areas where the altitude of the NavMesh diverges significantly from the altitude of your terrain, your runtime components may be unable to correctly retrieve the NavMesh that corresponds to given 3D positions at or above the ground level in order to spatialize your bots and obstacles. This may lead to failed navigational queries and problems using the obstacle management system.