jPCT-AE - a 3d engine for Android > Support

Object/ Polygon draw order

(1/3) > >>

AugTech:
Hi.
Is there anyway to specify a drawing order for objects?

Think of a plane used for the ground with a texture on it. I'm adding a 2D object on top of the ground - for example a puddle. Currently there is a lot of 'flickering' of the two objects during rendering. I'm guessing the GPU (?) can't decide what should be on top of what.

Any suggestions would be great!

Thanks.

EgonOlsen:
No, you can't...at least not for opaque objects. And there's no point in doing this anyway, because it won't solve your problem. The rendering order of opaque objects doesn't matter. What is in front and what is behind is determined by the zbuffer regardless of the order in which objects are being rendered. In your case, the depth buffer's accuracy isn't sufficient, which leads to common problem called z-fighting. To avoid this, you can move the two objects further apart or split rendering of the plane and the puddle by moving them into different worlds and clear the depth buffer between rendering both worlds. However, this can cause others problems if the plane is supposed to hide some objects or parts of them.
Another option is to check if your depth buffer's accuracy can be increased. This is possible on Tegra and Adreno gpus. Are you using one of these?
Btw: This only applies if at least one object is opaque. If the plane and the puddle are both transparent, then it's another story.

AugTech:
Thanks for the explanation Egon.
I remember the z-fighting explanation now.

I'm pretty sure I'm on Tegra, but obviously this cant be guaranteed on all devices, so it looks like the best solution is to move the objects further apart. Any suggestion on a value?

AugTech:
Okay, tried that but to no avail. Even with -5f offset, still getting z-fighting.

Also tried   Config.stateOrientedSorting=false; but it didn't help.

How does one alter the accuracy of the GPU (as you mentioned)?

Ta.

EgonOlsen:
You have to use this config chooser: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/util/NVDepthConfigChooser.html

Navigation

[0] Message Index

[#] Next page

Go to full version