|
From: Frank C. <dev...@ch...> - 2004-09-29 04:13:58
|
On 28-Sep-04, at 9:03 PM, James W. Walker wrote: > Frank Condello <dev...@ch...> wrote: > >> Which case was that? I can't seem to render anything properly with >> the current code. Triangles pop unpredictably at the slightness >> change in the viewport... From my perspective, your centroid code is >> the lesser of two evils :) > > IIRC it was the case of a single box. I just spent a few minutes playing with your test app, and ya, the current method seems to handle a single box better (there are still errors though). But add a couple more boxes and it fails miserably - I still think your centroid method is much better for a general purpose sort. I guess I'd just like to see a better generic sort in there for now, so we can tweak special cases from a good starting point, rather than trying to work with an algorithm that's breaks more often that not. Dealing with built-in primitives shouldn't be too hard. For convex polyhedra like a box, you can assume any triangle with it's normal facing away from the camera must be behind any triangle facing the camera. You can use this fact to influence the ordering even if the centroid calculation says different. Frank. |