Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Sep 07, 2017 11:34 am 
Offline

Joined: Wed Mar 16, 2016 10:11 am
Posts: 59
It is surprising that just scale every thing make so much difference in performance. :shock:

First Experiment
I created a scene with 1,000 cubes.
Cube's size = 0.01f
They scattered around a plane size = 5*5 (w*h)
I got 20fps.
The profile result states that Bullet Physics is the bottleneck.

Second Experiment
1,000 cubes
size = 1.0f
They scattered around a plane size = 500*500
I got >> 60fps.

The cause (my guess)
It must be Bullet's boardphase aabb culling.
In the first experiment, many cubes probably fall into the same slot of boardphase's grid.

Question
Are there any way to guide Bullet's boardphase about my world scale?

I have read :-
boardphase : http://www.bulletphysics.org/mediawiki- ... Broadphase
btDbvtBroadphase : http://www.bulletphysics.org/mediawiki- ... _aabb_tree
scale the world (unrelated) : http://www.bulletphysics.org/mediawiki- ... _The_World

Edit: No one answer.
I doubt that I didn't do research enough / my question is unclear, too easy, not interesting /
or no one know the answer? :(

Edit2: I am very satisfied with drleviathan's answer, so I marked it as solved for now. Thank!


Last edited by hyyou on Sat Sep 16, 2017 2:03 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Sep 15, 2017 9:37 pm 
Offline
User avatar

Joined: Tue Sep 30, 2014 6:03 pm
Posts: 363
Location: San Francisco
My guess is that the "collision margin" feature on the shapes expands their bounding box. If you aren't setting the collision margin manually then you're using the default margin (which is 0.04m!). Meanwhile, it appears that the broadphase data structure also has a hard coded default margin (look for DBVT_BP_MARGIN in the codebase -- I assume you're using the btDbvtBroadphase class) which is 0.05m. In short, the aabb of each object is larger than you think, and in the tiny-case it is relatively much larger than the large-case. More overlaps means more narrowphase evaluations means more CPU costs.


Top
 Profile  
 
PostPosted: Sat Sep 16, 2017 2:01 am 
Offline

Joined: Wed Mar 16, 2016 10:11 am
Posts: 59
Thank drleviathan. This is a very reasonable guess.


Top
 Profile  
 
PostPosted: Mon Sep 18, 2017 8:30 pm 
Offline

Joined: Fri May 06, 2016 9:18 pm
Posts: 2
IIRC, there is also a contact processing threshold that further expands the bounding boxes by a small amount


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group