[SOLVED] Multithreaded physics accuracy question

fredrick
Posts: 2
Joined: Thu Jan 17, 2013 1:03 pm

[SOLVED] Multithreaded physics accuracy question

Post by fredrick »

This was my first implementation of physics into my rendering engine, i'd fully utilized all available CPU cores, in particular for bullet.

So getting straight to my point, i did expect some lower, or the possibility of lower accuracy of multi-simulated physics. But just to cover my implementation/experience here, i can be certain that i haven't missed something.

There is only one difference i can see compared to the "sequential" implementation, and that is that each object are quite more bouncier.

Just to illustrate the subjective experience rather than the mathematical experience i added 2 screenshots. The non multi-threaded version broke and fell apart, rather than explode upwards.

Both simulations , started by having the cluster of "boxes" , 50 units (positive Y axis), mass set to 1, gravity around -10. Both simulation behaved the same, even when they hit the ground, but multi threaded had this bounce effect so it threw the boxes perhaps 25 points on the Y axis up in the air again.

just a few snippets of my bullet code, but its pretty much same as the sample (except quite a few more objects)

Code: Select all

m_btRigidBody->setContactProcessingThreshold(btScalar(BT_LARGE_FLOAT));

Code: Select all

	bool isDynamic = (m_mass != 0.f);

	btVector3 localInertia(0,0,0);
	if (isDynamic)
		m_btBoxShape->calculateLocalInertia(m_mass, localInertia);
bt32BitAxisSweep3 to make it precise

Code: Select all

m_btBroadphaseInterface = new bt32BitAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);

Could be that this is "normal" for this engine, then i can tweak per object values (friction, mass etc), just thought it was a bit odd.
Last edited by fredrick on Sun Jan 20, 2013 11:22 pm, edited 1 time in total.
fredrick
Posts: 2
Joined: Thu Jan 17, 2013 1:03 pm

Re: Multithreaded physics accuracy question

Post by fredrick »

For those curious. Solved by increasing the m_numIterations in the getSolverInfo()