Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Feb 01, 2012 3:42 pm 
Offline

Joined: Thu Nov 26, 2009 6:32 pm
Posts: 76
I made a simple soft body simulation with 3 soft spheres and tried stepping the physics at a high rate.
When the soft bodies are rendered with flat face normals,everything looks fine but when I render them with vertex normals, I see some weird artifacts in the rendering.

Here is my render function..

Code:
void 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_normal); // face normal
      glNormal3fv(sBody->m_faces[i].m_n[0]->m_n);
      glVertex3fv(sBody->m_faces[i].m_n[0]->m_q);
      glNormal3fv(sBody->m_faces[i].m_n[1]->m_n);
      glVertex3fv(sBody->m_faces[i].m_n[1]->m_q);
      glNormal3fv(sBody->m_faces[i].m_n[2]->m_n);
      glVertex3fv(sBody->m_faces[i].m_n[2]->m_q);
   }
   glEnd();
   glPopMatrix();
}


Can anyone please tell me what is going on ? This has been very frustrating since softbody works great but I am not able to render them properly.

Please see attached video for clarification.


Thanks
W


Attachments:
20120201_1025_03.zip [856.26 KiB]
Downloaded 61 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 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