Transparency

Hello, this is my new transparency problem. I asked about Transparency in a previous thread but the now i have a problem in the answer i got. So im making a tree, right, and ive decided to use transparent geometries with a leaf texture on for the leaves, simple right? Well last time i was told to use Leaf.setQueueBucket(Bucket.Transparent); (not that I don’t appreciate the help :wink:

Well anyway, it worked, to a certain extent. When i move the leaf close to the j3o of the tree trunk, the transparency of the geometry dissapers. I will include an image and some code below. Thanks in reponse for replies ^.^ even if it ends up in trolling the thread :stuck_out_tongue:



Box plane = new Box(new Vector3f(4f,1.1f,0f), 0.00000001f,1f,1f);

Geometry Leaf = new Geometry(“Leaf”, plane);

Material L_ml = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

Texture L_tex = assetManager.loadTexture(“Models/Leaf.png”);

L_ml.setTexture(“ColorMap”, L_tex);

L_ml.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

Leaf.setMaterial(L_ml);

Leaf.setQueueBucket(Bucket.Transparent);

rootNode.attachChild(Leaf);



http://imgur.com/oifJG



( the one on the left uses 3f,1.1f,0f for positioning, the one on the right uses 4f,1.1f,0f)

May I ask why you’re using a Box for the leaf and not a Quad?

Also, just as a suggestion, you might want to use the Java standard of naming variables in camelCase for clarity.

1 Like

Also disable depth writing…



out of my head: L_ml.getAdditionalRenderState().setDepthWrite(false)

or sth. like that

1 Like

Would a quad solve my problem? I find the unix naming scheme to be efficient when choosing variable names, camleCase works too, i don’t really mind…



Thanks Dodikles though, ill try that



[EDIT]



Thats still not working, well it fixed the problem, but now the tree is always infront of the leaf, from whatever angle you look at it, wierd huh?