Why SV_ClipDistance[n] cost so much performance?

Started by
1 comment, last by xlope01 10 years, 9 months ago

I want to Clip some geometry from some objects but the performance hit is huge.

for example a model with around 1000 triangles will now cost around 2.5 times more time to render. That is not really a problem if i want to apply the SV_ClipDistance in a small number of models, but if I want to do it in many models or models that have many triangles then the over all performance will get significant worst.(let say I do this SV_ClipDistance in everything that is on the screen then the fps will pretty much drop 2.5 times)

Advertisement

I've never used it, however I have some ideas:

- In your tests how many clip planes are you using? How are you measuring performance? What graphics card are you testing on? Does your test use a realistic pixel shader?

- Instead of looking at the relative cost, it's generally more useful to look at the absolute cost. For example "clipping 1,000,000 polys takes an extra 1ms" or whatever the actual numbers are. That's because going from say 0.01ms to 0.025ms while a big factor slower will probably be an insignificant proportion of the total frame time.

- It's simple to implement clip planes in the pixel shader, and it doesn't take many instructions. If you're vertex bound and not pixel bound it might be quicker that way. The code is something like:

if (dot(plane, position) < 0) discard;

- Where possible, it should be cheaper to adjust the standard near and far clip planes, instead of adding new clip planes.

-I want to clip the height of the models so the SV_POSITION in pixel shader is only going to clip the near and far.

-I measuring performance by the time it take to render my reflection texture, with the SV_ClipDistance(clip the height of the models) to get the correct water reflection from the models. (so i use one clip plane that represent the water level)

-GPU i currently use is a HD7950.

-pixel shader(that I use for my water reflection texture) is under realistic load (shadows, lighting, specular, fog, reflection, etc)

This topic is closed to new replies.

Advertisement