Transparent Lighting Material

I’m trying to set a material to a geometry. This material has a .png texture which is partially semi-transparent (about 50%) and is a Lighting material. I am trying the following:

[java]

Material mat = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);

mat.setTexture(“DiffuseMap”, assetManager.loadTexture(“Textures/saved.png”));

mat.setColor(“Diffuse”, new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));

mat.setColor(“Ambient”, new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));

mat.setBoolean(“UseMaterialColors”, true);

mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

board.setMaterial(mat);

board.setQueueBucket(Bucket.Transparent);

board.setLocalTranslation(width/2, height/2, 0);

guiNode.attachChild(board);

[/java]



However, the geometry is not showing up. I’ve already added a light.



The geometry only shows when I remove [java]board.setQueueBucket(Bucket.Transparent);[/java]

However, the geometry then disappears. I’ve searched and found some threads with the same problem, but whenever I do what they say, the result is the same.

You don’t have to stick it in the transparent bucket for the guiNode… in fact, it will cause strange behavior.



…but if you want lighting to work then you do have to add a light to the gui node. But lighting in the guiNode is a little unusual. Are you sure that’s what you want to do?

If I remove it from the bucket, there is no transparency.



Regarding light, I’m not sure yet. I think I can work without it.

@memonick said:
If I remove it from the bucket, there is no transparency.

Regarding light, I'm not sure yet. I think I can work without it.


How do you know there is no transparency? Gui bucket items are rendered in Z order so maybe there is something you are getting confused by and thinking there is no transparency.

I put transparent things in the gui bucket all of the time without issue. The guiNode is in the GUI bucket. If you put your guiNode objects in a different bucket then strange things happen.

Wait, we got confused. The geometry just doesn’t display.

@memonick said:
Wait, we got confused. The geometry just doesn't display.


In which case?

In the code I listed, the geometry doesn’t show.

A lighting based gui sounds pretty cool tho. Like in a survival game. At night, even the HUD goes black…

Yeah, it’s great for effects. That’s why I want it :confused:

Edit to add the quote of what I was responding to:

@memonick said:
In the code I listed, the geometry doesn't show.


Yeah, because you put it in the transparent bucket but it is a child of the guiNode.

Why do I feel like we are going around in circles?

I will state this as plainly as I can:
Adding a child to the guiNode will not ever work ever ever ever ever ever ever if it is not in the gui bucket (ie: DON'T CHANGE THE BUCKET)

The guiNode already supports transparency. The only thing the transparent bucket does for you is sort from front to back... and in this case take you out of ortho and put you in some bizarre place in the world.
2 Likes
@androlo said:
A lighting based gui sounds pretty cool tho. Like in a survival game. At night, even the HUD goes black...


Yep. And it works as long as you add a light to the guiNode. I've done that in Mythruna before.
1 Like

Thanks. Sorry, I wasn’t understanding you :frowning: