recastnavigation-Understanding Altitude Field

Source: Internet
Author: User
Tags compact

This article is translated from ctritterai:http://critterai.org/projects/cainav/doc/html/6fb3041b-e9be-4f03-868b-dcac944df19b.htm

Recastnavigation is a very powerful pathfinding system, which is widely used in all major game engines. such as unreal,unity and so on. I also tried to see some recastnavigation source code, added some comments, and put it on my own GitHub (Https://github.com/youlanhai/recastnavigation-learn).

Critterai is a set of pathfinding systems based on the recastnavigation principle, so understanding Critterai is equivalent to understanding recastnavigation. Because recastnavigation study material is relatively few, when I see this article, feel can help us to understand recastnavigation, so translation down to share with you, there is a wrong place to make corrections. Here is the original translation: Overview

To be able to use the generation features of advanced navigation grids, you need to understand the core of the Nmgen build process. To understand this build process, you need to understand the altitude field (Heightfield). There are two kinds of altitude fields: the Voxel set (voxel field) and the vertex set (vertex field).

The voxel set includes the normal height field (Heightfield) and the Condensed height field (Compactheightfield).

The vertex set includes the contour set (Contourset) and the polygon mesh (Polymesh). Overview of the Height field structure (Basic Heightfield Structure)

Imagine a aabb in Euclidean space (Euclidean spaces) whose boundaries are defined using the minimum and maximum vertices.

Now, use a fixed width and depth (xzcellsize) to cut the box vertically into columns. Each column is a lattice.

Next, cut each column with a fixed height increment (ycellsize), dividing each column into small axis-aligned bounding boxes. Each box is a voxel. The 8 vertices at the corner of the box are the vertex sets.

Vertex sets are relatively easy to understand, they are the vertices in the lattice. But voxel needs more explanation. Solid Height field (the solid Hieghtfield)

In this article, the term body reasoned is replaced by the interval (span), because the interval is the voxel of the compressed storage.

Imagine that there is such a column of voxel. The voxel may be a solid area that represents an obstacle, or it may be an open space, indicating that there is nothing in this position.

We combine the continuous solid voxel in a column into a solid interval.

These solid intervals are stored using the HEIGHTFIELDSPAN structure. The solid interval consists of a height field that represents the barrier space.

Open Compact Height field (the Open compact Heightfield)

We don't just focus on the solid space itself, but many of the algorithms are executed above the solid interval. For a navigation grid to be generated, it is more important than the solid space for its upper space. The opening interval , which represents the space 1.

It is important to note that the open range does not simply reverse the solid space. If a column of the height field does not include any solid intervals, then it does not have an open interval. Also, the lower part of the solid interval is ignored by 2. The open interval in a column, starting at the top of a solid space, extends upward to the bottom of the contiguous solid interval. (if there are no solid bands above, then it extends to infinity.)

Note: The following example shows an open interval, although the first eye may not see a noticeable difference, but 3 open intervals (yellow) can be observed.

Open zones, which are stored using Compactspan structures, form a tight height field that represents the open space. The part of space above the solid space ↩: Because it is dangling, the character cannot stand in the air ↩

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.