Using Bullet in an extremely large world.

NdotL
Posts: 2
Joined: Fri Jan 23, 2009 6:15 pm

Using Bullet in an extremely large world.

Post by NdotL »

I've been evaluating physics engines for our product and I just have a quick question regarding bullet and how it is best used in this situation.

I have a massive world and would mainly use bullet for collision with objects / characters on the terrain. The terrain system is paging and loads as needed and the world can be quite massive. So I am trying to find the best way of handling such a system with Bullet. I know that I need to set min/max for worldAabbMin/Max but I'm not sure how to handle it with such a large terrain as I also want to make sure I do not degrade performance. I treat each "page" of the terrain as a heightfield so it is easily pieced together with seperate btHeightField's, but in practice should I also load/unload these into the physics world and modify the origin when a page unloads?

Any thoughts are appreciated.

EDIT: Another thought I had was possibly using a dynamics world per page, has anyone tried this or is it a bad idea?
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Using Bullet in an extremely large world.

Post by sparkprime »

I have a (6000,6000,6000) cube as my world and it seems to work fine. I stream Bullet rigid bodies in and out to keep the broadphase sane. My streaming is based around the game objects, so a whole game object (graphics, physics, sound, scripting, etc) is streamed out simultaneously. The landscape isn't quite tiled but is in 'chunks' defined often by material or whatever so it should be fairly similar to your situation. I don't bother recentering the broadphase or anything. I suspect Bullet could handle more than this volume too. There are also a range of broadphase algorithms that Bullet can be configured to use, so you have some flexibility. You might like to use the dbvt broadphase.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Using Bullet in an extremely large world.

Post by sparkprime »

Setting up different worlds and transfering objects at the boundaries is probably not worth the effort. I suspect even a really well-thought-out implementation would not have much better performance and objects would not interact properly at the boundaries.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Using Bullet in an extremely large world.

Post by Erwin Coumans »

For huge worlds, it is best to use the btDbvtBroadphase, it doesn't require world bounds (min/max), and it handles changes very well (streaming in and out hundreds of objects at a time).

If you have performance problems, please provide a performance dump right after your 'stepSimulation' call, using CProfileManager::dumpAll();
Then we can discuss how to optimize your specific case.

Hope this helps,
Erwin
NdotL
Posts: 2
Joined: Fri Jan 23, 2009 6:15 pm

Re: Using Bullet in an extremely large world.

Post by NdotL »

Thanks so much for all the input. I'm so sorry I overlooked the dynamic AABB tree in the documentation, I should have seen that. I'll be implementing this shortly and will let you know if I encounter anything although it seems to be 100% exactly what I need.

Thanks again
pcg
Posts: 4
Joined: Wed Jun 10, 2009 2:42 pm

Re: Using Bullet in an extremely large world.

Post by pcg »

sparkprime wrote:I have a (6000,6000,6000) cube as my world and it seems to work fine. I stream Bullet rigid bodies in and out to keep the broadphase sane. My streaming is based around the game objects, so a whole game object (graphics, physics, sound, scripting, etc) is streamed out simultaneously. The landscape isn't quite tiled but is in 'chunks' defined often by material or whatever so it should be fairly similar to your situation. I don't bother recentering the broadphase or anything. I suspect Bullet could handle more than this volume too. There are also a range of broadphase algorithms that Bullet can be configured to use, so you have some flexibility. You might like to use the dbvt broadphase.
Hi sparkprime,

I'm interested in streaming in paged terrain as my terrain can be quite large but I'm not sure how and where to start in Bullet, possible to give me an idea how it is handled in Bullet?

Thanks,
CG
pcg
Posts: 4
Joined: Wed Jun 10, 2009 2:42 pm

Re: Using Bullet in an extremely large world.

Post by pcg »

pcg wrote:
sparkprime wrote:I have a (6000,6000,6000) cube as my world and it seems to work fine. I stream Bullet rigid bodies in and out to keep the broadphase sane. My streaming is based around the game objects, so a whole game object (graphics, physics, sound, scripting, etc) is streamed out simultaneously. The landscape isn't quite tiled but is in 'chunks' defined often by material or whatever so it should be fairly similar to your situation. I don't bother recentering the broadphase or anything. I suspect Bullet could handle more than this volume too. There are also a range of broadphase algorithms that Bullet can be configured to use, so you have some flexibility. You might like to use the dbvt broadphase.
Hi sparkprime,

I'm interested in streaming in paged terrain as my terrain can be quite large but I'm not sure how and where to start in Bullet, possible to give me an idea how it is handled in Bullet?

Thanks,
CG
Hi all,

Possible to shed some light?

Thanks,
CG
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Using Bullet in an extremely large world.

Post by sparkprime »

You can dynamically create and remove rigid bodies, and create/destroy collision shapes so it's easy.
cobolt_dink
Posts: 72
Joined: Fri Apr 04, 2008 6:07 pm

Re: Using Bullet in an extremely large world.

Post by cobolt_dink »

sparkprime wrote:You can dynamically create and remove rigid bodies, and create/destroy collision shapes so it's easy.
How do you page in your terrain collisions? Assuming you don't load in a big 6000, 6000, 6000 tri mesh at the start of the level. I'd assume you would serialize collisions based on your terrain chunks and then load in pieces of collision as the terrain comes in too. Would think you would need a thread just to stream in geom and collision data.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Using Bullet in an extremely large world.

Post by sparkprime »

each chunk of land has a graphics mesh and a collision mesh, often they are actually the same geometry due to laziness but they come from different files so in principle could be completely different.

and yes, a background thread does the IO ahead of time so that the actual creation of the relevant datatypes and insertion into the world is fast
alek314
Posts: 2
Joined: Sat Mar 13, 2010 1:55 am

Re: Using Bullet in an extremely large world.

Post by alek314 »

:lol: digging up the old thread!
as for "divide the world into chunk", does it mean divide the heightfield into chunk? or divide a terrain mesh into chunk?
how to avoid crack between chunks?
starkman
Posts: 7
Joined: Wed May 16, 2012 5:09 am

Re: Using Bullet in an extremely large world.

Post by starkman »

how we can make the chunks for large terrain ? and how to move between chunks ?
User avatar
Typhontaur
Posts: 135
Joined: Fri Nov 04, 2005 2:22 pm

Re: Using Bullet in an extremely large world.

Post by Typhontaur »