0

I'm a fairly extreme newbie to the world of graphics programming, so forgive me if this question has an obvious answer, but I haven't managed to track it down.

When the depth test is being performed in DirectX 11, how do you identify which triangles are being tested at any given time? I'm trying to manually tell the depth test to fail unless specific polygons are being viewed through specific polygons (i.e., you can see one set of geometry through only one surface, and another set only through another surface).

I guess the real question is, when a pixel is being tested, how does the system reference the data for that pixel (position, color, etc.)? Is there just something I'm completely overlooking?

For the time being, I'm not interested in alternate solutions to the greater problem, just an answer to this particular question. Thanks for any help!

  • 1
    I am not sure if I am understanding this correctly. There are no triangles in depth test, it works at pixel level. Before going to pixel shader, it checks if current pixel is in front of the written pixel. In this case it discards pixel before pixel shader. –  Feb 09 '14 at 00:48
  • 1
    taytay is right. You cannot use the depth test to mask certain regions on the screen (at least you should not). That's what the stencil buffer is for. Like the depth test, the stencil test is executed before the pixel shader and lets you decide whether or not to discard a pixel based on a stencil. So render your mask geometry to the stencil buffer, change stencil state and render the geometry to be viewed at those pixels that are marked in the stencil buffer. – Nico Schertler Feb 10 '14 at 14:16

0 Answers0