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

Transparency Problems

This topic is 5174 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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:
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    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  
	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);
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