I’m brand new to jMonkey, so it is a little frustrating finding lots of documentation about problems I’m running into but then finding out these answers don’t apply to jme3 or aren’t implemented yet.
I’m trying to create a simple texture out of a PNG that has transparency, but the final texture is all messed up where it should be transparent. Any ideas what I’m doing wrong?
http://img41.imageshack.us/img41/1658/63111827.jpg
[java]
Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SimpleTextured.j3md”);
mat1.setTexture(“m_ColorMap”, assetManager.loadTexture(“Models/warriorgirl300pxtall.png”));
geom1.setQueueBucket(Bucket.Transparent);
geom1.setMaterial(mat1);
geom1.setLocalTranslation(0, 0.5f, 0);
geom1.setLocalScale(0.5f);
rootNode.attachChild(geom1);
[/java]
Any help would be much appreciated.
Try this:
[java]
Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SimpleTextured.j3md”);
mat1.setTexture(“m_ColorMap”, assetManager.loadTexture(“Models/warriorgirl300pxtall.png”));
mat1.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
geom1.setQueueBucket(Bucket.Transparent);
geom1.setMaterial(mat1);
geom1.setLocalTranslation(0, 0.5f, 0);
geom1.setLocalScale(0.5f);
rootNode.attachChild(geom1);
[/java]
I think all you’re missing is the Blendmode set to Alpha.
Cheers!
~FlaH
3 Likes
That did the trick, thanks so much!
Out of curiosity, is this stuff documented somewhere and I’m just not seeing it? All the stuff on transparent textures I could find seemed to be outdated for jme3.