Z SORT for alpha blending

everything is in the title.

i mean that i want all alpha textured faces to be drawn in the correct z order to avoid ghosts/semi drawn objects behind alpha faces

is it possible with jme ?

There is no such thing as a correct triangle-level sort for alpha… not to mention that it would be way too slow.



Transparent Spatials are already sorted back to front by nearest Z. This is the best the engine can do, really.



If your textures are a combination of mostly opaque pixels and mostly transparent pixels then you can improve things with:

http://hub.jmonkeyengine.org/javadoc/com/jme3/material/RenderState.html#setAlphaTest(boolean)

http://hub.jmonkeyengine.org/javadoc/com/jme3/material/RenderState.html#setAlphaFallOff(float)



In some specific cases, it’s also possible to fix the problem by enforcing a custom sort order based on some other factor (for example, since Mythruna’s world is batched and semi-transparency is somewhat limited, I was able to get away with sorting by material.)