getting depth buffer info?
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
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
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
many thanks
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement