Jump to content
  • Advertisement
Sign in to follow this  
Code-R

Reading the Z-buffer value in a post process pass?

This topic is 4483 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how can I read the z-buffer value form a post process path? is there somehow to access the current z-buffer value or will I have to add a new path where I render Z to a floating point texture?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Code-R
how can I read the z-buffer value form a post process path? is there somehow to access the current z-buffer value or will I have to add a new path where I render Z to a floating point texture?
You can use glReadPixels with format set to GL_DEPTH_COMPONENT to access the current depth buffer values. It may not be the fastest operation though. I would suggest rendering depth to a texture, making use of multiple render targets if they are available to you.

Share this post


Link to post
Share on other sites
Using the EXT_FRAMEBUFFER_OBJECTS extension is probably the best way to do this... and it should be supported on all recent graphics cards.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!