Hey guys,
Oooh, I am pulling my ruddy hair out again! I followed the wiki on adding transparency to my textures. But still the leaves come out with a white frame. I'm sure the background is transparent, so now I don't know what to do!
Here's the code snippet:
private void addTrees() {
Node rootNodeTransparent = new Node("Transparent");
rootNode.attachChild(rootNodeTransparent);
BlendState tpState = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
tpState.setEnabled(true);
tpState.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
tpState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
tpState.setBlendEnabled(true);
tpState.setTestEnabled(true);
tpState.setTestFunction(BlendState.TestFunction.GreaterThan);
tpState.setReference(0.1f);
rootNodeTransparent.setRenderState(tpState);
rootNodeTransparent.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
rootNodeTransparent.setLightCombineMode(Spatial.LightCombineMode.Replace);
// convenience method that loads a JME tree 0,10,0 with scale x5. Adds it to the rootNodeTransparent Node
loadSceneObject(rootNodeTransparent, new File("/Blender Work/trees/tree2/tree2-jme.xml"), new Vector3f(0f, 10f, 0f), 5f);
/* We activate two-sided transparency (?) */
DisplaySystem.getDisplaySystem().getRenderer().getQueue().setTwoPassTransparency(true);
ZBufferState zstate = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
zstate.setWritable(false);
zstate.setEnabled(false);
rootNodeTransparent.updateRenderState();
}
But it's still no good :? Images below... Please can somebody put me out of my misery!? Do I have something switched on that maybe I shouldn't I've been tinkering for hours now, and still can't spot it!