Softbody vnormals artifact when stepped at high rates!!!

winspear
Posts: 77
Joined: Thu Nov 26, 2009 6:32 pm

Softbody vnormals artifact when stepped at high rates!!!

Post by winspear »

Hi,
I am able to render a softbody mesh and do collision detection without any problems.
But recently I moved the physics to a separate new thread and step it at very high rate when compared to the graphics.
All physics forces and movement , rogid bodies seems ok to me but the vertex normals of soft bodies are not rendered properly. It looks like the artifact is because of physics been stepped at a very high rate (1000 Hz) when compared to the graphics loop which is stepped at 33Hz because when I step the physics at the same rate as the graphics, the vertex normals are rendered properly but the simulation is really slow.

I draw the soft body in the graphics loop as follows.

Code: Select all

void ViewManager::renderSoftbodyMeshes(btSoftBody* sBody)
{
	btTransform meshTransform = sBody->getWorldTransform();

	GLfloat tempForm[16];
	meshTransform.getOpenGLMatrix(tempForm);
	
	glPushMatrix();
	glMultMatrixf(tempForm);
	glBegin(GL_TRIANGLES);
	int numFaces = sBody->m_faces.size();
	for (int i=0; i< numFaces; i++)
	{
		glNormal3fv(sBody->m_faces[i].m_n[0]->m_n);
		glVertex3fv(sBody->m_faces[i].m_n[0]->m_x);
		glNormal3fv(sBody->m_faces[i].m_n[1]->m_n);
		glVertex3fv(sBody->m_faces[i].m_n[1]->m_x);
		glNormal3fv(sBody->m_faces[i].m_n[2]->m_n);
		glVertex3fv(sBody->m_faces[i].m_n[2]->m_x);
	}
	glEnd();
	glPopMatrix(); 
}
Any help to render the soft bodies properly with vertex normals in the above situation will help.
Pls see attached video for demo of the problem.

Thanks
V
You do not have the required permissions to view the files attached to this post.
winspear
Posts: 77
Joined: Thu Nov 26, 2009 6:32 pm

Re: Softbody vnormals artifact when stepped at high rates!!!

Post by winspear »

Any ideas ? Recomputing the normals in the physics thread also does not solve the problem.
SolidRegardless
Posts: 1
Joined: Wed Jul 11, 2012 8:40 am

Re: Softbody vnormals artifact when stepped at high rates!!!

Post by SolidRegardless »

@winspear: Did you ever find a good solution to speeding up your soft body rendering using a separate physics thread? I assume the initial problems you were encountering were because the normals were being updated at the same time that you were drawing them, so you would have needed to add some kind of locking on the physics thread anyway.

I am trying to research a good soft body approach for a game I am planning that allows me to flick around several small goo-like soft bodies using touch. So far I have eliminated Box2D from my research because it really doesn't handle collisions well at high speed using the spring method. Bullet is much better and much more realistic. Combining Irlicht and irrBullet is a very nice combo for this.

However, the realism seems to come at a price, and that is speed! So if anyone else is reading this, could you please suggest any optimisation tips or code snippets to assist in speeding up soft body simulation? The alternative is to use pre-rendered animations, but I don't like that idea because I like the real-feel of physics simulation.