Hello Materials error

I’m going through the Hello Materials tutorial, and the result I end up with is different than the screenshot at the top of the tutorial. The cube on the right is supposed to be white with a purple monkey, but instead you end up with a purple cube and a monkey hole (similar to the middle cube). Just to make sure I didn’t make any mistakes I copy/pasted the code and it still shows up wrong.



There’s also no explanation of that part of the code. I assume that’s because it’s so similar to the middle cube, but it would be nice to know why you don’t need to set the blend mode to alpha for the purple monkey, and why you don’t need to set the queue bucket to transparent.



This is the code:

[java]/** A cube with base color “leaking” through a partially transparent texture */

Box boxshape4 = new Box(new Vector3f(3f,-1f,0f), 1f,1f,1f);

Geometry cube_leak = new Geometry(“Leak-through color cube”, boxshape4);

Material mat_tl = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

mat_tl.setTexture(“ColorMap”, assetManager.loadTexture(“Textures/ColoredTex/Monkey.png”));

mat_tl.setColor(“Color”, new ColorRGBA(1f,0f,1f, 1f)); // purple

cube_leak.setMaterial(mat_tl);

rootNode.attachChild(cube_leak);

[/java]



Here’s the result I get: http://i.imgur.com/z7L5r.jpg

Here’s what the result should be: https://wiki.jmonkeyengine.org/legacy/lib/exe/detail.php/jme3:beginner:beginner-materials.png?id=jme3%3Abeginner%3Ahello_material

The error is more in the materials tutorial picture I think, your image looks fine from what the code does.

Why don’t you need to set the blend mode to alpha or set the queue bucket to transparent like the middle cube? And shouldn’t the cube still be white since the white part of the texture is not transparent?

Hm, right, the transparency shouldn’t leak… What version of jme3 is this?

I’m using 3.0 beta

I have exactly the same problem. Is there a solution for this?

Posting here to say that I got the same result as the OP.



Also, to avoid making a new thread for a non-issue, the Hello Picking tutorial code already includes the makeCharacter() method, which solves Exercise 2 (“Can you add code that loads and positions a model in the scene, and shoot at it?”).



EDIT: Duh, disregard. I didn’t realise that it was a wiki page. I have edited the code out.

1 Like

That screenshot is very old actually. That material its using has been long since removed which is why there’s a different result.