depth scissors

In order to save fillrate, I thought about moving near and far planes to bound tightly the light volume, while rendering light interactions, to clip the geometry that is not inside the light volume but is still rendered using expensive per pixel computations.

This would be something like the scissor optimization but in the z-axis.

In theory that could be done changing the projection matrix and mapping the new depths with DepthRange. However, different floating point computations yield different depth values, so it doesn’t seem to be possible.

Is the hardware able to do this, but it’s not exposed? or there is no way around this problem?

I heard about the nv_depth_bounds extension. However, it does not test the fragment depth value, but the depth value of the depth buffer.

[This message has been edited by castano (edited 04-02-2003).]

You can do this with glDepthRange() and the appropriate near/far clip planes.

Unfortunately, rasterization is not guaranteed invariant when you do this, so any Z testing you do will probably suffer aliasing/jaggies.

Z-fighting isn’t a problem really, it’s just a matter of using polygon offset. I think the problem is, that if you’re using stencil shadows, the in/out shadow count will break. If you’re lucky enough to use shadow maps, it should be ok though.

-Ilkka