D3D11 how to simulate multiple depth channels

Posted by Nock on Game Development See other posts from Game Development or by Nock
Published on 2012-06-11T14:19:40Z Indexed on 2012/06/11 16:49 UTC
Read the original article Hit count: 304

Filed under:
|
|
|
|

Here's what I'd like to achieve:

  1. Rendering a first pass of objects in my scene, using standard depth comparison
  2. Rendering another pass of objects in the same scene, but with the following rules:
    • A Pixel of the 2nd pass always override the first pass (no depth compare between them)
    • Use Depth comparison between pixels written from the second pass.

In English I want depth comparison made inside each pass but I always want the second pass pixels to override the first pass ones.

Some things I've thought:

  • I tried to think about using stencil to solve this, but I couldn't find a way.
  • I know I could render into a separate target the second pass then composite the result into the first, but I'd like to avoid that.
  • I could use two separate Depth Buffer, one dedicated to each pass. (I never tried, but I figure it's possible to switch the depth buffer in a Render Target "on the fly")

Any idea of the best solution?

Thanks

© Game Development or respective owner

Related posts about 3d

Related posts about directx