XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

depth buffer copy

Last post 11/7/2008 5:28 PM by Graphics Runner. 1 replies.
  • 11/7/2008 4:29 PM

    depth buffer copy

    Is it possible to copy the depth buffer into a bitmap or an array that I can index?
  • 11/7/2008 5:28 PM In reply to

    Re: depth buffer copy

    You can use StretchRect to copy the depth buffer. To get cpu access you'll need to use a D3DFMT_D32F_LOCKABLE or D3DFMT_D16F_LOCKABLE. However, not all cards support these formats. You can also write a shader that outputs depth and render your scene to a render target and use that shader.

    Then you can lock the surface and get the data from the locked rectangle.


Page 1 of 1 (2 items) Previous Next