Archived

This topic is now archived and is closed to further replies.

Shadow_Of_Spawn

Transparency Problems

Recommended Posts

I'm currently working as a trainee for an orthopaedic research lab. My job is to write a program to visualize bones and prosthesises (sp?) using OpenGL. My current problem is to render a transparent bone with an opaque prosthesis in it. Not so hard in itself, but I encountered two issues which have me puzzled. I would really appreciate some help. #1 I can render a transparent bone, but when something in the foreground overlaps something in the background (same object), the overlapping part is rendered completely white like it adds the colors of the overlapping parts. This looks very ugly. #2 I have a model of a knee joint (the entire model is one object). One side of it is transparent, but when I rotate it the other side is not. The knee-cap and the femur are transparent, but the tibia is opaque. Why does this happen and how do I fix it? My current rendering code looks like this:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
  glBegin(GL_TRIANGLES);
    for(int j = 0; j < pDoc->m_Object.numOfFaces; j++)
    {
      for(int whichVertex = 0; whichVertex < 3; whichVertex++)
      {
	int vertIndex = pDoc->m_Object.pFaces[j].vertIndex  
                             [whichVertex];
	glNormal3f(pDoc->m_Object.pNormals[ vertIndex ].x,
		   pDoc->m_Object.pNormals[ vertIndex ].y,
		   pDoc->m_Object.pNormals[ vertIndex ].z);
				
        glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

	glVertex3f(pDoc->m_Object.pVerts[ vertIndex ].x,
		   pDoc->m_Object.pVerts[ vertIndex ].y,
		   pDoc->m_Object.pVerts[ vertIndex ].z);
	}
    }  
  glEnd();
glDisable(GL_BLEND);
SoS [edited by - Shadow_Of_Spawn on October 15, 2003 8:05:20 AM]

Share this post


Link to post
Share on other sites
Google for "Depth Peeling". It may be just what the doctor ordered.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites