Sign in to follow this  
treeway

Depth Buffer to NDC space

Recommended Posts

Hi im rendering to an FBO using the GL_DEPTH_COMPONENT24 depth format to take the depth buffer values into a texture. I've got the values and they are right but they arent in normalized clip space (i.e. in the range of -1 to +1) so i have no idea where my furthest depth and closest depth are. Previously I obtained the depth in NDC space by using a shader to transform my vertices into clip space through the worldviewProj matrix and then in a pixel shader determined the length of the vector. Does anyone know how to transform the depth from whatever range it is in from GL_DEPTH_COMPONENT24 to a normalized clip space value? thanks

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