Sign in to follow this  
satanir

Depth test

Recommended Posts

Hi, I read in a few articles about Greater-Than depth test (as opposed to the regular less/less-equal test). Can someone please explain in what is the purpose of such test? I know it is used in deferred shading to find the area a light covers, but couldn't understand completely how it works. Are there other usages to greater_than test? Thanks.

Share this post


Link to post
Share on other sites
many years ago it was used so you didnt need glClear( DEPTH_BUFFER );
I forget exactly how
I wouldnt do it now though, its fasts + with early depth out it likes that u clear it every frame

Share this post


Link to post
Share on other sites
The depth buffer, like the stencil buffer, is a tool to perform whatever kind of graphical operation you want. You can even use depth-test magic combined with a stencil mask to do funky screen-space CSG. zedz mentions one trick it can be used for.

Share this post


Link to post
Share on other sites
Quote:
Original post by satanir
I read in a few articles about Greater-Than depth test (as opposed to the regular less/less-equal test).
Can someone please explain in what is the purpose of such test? I know it is used in deferred shading to find the area a light covers, but couldn't understand completely how it works.
In deferred shading, we render the scene geometry into the depth buffer to start with. After that, we render geometry representing the area of effect of each light over the top, and shade based on that.

A greater-than test for the depth buffer culls all pixels for the light geometry which would be *behind* the geometry we rendered earlier.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this