strorph
03-08-2012, 10:36 PM
Hi all,
I've been racking my head over this problem. I'm drawing a volume mesh with a semi-transparency, and I get an odd effect at a certain angle when the volume is rotated: parallel planes are visible within the volume mesh. To add, the semi-transparency isn't entirely consistent at different angles. The attached screen may better describe the issue. Of note, this effect does not show up when there is no transparency (i.e. when the surface is opaque).
http://i.imgur.com/6Byoe.jpg
Here's the relevant source code:
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// draw mesh
glDepthMask(GL_FALSE);
glPushMatrix();
mc->draw();
glPopMatrix();
glDepthMask(GL_TRUE);
glDisable(GL_NORMALIZE);
glDisable(GL_BLEND);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
Thanks for any advice!
s.
I've been racking my head over this problem. I'm drawing a volume mesh with a semi-transparency, and I get an odd effect at a certain angle when the volume is rotated: parallel planes are visible within the volume mesh. To add, the semi-transparency isn't entirely consistent at different angles. The attached screen may better describe the issue. Of note, this effect does not show up when there is no transparency (i.e. when the surface is opaque).
http://i.imgur.com/6Byoe.jpg
Here's the relevant source code:
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// draw mesh
glDepthMask(GL_FALSE);
glPushMatrix();
mc->draw();
glPopMatrix();
glDepthMask(GL_TRUE);
glDisable(GL_NORMALIZE);
glDisable(GL_BLEND);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
Thanks for any advice!
s.