[ODE] which method is best for large scale terrains?

tuan kuranes tuan.kuranes at gmail.com
Wed Oct 4 06:58:41 MST 2006


He is using dHeightfield .

Let me describe the situation he is more clearly :

highly tesselated terrain 512x512 and big object on it (a box that can 
cover up to 150 terrains vertices at once.).

Tha can leads to 2000 getheight calls, but getHeight is not the really 
the Bottleneck there, it's rather the plane construction code, which is 
heavy and not reusing previous results :

// Collide against all potential collision cells.
for ( i = nMinX; i < nMaxX; ++i )
for ( j = nMinZ; j < nMaxZ; ++j )
{
     numTerrainContacts += terrain->dCollideHeightfieldUnit(i,j);
}

dCollideHeightfieldUnit is computing triangles planes which geom will 
collide against, and in that loop that means compute several times 
exactly the same plane.

As a point share 6 triangles with its neighbour...
For each point at least Two planes is computed...
As each


Best would be a first pass getting all points, compute a BBox and see if 
it intersect geom.
A second pass would build all planes defined by those points, even 
possibly build an optimised plane list (why not merging when identical 
planes)
Third pass will collide those planes against the geom.

That should at least divide Planes computation by 6, as each points 
defines 6 triangles/plane, and divide collision by the same factor.






More information about the ODE mailing list