btBvhTriangleMeshShape and streamed 3D models
Posted: Wed May 24, 2017 1:42 pm
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
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