Partially transparent cube

Hi guys,

Im quite new to JMonkey and Im trying to figure out how to create a simple partially transparent blue cube. It seems rather simple but I cant seem to figure out how to make it “Partially” transparent. Im sure its just a simple one line of code. Also does anyone know how I can put like a simple black border on every corner of the cube?

Thanks guys.

/** A translucent/transparent texture, similar to a window frame. */
Box cube2Mesh = new Box( 1f,1f,0.01f);
Geometry cube2Geo = new Geometry("window frame", cube2Mesh);
Material cube2Mat = new Material(assetManager, 

for your purpose, do not use “setTexture” (uncomment this line), use this instead:

ColorRGBA color = ColorRGBA.Blue.clone();
color.a = 0.75f; //75 percent opacity and 25 percent transparency
material.setColor("Color", color);

some theory too:


1 Like

Thank you for that. :slight_smile: I needed to make the whole cube transparent and those last 3 lines of code where you created a clone is something I didnt know and something new I leaned. Thanks.
Any idea how I can make each edge of the cube stand out?

There is a class called WireBox in jME.
Create a WireBox with same dimensions as your cube.
Position the WireBox at the same position as the Cube.
Should show all edges as in “edges of a cube”.
If you want to see the edges of the triangles, you can use the Wireframe mode: