   Strange Blending Artefact
  I am using alpha blending to make a surface appear transparent. However, I'm noticing a strange artefact. There are light and dark bands in the drawn surface that are aligned with the principle axes of the coordinate system. I have linked to an image that shows this:http://www.personal.psu.edu/sam458/www/SampIm/RendererProblem.bmpOn the left, the surface is darker than on the right, with alternating transition bands in the middle. When I disable blending, this problem does not appear.I am using a nondirectional light source at the camera location. Here is the smallest set of code that produces this problem: ::glClearColor(0.0f,0.0f,0.0f,0.0f);::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);::glEnable(GL_BLEND); //Enable Blending::glBlendEquation(GL_FUNC_ADD);::glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);::glColor4f(0.70f,0.70f,0.70f,0.5f); //Alpha = 0.5 RenderSurface(); //Renders the surface triangle set using VBOsThanks for any help,-cobalt60[Edited by - cobalt60c on June 1, 2006 3:15:28 PM]
  By observing the image you've linked, i think it may be because you didn't do the depth sorting before you render the transparent surface. Since OpenGL realizes the transparency effect by blending the currently drawing pixels with the pixels already been drawn in the framebuffer, depth sorting the triangles and drawing them from far to near are essential to render a transparent surface. You can refer the red book to get more informations.I hope it is useful to you.   ;  Consider now that my transparent surface has >300,000 polygons and is stored in a VBO on the video card. Depth-sorting the triangles is really going to hamper performance. To generate the above image, I had GL_DEPTH_TEST disabled, expecting that all polygons be drawn because the geometry is a tubular tree and when transparent, I want to see the backs of these polygons as well. Shouldn't this now  blend all polygons regardless of their depth?-cobalt60c   ;  The banding in the middle looks very much like z-fighting. Try using a 32bit zbuffer (if you're not already) and push your near plane outwards to get more precision.However you'll still probably get (different) artifacts with blending. I can't quite make out what you're trying to do, but regular blending (as you're code does) requires depth sorting. A cheap trick that might work is rendering the tube twice - once with the front faces culled (so the back ones are drawn) and then again with the back faces culled. This isn't always going to be accurate but it's usually good enough.If that isn't good enough then you might need a rough back-to-front sort - split your model into a few good sized chunks then sort those. This way you can still have nice big batches and keep all the geometry on the graphics card.   ;  Thanks for your solution OrangyTang,I realize now that my problem is indeed from not depth sorting the triangles  and that just turning off depth testing was a silly and worthless thing to do. Depth sorting is not an option for me as rendering speed is critical and I occasionally have up to 1 Million triangles in a VBO on the video card. I am now rendering the surface twice (first culling the outside faces, then culling the inside faces) and this produces acceptable results nearly everywhere. There are still some slightly  perceptible artefacts where the surface is more intertwined, but I find these acceptable.  Thanks again.-cobalt60c