Page 1 of 1
DepthSorted
Posted: Mon Mar 15, 2010 2:56 pm
by Kjell
A DepthSorted checkbox on RenderMesh, so the triangles of a mesh are sorted in order of depth and then rendered back to front. Useful for foliage, hair and other non-flat meshes that use transparency.
K
Posted: Tue Mar 16, 2010 1:02 pm
by kattle87
as far as you know, is there anything in openGL that makes this automatically? Otherwise we should go with a fast sorting algorythm (I can code a quicksort... I guess I should code this anyway...)
Posted: Tue Mar 16, 2010 1:18 pm
by Kjell
Hmm,
There's GL_SAMPLE_ALPHA_TO_COVERAGE, but not sure what kind of performance hit that takes.
I believe a BSP Tree is generally used for this kind of sorting ( or depth peeling ) .. guess it depends on what you want to support ( intersecting triangles for example ).
K
Posted: Tue Mar 16, 2010 5:46 pm
by kattle87
You are right, those structures are usually way better for handling 3D spaces, but implementing those might take a lot of space and time. On the other side the QuickSort can be used in any generic sorting operation, and I think we already have something that needs a sort. Quicksort is sligthtly bigger in code size but is way faster when a greater number of object is present.