Transparency issue : different result in jme/blender/sketchup

ok, i am working on sketchup and i use blender as a “format converter” and to add some smooth shading.

My problem is : when i work with semi-transparent textures, they appears opaque.

Here is a picture:

the top-left is blender, the top right is sketchup and the bottom is jmonkeyengine.
So the question is … why is the background color different ???

no, i am kidding. Seriously, the question is : why in jme there is no backface and the texture is not transparent at all ? Plus, i tried to change that in a short program, and even if i add all the geometries in the transparent bucket and set the backface culling to never, it still doesn’t work.

I tried different combinations of this :


where the geom is get from a depthFirstTraversal of the model (i just do that on all sub-spatials which are Geometry).

I get the transparency issue for all my models, not only this one. The color seems to be transparent just fine (the yellow is not a texture, it’s a color) but the texture “bugs”.

Thanks for your help :slight_smile:

If you’re using Lighting.j3md material, make sure you have mat.setBoolean(“UseAlpha”,true);

i just tried, it doesn’t work. I notice that if i put some alpha value on the texture (the image) then i get the corresponding transparency in jme.

However, i still don’t know how to remove the backface culling for color (it seems to work with the texture now, for a reason i don’t know).

Are you saying that the texture is opaque? If so, why do you expect transparency in the render?

cause i have a transparency in blender AND in sketchup. It seems that they have an option that add transparency even if the basic picture is not transparent. And this is a bood thing, cause then i can use the same texture in multiple places without having to clone the image over and over again.

Blender can also do raytracing and more things that cannot be live rendered, hence our repeated hint that you can only expect meshes, uv maps and textures to be imported. It simply works differently and its not made to exclusively do game models.

When you try to do two-sided transparency with one Geometry it will never work. JME can’t sort transparency by pixel so there will always be some angle where the front triangles are drawn first and then the back triangles get depth culled. I feel like I answer transparency depth sorting issues so often that I wish the IDE would pop-up an info box the first time anyone tries setQueueBucket(Bucket.Transparent). :slight_smile:

Transparency has to be drawn back to front to work properly. Your geometry can’t be sorted that way.

For example, as an easy test you could turn off depth test for that object. It will bug with all of the other objects but at least then your front faces won’t be culling the back faces and you can see that this is indeed the issue.

The only real solution in your case (and it’s non-trivial in JME), is to split the object into to Geometry objects that share the same mesh. Have one with back face culling on and one with front face culling on… then write a custom GeometryComparator that makes sure the inside one is always drawn first. That’s the non-trivial part if you’ve never done it. Lemur has a LayerComparator that you can borrow that lets Geometries use a UserData to indicate relative layers. setUserData(“layer”, 0) in the inside one and setUserData(“layer”, 1) on the outside one. (presuming they both have the same parent node).

1 Like