Archived

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

rahaydenuk

Reading the depth buffer for a given x, y?

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
Well.. I don''t really use DX8, only DX7, but I guess you can lock the Z-buffer and get a pointer to it. Once you got that, you just have to read the appropriate value directly from memory. However, be aware that reading FROM video memory is VERY SLOW. If you just read 2-3 pixels per frame it''s ok but don''t hope to read big chunks.

Note : and please do not double post. Thanks.

Share this post


Link to post
Share on other sites
Sorry about the double posting.

I don''t think you can do this in DX 8 (locking the z-buffer and then reading the vals from memory). Even if you could, as you mentioned it is incredibly slow.

Does anyone know of another possible way?

Share this post


Link to post
Share on other sites