btBvhTriangleMeshShape and btTriangleInfoMap serialization

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
Post Reply
DavidM
Posts: 1
Joined: Thu Jul 26, 2012 9:52 am

btBvhTriangleMeshShape and btTriangleInfoMap serialization

Post by DavidM »

We've just started using Bullet recently and as part of our build process we create a single btBvhTriangleMeshShape to represent the static part of our 'world'. At this point we also create a btTriangleInfoMap and use btGenerateInternalEdgeInfo() to generate the data for the internal edge utility to prevent collision with internal triangle edges at runtime.

These are then serialized out and loaded at runtime using the btBulletWorldImporter.

I've found a couple of problems with this, firstly btTriangleInfoMap doesn't serialize properly. It's derived from btHashMap and the hash map implementation uses the capacity of one of it's members. This capacity gets changed when you serialize it out (it gets trimmed to the size of the array) and so none of the hashes match up anymore. I've fixed this locally by adding a trim function to the hashmap and calling that before serializing it in the btTriangleInfoMap, but it's a problem with any btHashMap serialization.

The second issue is that in btBulletWorldImporter the code that deserializes btOptimizedBVH is #if 0'ed out, so instead of using the bvh that's been stored a new one is generated at runtime. I've put it back in and not had any obvious issues, but I guess there was a reason for removing it - does anyone know why?

We're using Bullet 2.80-rev2531
VicariousEnt
Posts: 50
Joined: Fri Oct 29, 2010 1:37 am

Re: btBvhTriangleMeshShape and btTriangleInfoMap serializati

Post by VicariousEnt »

I re-enabled that code as well and have had no problems with it thus far. Not sure why it was removed either. I still need to add the InternalEdgeInfo, good to know about that problem.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: btBvhTriangleMeshShape and btTriangleInfoMap serializati

Post by Erwin Coumans »

The latest trunk, and Bullet 2.81 release enables the import/deserialization of the BVH, see
http://code.google.com/p/bullet/source/ ... porter.cpp

We still need to fix the btTriangleInfoMap /btHashMap serialization indeed.
If you have a fix, can you contribute it to this issue?
https://code.google.com/p/bullet/issues/detail?id=353

Thanks,
Erwin
Post Reply