Blending, alpha testing, clipping performance question...

I’m rendering some quite large polygon who are for the most part transparent (alpha=0), say 50-80% of their area. (And one polygon covers around 10 % of the screen)

What are the general guidelines for getting good performance? (This is on GeForce-class cards). I have three options:

  1. Clip the polygons to save fillrate.
  2. Use AlphaTest to save bandwidth.
  3. Leave it as it is, as above options slow things down too much.

I haven’t done any benchmarks yet, but I figured some of you guys probably know about this.

I’m mostly curious on whether enabling alpha test in this case is good conduct or not.

If I were you, I would try these things in this order:

  1. Try not to use such a big polygon if it is going to be mostly transparent. See if you can’t fit your texture better.

  2. Alpha test WILL save you significant time, particularly if you are using it instead of blending (rather than in addition to). I have personal experience with this

  3. I would only clip polygons if it’s a last resort, and only if you have relatively few polygons to clip.

– Zeno

  1. The polygons are big. I get them from the terrain, which has large triangles in it (small triangles would mean too many triangles and too much memory consumption). Not much to do about that.

  2. I need to use blending, as I’m rendering shadows/lights on top of the existing grass/rock/sand/whatever.

  3. Perhaps some form of guard band clipping. Determine a threshold on where to clip the polygon, depending on speed of CPU and GPU?

Clipping should be free. You can try it if you want, but I doubt it will do anything.

  • Matt