btHeightfieldTerrainShape vs btBvhTriangleMeshShape

Yo @Cedric … I got two questions for ya.

1… Are there any advantages like performance gains in using the btHeightfieldTerrainShape vs using a regular btBvhTriangleMeshShape for terrain collision

2… Are the any advantages like performance gains in dividing a large terrain meshes into smaller grid like chunks like a 3 x 3 grid for example. And if using triangle meshes, would be better to chunk the meshes up in a grid to make smaller pieces that have collision enabled on them

Trying to see what the best option for the Babylon Toolkit Terrain Exporter

I think the height field to be more performant and uses less memory.
The triangle mesh needs to contains meta data like BVH and triangles/vertices for the leaves.
Whereas, a simple array of height values and a world to local transform should be enough for a height shape.
That’s purely my guess on how I think it’s coded. As usual, a profiling session will help here.
Having smaller chunks can be a good thing if you can load/unload them. This will reduce your memory footprint at the price of a bigger CPU usage. It depends on your use case. If having a single height shape is not an issue, do not try to make it more complex.

Thank man :slight_smile:

1 Like