Archived

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

Tom

Direct read-write access to depth buffer

Recommended Posts

I would like to do some post-processing in my 3D scenes, but in order to do so I need access to the depth buffer. I can do the processing with read access alone, but if there's a way to get read-write access, I can do a lot more. I couldn't find anything in the documentation about this. If you know of a way to access the depth buffer, please let me know. Thanks. By the way, I'm using DirectX 8 for Visual Basic.

Share this post


Link to post
Share on other sites
If you create the depth buffer with a lockable format such as D3DFMT_D16_LOCKABLE then you can use Lock() on the surface just as you would any other surface. You can use IDirect3DDevice*::GetDepthStencilSurface() to get the surface object to lock.

Beware that not all hardware/drivers actually support lockable depth buffers or read access of any form.

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

Share this post


Link to post
Share on other sites
quote:
Original post by Tom
Thanks. What flag do I look for to see if the device supports that procedure?


Use IDirect3D9::CheckDeviceFormat to determine whether the format is available and can be used with the device.

Use IDirect3D9::CheckDepthStencilMatch to determine whether that format will work with the current backbuffer/framebuffer formats.

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

Share this post


Link to post
Share on other sites