Blending issue with a palm

hello there,

i’m setting up my project structure using jme and loaded a model (a palm) from opengamearts (dummy & test purpose) which has diffuse,normal and spec. pics.

It looks really nice but there is one blend error i do not understand.

I hope someone can help me and here we go:

I use a jython to setup my level. i dont know jet if i keep it but for modularity of my project it would be great.

thats why i will post python code here.

The code is still really self explaining:


#import stuff is above

loadable_assets = [

(“http://” + host + “/trees/palm/”,“com.jme3.asset.plugins.HttpZipLocator”),


for asset in loadable_assets:

print “loading”,asset[0]


palm = assetManager.loadModel(“palm_tree.mesh.xml”)

mat = assetManager.loadMaterial(“palm.j3m”)







#the light

sun = DirectionalLight()

sun.setDirection(Vector3f(1, -1, 0))



rootNode, assetManager are in the global context accessible

What i get is this:

1: two leaves overlap and there is black where it should be a leave

2: displayed correct (palm trunk) cause there is no leave under that one

the model+pics are here

i forgot to post my palm.j3m:


Material Palm : Common/MatDefs/Light/Lighting.j3md {

MaterialParameters {

DiffuseMap: diffuse.tga

NormalMap: normal.tga

SpecularMap: specular.tga





It’s hard to tell for sure in this picture but it’s probably a polygon sorting issue. Since the lower leaf extends towards the camera then it sorts as being ahead of the other leaves and so will be drawn last when in the transparent bucket.

Even though the other leaves have transparent fringe, it’s still drawing pixels there and filling the Z-buffer… so when the lower leaf is drawn, it can only be seen where those other leaf polygons weren’t.

One way to mitigate this is to set the alpha falloff stuff on the extended render state.

This controls which pixels are drawn based on an alpha threshold… so the leaf fringe that is transparent will be discarded instead of being drawn fully transparent. In other words, the z-buffer won’t get filled. It’s still not a perfect solution if there is a part with lots of partial alpha as sometimes you will still see a halo around the leaves but it should be better than what is happening for you now.

1 Like

Another option is to enable alpha to coverage

It is similar to how the alpha test works, except it does this testing per sample rather than per pixel so you get smoother results.

To use alpha to coverage, you must have antialiasing enabled in the rendering options.

1 Like

Thx for the fast reply!

Both methods worked and coverage gave the better result!

Alpha to coverage will give a better result. The reason I usually don’t use it is because it requires AA… and with AA off it doesn’t seem to do anything at all so you are back to your original big black borders.

Maybe there is some threshold of the alpha test that isn’t visible when alpha to coverage is active but will be a nice fallback if AA is disabled. Or you can just force AA on always.