btBvhTriangleMeshShape and streamed 3D models

Post Reply
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

btBvhTriangleMeshShape and streamed 3D models

Post by gjaegy »

Hi guys

We have a huge world (full earth), we are streaming/paging (in/out) some 3D models (think buildings here). We want to allow them to have a collision mesh (basically a btBvhTriangleMeshShape per streamable chunk).

So, we also have to stream the collision mesh; they will be added/removed to the physic world dynamically.

We must be very careful about memory fragmentation here, since we can stream thousands of 3D models in and out, which can easily lead to a heavy fragmentation after a few hours, if not implemented carefully.

I am not fully sure what the best option would be for us:

- use built-in Bullet serialization/mechanism, building our btBvhTriangleMeshShape durnig the build process, and reuse them at run-time. Not sure about memory usage here. Also, not sure whether the serialialisation format is likely to be backward compatible for some time, or if we might expect frequent format changes here ? I am a bit reluctant to be dependant on such external file format I must say.

- rebuild the btBvhTriangleMeshShape object at runtime, once a 3D model gets loaded (possibly asynchronously, therefore assuming thread-safety in the build process). No dependency on Bullet serialization format, however, likely to require some more time (not a big deal if done asynchronously for us), but also likely to increase fragmentation (more going on).

Any input on that problem and the best strategy would be welcome !

Thanks a lot
Greg
ktfh
Posts: 44
Joined: Thu Apr 14, 2016 3:44 pm

Re: btBvhTriangleMeshShape and streamed 3D models

Post by ktfh »

To avoid fragmentation I would precalculate and serialize all the btBvhTriangleMeshShape, then use pools of fixed sized allocations equal to the largest mesh and bvh and recycle the allocation when the object is streamed out. I think the serialization format is fairly simple but you would have to write your own importer.
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

Re: btBvhTriangleMeshShape and streamed 3D models

Post by gjaegy »

OK this sounds like a sensible approach. I will have a closer look at Bullet internal serialization code (assuming you suggest using that system for serialization).

Can I assume some kind of stability of that serialization format within the next years, or shall I expect it to potentially change with each new version of Bullet ?
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: btBvhTriangleMeshShape and streamed 3D models

Post by drleviathan »

I think the serialization format is relatively stable: it does NOT change on every new version of Bullet.
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

Re: btBvhTriangleMeshShape and streamed 3D models

Post by gjaegy »

good news, I should admit I am quite reluctent on depending on a file format we don't have control over...

thanks for your answer !!
Post Reply