Direct read-write access to depth buffer

Started by
2 comments, last by Tom 20 years, 9 months ago
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.

GDNet+. It's only $5 a month. You know you want it.

Advertisement
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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Thanks. What flag do I look for to see if the device supports that procedure?

GDNet+. It's only $5 a month. You know you want it.

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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

This topic is closed to new replies.

Advertisement