Jitter with shapes versus triangle mesh

Post Reply
dans
Posts: 8
Joined: Tue Sep 18, 2007 6:56 am

Jitter with shapes versus triangle mesh

Post by dans »

Hi there, I am looking at implementing Bullet as a replacement for another physics engine we currently use in our game engine. You will probably hear more from me on the SCE forums if we decide to go ahead with it. So I have set up a simple physics scene where I have used a static triangle mesh as world geometry it is placed as two triangles on the plane 0,1,0,0. I have placed a group of box shaped rigid bodies and a sphere shape rigid body onto that triangle mesh. I apply a small impulse to the sphere and watch it roll across the mesh which it does fine except for a strange jerk appearing through the objects y axis. This happens to all the rigid bodies, the group of boxes while not sleeping and the moving sphere. It is almost as though they are being pushed into the triangle mesh via the force of gravity and then pushed back out with a resolution impulse. Once the objects stop moving/sleep the jerk across y stops. I have attached a divx avi showing the jitter/jerk. Have you any clues to why this would be occurring or how I can remove this. Cheers.

<edit> I should mention that am using bullet 2.61 with a fixed time step 1.f/60.f
Attachments
jitter.rar
(185.88 KiB) Downloaded 298 times
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Jitter with shapes versus triangle mesh

Post by Erwin Coumans »

Would it be possible to create a reproduction case in one of the Bullet 2.62 demos?

If so, please attached the zipped .cpp file of the demo in the topic, with a description about the problem.
Thanks a lot,
Erwin
dans
Posts: 8
Joined: Tue Sep 18, 2007 6:56 am

Re: Jitter with shapes versus triangle mesh

Post by dans »

Hi Erwin, I have attached the source for basic demo, if you view the spheres y position as it moves across the triangle mesh you will notice the y component often fluctuates below the expected y value (terrain.y + radius) but never over the expected value. I hacked some changes into DemoApplication.cpp|.h so as to display some debug information. Thanks.
Attachments
basicdemo.zip
(11.82 KiB) Downloaded 278 times
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Jitter with shapes versus triangle mesh

Post by Erwin Coumans »

Hi,

I briefly skimmed through the demo.
The penetration is probably because the recent added special case 'sphere-triangle' doesn't take the margin into account properly. I need to look into this deeper, but for now can you help testing the following?

You can disable the special sphere-triangle collider, and use the default generic convex-convex GJK version, just comment out those lines in
src\BulletCollision\CollisionDispatch\btDefaultCollisionConfiguration.cpp around line 125:

Code: Select all

/*
	if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE ) && (proxyType1==TRIANGLE_SHAPE_PROXYTYPE))
	{
		return	m_sphereTriangleCF;
	}

	if ((proxyType0 == TRIANGLE_SHAPE_PROXYTYPE  ) && (proxyType1==SPHERE_SHAPE_PROXYTYPE))
	{
		return	m_triangleSphereCF;
	}
*/
Not sure about the jitter, difficult to spot in the BasicDemo with this view frustum.
By the way, those triangles are huge, compared to the rigid body sizes. To be on the safe side, it is recommended to keep individual triangle/collision shapes sizes roughly less then 10 units, and above 0.2 units. This lower limit has to do with contact point management.

Can you let me know if that helps?
Thanks,
Erwin
dans
Posts: 8
Joined: Tue Sep 18, 2007 6:56 am

Re: Jitter with shapes versus triangle mesh

Post by dans »

Thanks gave it a try with 2.62 and it made no difference to the jitter on world y axis. I made sure to decrease the size of the faces as you mentioned as well. I will live with it for now if its going to be investigated. Most obvious when the camera is moved in close and traces the path of the moving body.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Jitter with shapes versus triangle mesh

Post by Erwin Coumans »

You mentioned 2 different problems:

1) shallow penetration for sphere versus trianglemesh
2) some jitter

Let's first deal with (1), and tackle (2) once 1 is sorted.

So is the penetration problem resolved when you apply the change in btDefaultCollisionConfiguration, as I mentioned before?
Thanks,
Erwin
dans
Posts: 8
Joined: Tue Sep 18, 2007 6:56 am

Re: Jitter with shapes versus triangle mesh

Post by dans »

Hi Ewan, (1) Shallow penetration is not resolved with the above changes to btDefaultCollisionConfiguration the behaviour did not appear to change at all. I there something else I can try or you would like me to do?
Post Reply