View Full Version : I only want to discard the depth component, not the color
10-17-2007, 04:01 PM
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.
10-17-2007, 05:29 PM
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.
10-17-2007, 06:07 PM
I'll file this under "if only".
10-17-2007, 06:41 PM
You mean the far plane, don't you? How can I change the depth value in a frag program?
10-17-2007, 06:48 PM
gl_FragDepth = gl_FragCoord.z + delta ; // delta= 0 by default
10-18-2007, 10:10 AM
So to "dismiss" the depth:
gl_FragDepth = 1.0;
10-18-2007, 11:39 AM
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);
10-18-2007, 11:56 AM
Ah, I forgot about that.
Oh well, it wasn't important.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.