11 FPS with 100 cubes

Post Reply
kolarz3
Posts: 3
Joined: Fri May 17, 2013 8:53 pm

11 FPS with 100 cubes

Post by kolarz3 »

In first I rand 100 position(from 0.0 to 100.0) and rotation, next i give this data to bullet engine. This is my physics loop:

Code: Select all

dynamicsWorld->stepSimulation(1/60.f/10,1);
			boxs[number]->getMotionState()->getWorldTransform(trans);
			axis=XMVectorSet(trans.getRotation().getX(),trans.getRotation().getY(),trans.getRotation().getZ(),0.0f);
			return  XMMatrixRotationAxis(axis , trans.getRotation().getAngle())*XMMatrixTranslation(  trans.getOrigin().getX(),  trans.getOrigin().getY(),  trans.getOrigin().getZ() );
I use default shape of box. I dont known why i have only 11 FPS??
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: 11 FPS with 100 cubes

Post by Mako_energy02 »

It's in your call to StepSimulation. In short you are telling Bullet to actually move forward no less than 1 second each time you step(which is a ton of calculations) and then saying only one 600th has elapsed. This doesn't really work, at all.

Try changing your call to StepSimulation to something more like:
dynamicsWorld->stepSimulation(1/60.f,10);

That should leave the last parameter as default, which should be fine unless you are using very small units for distance in your world. Also this wiki page may be of help.
kolarz3
Posts: 3
Joined: Fri May 17, 2013 8:53 pm

Re: 11 FPS with 100 cubes

Post by kolarz3 »

Change of step simulation nothing do. This is clip from my program :
http://www.youtube.com/watch?v=e1JQMM1k ... e=youtu.be
marios
Posts: 52
Joined: Mon Jul 19, 2010 3:11 am
Contact:

Re: 11 FPS with 100 cubes

Post by marios »

Are you compiling your project on Release or Debug mode? Release is much faster
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: 11 FPS with 100 cubes

Post by Basroil »

Are you sure the issue is with bullet and not your graphics engine? You'll need to turn on a profiler to see what's taking up your cycles.

Even with 600 simulations a second at 10 iterations for a hundred objects, any cpu better than an old E8400 should be able to do above 11fps without really worrying about optimizations (assuming release version with box on box with practically no collisions as seen in your video). It's doubtful that your graphics runs higher than 60fps though, so you would be simulating 1/10th of a physics frame per graphics frame, resulting in every second of graphics simulating 1/10th of a second.

A bigger question is what you are trying to accomplish with your program. If you are trying to simulate at 600fps, the code should actually be closer to

Code: Select all

dynamicsWorld->stepSimulation(graphicDelta,20, 1/600.f);
where the graphicDelta represents the time spent between graphics frames. If you are trying to simulate something at regular speeds with a slow graphics program, you could try

Code: Select all

dynamicsWorld->stepSimulation(graphicDelta,10);
You should read http://bulletphysics.org/mediawiki-1.5. ... _the_World to check what type of settings are good for the program you are trying to make.
kolarz3
Posts: 3
Joined: Fri May 17, 2013 8:53 pm

Re: 11 FPS with 100 cubes

Post by kolarz3 »

Problem was debug version. Release is much faster. Now I have 80FPS when all objects fall down.
Post Reply