DisplayRegion that doesn't alter depth buffer?

I have a nice reflection effect where the reflection of lights on the ceiling show on the floor. I do this with a little trick in the DisplayRegions.

DirectStart sets up the display regions in the main window as such:

  1. unused
  2. render
  3. render2d
  4. render2dp

And what I did was added my own scene tree, camera, and DisplayRegion to show it:

  1. unused
  2. render
  3. reflection
  4. render2d
  5. render2dp

The only catch is: I made the reflection DisplayRegion clear the depth buffer, and gave its camera a blur shader.

This works perfectly, IF you don’t walk off of the reflective surface. Because the depth buffer is totally CLEARED, the reflections will appear on top of any surface, not just where there’s a reflective surface.

Now, here’s my possible solution:

If I add another DisplayRegion in between the reflection and render ones, dedicated just to the reflective floors, and I somehow stop the “reflective” DisplayRegion from changing the depth buffer (but still depth testing to see where the floor is allowed to draw), then the desired effect will occur.

Anybody know how I’d make a DisplayRegion not change the depth buffer, still depth test, and still change the color buffer?

In general, you can do:
to turn off the writing of the depth buffer for a particular node and all of its descendents. Thus, you can do this to the root node of your reflection graph to turn it off for all nodes in that graph.


Very nice. Works perfectly!