Skip to main content
gamedev.net
🔒 Locked

Translucency

Started by Dave_UK Dec 1, 2001 at 10:49 AM 2 replies 350+ views
Original Post
Dave_UK
Dave_UK
Hey yall, I got this problem, I''ve just started openg gl and C++ so its probably one of those annoying newb questions... I''ve made this wall from two triangles, and I want it to be translucent, when I enable the GL_BLEND it is only translucent from the back of it, and when I disable GL_DEPTH_TEST all the walls infront of it are translucent as well. any answers? cheers, Dave
miles vignol
miles vignol
So only translucent from the back I take it means that you look at it from a different camera angle at it works correctly, yes? And so, different objects are seen thru the wall than the ones from the front?

If so, I''m guessing that the objects seen thru the wall are drawn BEFORE the wall and the ones that don''t show up are drawn AFTER the wall. This would be because the wall is drawing to the zbuffer and causing all subsequent depth checks to fail (for pixels behind it), resulting in an opaque look regardless of what the alpha settings are and if blending is enabled. You can turn off your depth writes (glDepthMask(GL_FALSE) I think) when you draw your translucent wall to keep it from drawing to the zbuffer.
Bong
Bong
When you draw translucent objects in OpenGL, you MUST draw them in order of farthest to closest. Otherwise, weird things happen.


- Bong, James Bong
Bong, James Bong
Dave_UK
Dave_UK
Ok, thanx guys
It seems to work fine when I draw the translucent objects last

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.