I have a big problem rendering a tree with a PNG texture with transparent parts.
My code to render the model:
Geometry s = (Geometry)getAssetManager().loadModel(“Models/tree/tree.j3o”);
Result without BlendMode.Alpha and Bucket.Transparent:
Result with BlendMode.Alpha and Bucket.Transparent:
I did some research about this topic but all I found was that I should set BlendMode to Alpha an the Bucket to Transparent. But when I do this all leaves (the whole texture) are rendered transparent and not only the transparent parts in the PNG.
Thanks for any help!
What is the material? Do you have a light? What is the light color and/or ambient color?
DirectionalLight sun = new DirectionalLight();
AmbientLight al = new AmbientLight();
The material used is Lightning.j3md
The actual material is needed to help debug this, not the material definition (ie. j3md). We need the .j3m file, or the code if you create the material in code.
OK, I DID IT!
Thank you Sploreg. As you mentioned the j3m file, I realized that I do not have one.
I have converted my model this way: .blend → export from Blender as .obj/.mtl → import into jMokney SDK. jMonkey created only a j3o and a j3odata file (and the texture).
After your post I opened the j3o in the SceneComposer. In the properties panel there was something about “Material: Generate j3m file”. I clicked on it and suddenly there where 2 identical j3m files.
In the j3m file I discovered that the DiffuseMap and the AlphaMap is the same Texture. I deleted the AlphaMap line and everything is working. (I have to load the material manually now)
ah cool, glad you got it working.
(I have to load the material manually now)
Just apply it to the geometry in the scene composer and save the j3o.