Transparent polygons sorting

Started by keaukraine, May 02, 2011, 09:50:05 AM

Previous topic - Next topic

keaukraine

Hi,
I have an object which has only transparent triangles in it. The problem is that triangles are messed up in JPCT-AE. Does it have option for better triangle sorting algorithm? If not, please take a look at it, because I've had this problem with my previous app and had to calculate z-order manually which I can't do in current situation.

EgonOlsen

There is no triangle sorting at all. All there is, is object sorting. The gpu renders geometry data in large lumps, i.e. not triangle by triangle like a software renderer (or the hybrid pipeline of desktop jPCT) would do it. Within the object, there's no sorting other than the order in which the object is stored in memory. There's no way to reorder this. The latest DX11 desktop gpus can do some fancy "order independant transparency", but current mobile hardware is far away from this. All you can do is do split your object into several ones and hope that you won't run into sorting issues with those which, as you've already experienced, might happen as well depending on the scene. Or maybe you can get away with additive blending as 1+2+4 is the same as 2+1+4, so order doesn't really matter in that case (except for framebuffer accuracy).

How does your object look like?

keaukraine

My object is a flower. Apparently I can't use additive blending for flower petals. Could you implement z-order sorting per object, triangle by triangle? All 3D engines that I've used before on PC handle transparent polygons sorting. Yes it may lead to some performance drop but in my case it's simply unusable.

keaukraine

#3
I've tried to implement custom sorting by creating new Object3D and addTriangle() method but it appeared to be too slow.

EDIT: As I see IVertexController and GenericVertexController don't provide methods for modifying UVs of mesh. Would you kindly extend IVertexController interface to be able to modify UVs of mesh? This way it can be possible to implement transparency sorting.

EgonOlsen

You can modify UV by using the PolygonManager, but taken care to use the proper compilation mode and call touch after the modification. However, i don't understand how this can improve sorting!? Polygon sorting actually kills the pipeline. The desktop version can do that, but its not an option on Android....it's simply too slow. It requires to do all transformations for all vertices in software. I'm not sure, but i somehow doubt that any high level engine is doing this.
Wouldn't it be better to split the flower into different objects?