Sign in to follow this  
RavNaz

getting depth buffer info?

Recommended Posts

You usually want to avoid retrieving or generally messing with the contents of the depth buffer for various performance reasons.

This is backed up by the fact that, to perform a regular IDirect3DSurface9::Lock() operation you have to create the depth buffer with a "lockable" format (e.g. D3DFMT_D16_LOCKABLE) - and I've come across a fair few bits of hardware that DONT allow this format [headshake]

You can use various pixel shader tricks to effectively copy the depth buffer (or just simultaneously write the depth information) to a texture and then use that as appropriate.

hth
Jack

Share this post


Link to post
Share on other sites
mmmm...ok....dont want to write directly to the depth buffer...just want the info in a seperate surface to read from.....can this not be done without shaders?

many thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by RavNaz
just want the info in a seperate surface to read from.....can this not be done without shaders?

I'm not using my development machine at the moment, so I can't check the details - but you can definitely retrieve the depth stencil surface (as a IDirect3DSurface9), so you might (if you're lucky) be able to StretchRect to another (lockable) surface. Without my docs to hand I can't easily check whether the formats/pools match up [oh]

Although, the simplest method I've seen is that used a lot in shadow mapping algorithms - writing the depth to a texture during the initial rendering phase(s). But, as mentioned, you need to be using a shader-based pipeline for this to be useful...

hth
Jack

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