I only want to discard the depth component, not the color

I have a wall texture with a window in it. I would like to discard the depth component of the pixels of the texture that are below 0.5. Is this possible?

The purpose of this is to allow coronas to shine through windows.

You can’t discard a depth component. If you want it to always fail, then set it to a number as close as you dare to the near plane.

I’ll file this under “if only”.

You mean the far plane, don’t you? How can I change the depth value in a frag program?

gl_FragDepth = gl_FragCoord.z + delta ; // delta= 0 by default

So to “dismiss” the depth:

if something
{
gl_FragDepth = 1.0;
}

Right?

Modifying depth so the depth test fails will also kill any color output. It sort of just ends up being a more inefficient alpha-test. I’m afraid there’s no way to do what you want, other than separating the window part from the rest of the texture and draw that with glDepthMask(GL_FALSE);

Ah, I forgot about that.

Oh well, it wasn’t important.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.