I currently use depth_clamp for shadow mapping to avoid near plane clipping of shadow casters, and keep the depth range focused on where it is needed most. However, I don’t want stuff clamped to the far plane. If distant geometry were clipped by the far plane and not rasterized at all (as normally) it could save a tiny bit of performance. And I’m sure there are other uses as well.
I agree with the utility of this, especially with shadow mapping for directional lights (parallel projection light frustums) where there’s no Z=0 singularity.
You’d certainly want the “closer to the light” casters to be smashed onto the near clip plane of the shadow map, but smashing the beyond-far caster fragments back into the frustum (against rays of light) is a waste.
Now admittedly, we all should be frustum culling what gets rendered into the shadow map, so we should only be talking about fragments of objects that straddle far-clip that are smashed back onto the far clip (not bunches of objects beyond far clip). But still, a good point for saving shadow map fill.
So if it’s all the same to the vendors, I agree, separate clamps would be desirable.
So, assuming values were not being clamped to the far plane, what value would you like written to the Z buffer for those cases ?
Restated, what’s wrong with just setting a high clamp value, one that results in the maximum possible depth value ? The outcome with and without the far camp would then be the same I think ?
Edit, OK I see, you might want them to just fall outside of the clip volume and be lost ?
Exactly. The operative issue being the potential fill savings. If an engine is only doing course frustum culling (or isn’t culling), or has objects with lots of tris/fill, it could really mount up.
Exactly. The operative issue being the potential fill savings. If an engine is only doing course frustum culling (or isn’t culling), or has objects with lots of tris/fill, it could really mount up. [/QUOTE]
Ditto.
Actually our engine does pretty accurate frustum culling for the shadow pass (anything beyond the far-plane is culled, anything in front of and behind the near-plane is rendered), but I still don’t want the portion of the geometry beyond the far plane rasterized if the hardware can clip it just as easy.