Author Topic:   Number of Tris Screenspace error correlation
posted November 15, 1999 06:40 AM            
Seumass, a few months ago you mentioned in a forum post that you don't use a priority queue, just split triangles down to a predefined error threshold, count them, compare to the target triangle count, then for the next frame try to correct the error threshold.

Can you elaborate more on the formula? Of course, that depends on your particular error metrics...

I tried to do it like this:

fTriAdjust = nTrisLastFrame / nTargetTris;
if( fTriAdjust < 0.9 | | fTriAdjust > 1.1 )
fErrorThr *= CLAMP(fTriAdjust, 0.8, 1.4);
fErrorThr = CLAMP(fErrorThr, TOO_SMALL, TOO_LARGE);

The clams are needed to avoid too steep a increase in the triangle count, which causes a hiccup in the framerate.
The count eventually converges, but I get too many flipflopping triangles, especially with tri counts below 2000. I have spend too much time tweaking the constants above, and I can't get it to work the way I like.

One more thing: since you don't need a priority queue, you probably just keep the triangles to be split in a list. Do you access it FIFO or LIFO? Which has better locality of reference? There are good points for both approaches...


LDA Seumas
posted November 23, 1999 03:36 AM           
Flipflopping triangles means you're over shooting and under shooting the desired count. Ideally you should never overshoot, but only progressively more slowly approach the desired count. Try adding this before multiplying fErrorThr by fTriAdjust:

fTriAdjust = (fTriAdjust - 1.0f) * 0.1f + 1.0f;

That will "compress" fTriAdjust closer to 1.0, so that it will have one tenth its normal impact on the error threshold. You'll need to play with the amount of compression to find what works best, but that's the general idea.

-- Seumas McNally, Lead Programmer, Longbow Digital Arts