PathEngine home previous: Filtering Steep Facesnext: Automating Connections
Contents, Programmers Guide, World Representation, 2D Content Processing, Mesh Optimisation

Mesh Optimisation

PathEngine includes functionality for reducing the complexity of the external edges of a mesh or the internal edges of a mesh that form a boundary between different surface attribute regions.

External edge optimisation

The external edges of a mesh are important because external edges are treated as obstructions, and so the complexity of external edge geometry can significantly affect the complexity of pathfinding and collision queries for a mesh.

The external edge optimisation feature of the PathEngine content processing is designed to reduce the complexity of ground mesh external edges, in an automated way, whilst keeping the changes to the actual geometry of those external edges beneath a specified error threshold.

It is also possible to optimise boundaries between different ground attribute regions, within a ground mesh. (See 'Optimising internal boundaries', below.)

(Note that internal 'detail' ground mesh vertices are not targetted by this optimisation, because the SDK is designed to enable detail vertices to be filtered out of ground meshes with the terrain callback mechanism, and because detail vertices are also filtered out of the core pathfinding and collision representations and so do not affect the performance of those queries.)

This functionality is off by default and can be turned on by supplying an 'optimiseWithThreshold' attribute to the content processing.
This attribute both turns on optimisation and also specified a maximum error value to be applied during the optimisation.

Vertices are removed along an external edge if the horizontal and vertical distances between the original position of the vertex and the line after removal are each within the specified maximum error value.

Vertices are not removed if face attributes differ for faces around the vertices.

A mesh before external vertex optimisation.

The same mesh after external vertex optimisation. (Only the external edges are simplified.)

Specifying separate horizontal and vertical component threshold values

By default the value passed in for the 'optimiseWithThreshold' attribute is applied for both horizontal and vertical components of the error value, but separate values can be used by also supplying an 'optimiseThreshold_Vertical' attribute.

If this attribute is not set, then both horizontal and vertical error thresholds are set to the value passed in for the 'optimiseWithThreshold' attribute.

If an 'optimiseThreshold_Vertical' attribute is set, then horizontal error threshold is set to the value passed in for the 'optimiseWithThreshold' attribute, and vertical error threshold is set to the value passed in for the 'optimiseThreshold_Vertical' attribute.

(This can be useful in some situations where more precision is desired for the ground height component of the ground mesh, whilst still optimising out horizontal edge detail.)

The 'optimiseThreshold_Vertical' attribute value can also be set to -1 to indicate that the vertical error component should be ignored completely.

Optimising internal boundaries

In addition to external edge optimisation, PathEngine can also optimise the boundaries between mesh regions with different ground attribute values.

This is controlled by the 'optimiseBoundariesWithThreshold' and 'optimiseBoundariesThreshold_Vertical' content processing options, which work in a similar way to the external edge optimisation options described above.

Documentation for PathEngine release 6.00 - Copyright © 2002-2016 PathEnginenext: Automating Connections