Jump to content
  • Advertisement

Archived

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

Tom

Direct read-write access to depth buffer

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

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

Share this post


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

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!