Jump to content
  • Advertisement
Sign in to follow this  
RavNaz

getting depth buffer info?

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

Advertisement
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
Sign in to follow this  

  • 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!