Archived

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

Reading the depth buffer for a given x, y?

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