Hallo
I want to build in Jme 3, a Transparency ball :
https://wiki.jmonkeyengine.org/legacy/doku.php/transparency_vs_translucency
https://wiki.jmonkeyengine.org/legacy/doku.php/transparency_vs_translucency
but this code that is explained here does not work in Jme3.
In any case, like in jme3 build such a ball that is transparent.
perhaps as here with the Different surfaces ( any Textur (Images))
how do I do something like Jme3?
another question:
in SVN it gives an example of "TestCubeMap.java". One such person is a teapot that has a transparent surface.
the problem is that only the Teapot background picture is seen.
But when I add one other object, I can not see through Teapot.
How can I make other objects invisible?. For example, a box ...
Thanks
If you just want a solid colored transparent sphere, something like:
[java]public class TransparentSphere extends SimpleApplication {
@Override
public void simpleInitApp() {
flyCam.setMoveSpeed(20);
Sphere ball = new Sphere(32, 32, 2f);
Geometry ballGeom = new Geometry(“Ball Name”, ball);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
mat.setColor(“m_Color”, new ColorRGBA(0, 1, 0, 0.5f));
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
ballGeom.setMaterial(mat);
ballGeom.setQueueBucket(Bucket.Transparent);
rootNode.attachChild(ballGeom);
Box box = new Box(10, 0.5f, 10);
Geometry boxGeom = new Geometry(“Floor”, box);
Material mat2 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
mat2.setColor(“m_Color”, ColorRGBA.White);
boxGeom.setMaterial(mat2);
rootNode.attachChild(boxGeom);
boxGeom.setLocalTranslation(0, -3f, 0);
}
public static void main(String[] args) {
TransparentSphere app = new TransparentSphere();
app.start();
}
}[/java]
Give that a shot. You should get a 50% transparent green sphere over a solid white floor. jME3 handles things a bit differently with the use of shaders, but change is good. I switched to jME3 maybe 6 months ago and I haven’t looked back. Keep at it!
Cheers!
~FlaH
1 Like