|
From: Frank C <li...@si...> - 2004-08-08 06:17:56
|
On 7-Aug-04, at 10:20 PM, James W. Walker wrote: > I've been doing some experimentation on ways of doing depth sorting of > transparent triangles. The choice of algorithms comes down to one of > those classic tradeoffs: do you want the job done right or do you want > it done right now? But it seems clear that we can do better than what > we have now. > > ... > > 1. current Quesa comparison method, qsort > 2. centroid comparison, qsort > 3. barycentric comparison, selection sort after centroid qsort > > Method 1 (which Quesa currently uses) displays constant ugly flashing. > Method 2 has much less flashing, though it is not hard to see sorting > errors much of the time. This is of similar speed to method 1. > Method 3 has only occasional errors, but is quite a bit slower. Very nice! #2 seems like an excellent quality/speed tradeoff. I did some tests with a more stressful mesh (approx 1600 triangles) and the occasional errors were totally acceptable with #2 while #1 was a massacre and about 5FPS slower. #3 ran at 0.1FPS, so I don't think it would be a good choice as the default setting, though it may make sense as an option for those who prefer accuracy over speed. Perhaps you can add a "sorting quality hint" via the Get/SetProperty API and use both #2 and #3? I think #2 should work out well enough in real-world applications. Self-sorting a cube turns out to be a fairly difficult thing to do per-triangle. Frank. |