Skip to main content
gamedev.net
🔒 Locked

depth buffer

Started by ogl5 1 reply 1k views
Original Post
ogl5
ogl5
I was wondering if there is an easy way to make OpenGL only write to the depth buffer for non-transparent pixels. For instance, if you draw a quad with a picture of a tree, and parts of the quad are transparent, those parts will still affect the depth buffer even though they're transparent. I don't want the depth buffer affected by transparent pixels.
godmodder
godmodder
Hello,

I believe you are looking for the glDepthMask(GL_FALSE) command. You should use it while rendering the transparent objects and deactivate it while rendering your other geometry. Remember that you have to render your non-transparent geometry first and then your transparent geometry. You also have to sort your transparent geometry if you want them to render entirely correct.

Hope I've been able to help,
Jeroen
Kalidor
Kalidor
Quote:
Original post by ogl5
I was wondering if there is an easy way to make OpenGL only write
to the depth buffer for non-transparent pixels.
Alpha test

Topic Locked

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

Sign in to reply to this topic.