• Advertisement
Sign in to follow this  

SV_ClipDistance

This topic is 2003 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to add clip planes for my water reflection pass. SV_ClipDistance seemed nice in that I do not have to modify my pixel shaders.

My question is, does using SV_ClipDistance mess up early-Z optimizations and such? For example, it is recommended to have separate pixel shaders when you need to use clip().

I'm wondering because I was thinking of having all my vertex shaders output SV_ClipDistance, and if I don't need water plane clipping, I would just set the clip plane to the minimum of my world bounding box so that nothing would be clipped.

Or is it best to have separate vertex shaders (one that outputs a SV_ClipDistance value for reflection pass and one that does not)?

Share this post


Link to post
Share on other sites
Advertisement
The clipping that happens due to SV_ClipDistance happens in the rasterizer before the pixel shader is executed, so it shouldn't affect early-z or pixel shaders at all. This is very different from using clip() or discard, which happens in the pixel shader.

It's possible that if you always output SV_ClipDistance then you might cause the rasterizer to do a little extra work, but that would depend on the specifics hardware so I couldn't say for sure. However I would think that it's unlikely to have any major effect on your overall performance.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement