Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rahaydenuk

Reading the depth buffer for a given x, y?

This topic is 6042 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

Is there a way in DirectX 8.1 to read the value in the depth buffer for given x, y pixel co-ordinates? I know in OpenGL, there is a function ''Unproject()'' or similar, which would achieve the desired results, but I need this for DirectX 8.1. Thanks & HNY, Richard Hayden.

Share this post


Link to post
Share on other sites
Advertisement
You *really* don''t want to read the contents of the depth buffer, for both performance and compatibility reasons. If at all possible, avoid direct depth buffer and frame buffer access. If this is for lens flare occlusion, do a ray cast.

"Unproject" sounds very much like it simply applies the reverse of projection and modelview matrices rather than reading the depth buffer. Funily enough the D3DX library contains a function called "D3DXVec3Unproject" which I''d guess is exactly the same thing.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!