FaceCullMode.Off = waste of Alpha Map

Hey JME com!
What I try to do is creating a tree with alpha map leaves, export it to j3o, and then get the Material inside the game itself and change it to alpha.
This works on itself but when I add multiple leaves and do the follow settings:

     Geometry helpMat = (Geometry) treeNode.getChild("Material.001");
    Material matz = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    matz.setTexture("ColorMap", assetManager.loadTexture("/4bb8pU52180.png")); // with Unshaded.j3md
    matz.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
    matz.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
    helpMat.setMaterial(matz);
    helpMat.setQueueBucket(Bucket.Transparent);
 //  treeNode.setShadowMode(RenderQueue.ShadowMode.Off);

y
(left ingame image, right one Blender)

As you can see he cuts some part of the leaves.
When I turn FaceCullMode to Front it looks normal (ofc without the leaves you should normaly see).
I realy have no clue what to do, maybe because the leaves stick in each other and this parts cannot be rendered ?
Hope you can help, have a nice day!

use the AlphaDiscardThreshold on your leaves material set it to something like 0.1

wow very advanced thx :smiley:

material.setFloat(“AlphaDiscardThreshold”,0.1f);

To explain a bit more. this means that any pixel that has an alpha value below 0.1 will be discarded (aka not rendered).

1 Like