Transparency problem

Hey guys,

I’m currently playing a little bit with transparencies. Building geometry objects in a row with correct blending works fine. In jme2 we had transparent boxes inside transparent boxes. If i try the same with jme3 the following appears:

If i rotate the camera a little bit the inner boxes become visible. If i rotate back only the outer boxes are visible. Any idea what i’ve done wrong? In jme2 we had a similar problem and solved it with setting the DepthBufferWritableState to false. I saw that there is something like that in the additional render states but it hasn’t solved the problem. All the boxes are setup with a simple lighting material. The blendmode was set to Alpha and the queue bucket to transparent.



1 Like

The effect you achieved in the screenshot is pretty neat btw! :slight_smile:

I’m not 100% sure what could be causing this if you’re setting the material up the way you’re saying… I wrote a tiny test case with nothing fancy and it seemed to work fine; maybe you could try the settings I used.

If not, I’m guessing we need nehon or Momoko_Fan in here XD



public class TransparentBoxInBox extends SimpleApplication {

private static TransparentBoxInBox app;

private static AppSettings settings;

public static void main(String[] args) {

app = new TransparentBoxInBox();

settings = new AppSettings(true);


settings.setTitle(“Transparent Box in a Box”);





public void simpleInitApp() {

Box b1 = new Box(0.5f, 0.5f, 0.5f);

Geometry b1geom = new Geometry(“Inner Box”, b1);

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


innerBoxMat.setColor(“m_Diffuse”, new ColorRGBA(1f, 0f, 0f, 0.75f));

innerBoxMat.setColor(“m_Ambient”, new ColorRGBA(0.1f, 0.1f, 0.1f, 1));

innerBoxMat.setColor(“m_Specular”, new ColorRGBA(1, 1, 1, 1));

innerBoxMat.setFloat(“m_Shininess”, 100);

innerBoxMat.setBoolean(“m_UseMaterialColors”, true);

innerBoxMat.setBoolean(“m_UseAlpha”, true);



Box b2 = new Box(1f, 1f, 1f);

Geometry b2geom = new Geometry(“Inner Box”, b2);

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


outerBoxMat.setColor(“m_Diffuse”, new ColorRGBA(1f, 0f, 0f, 0.5f));

outerBoxMat.setColor(“m_Ambient”, new ColorRGBA(0.1f, 0.1f, 0.1f, 1f));

outerBoxMat.setColor(“m_Specular”, new ColorRGBA(1, 1, 1, 1));

outerBoxMat.setFloat(“m_Shininess”, 100);

outerBoxMat.setBoolean(“m_UseMaterialColors”, true);

outerBoxMat.setBoolean(“m_UseAlpha”, true);





DirectionalLight dl = new DirectionalLight();

dl.setDirection(new Vector3f(-1,-1,-1).normalize());





1 Like

This is actually pretty old problem, I also reported it some time ago and made a test for it. Here is the link to my thread.

The same problem I had in JME2 but I managed to solve it back then (can’t really remember how, but will try to dig out my old svns :/). Anyway, seems to me that the order of nodes is really important. On some occasions, when inner transparent objects are attached first, it works fine. But then again, not always…

I think this is kinda important and should be resolved before beta or smth…? :slight_smile:

Both @InShadow and @tehflah test cases will now work properly with the latest SVN commit :slight_smile:

The issue (in both jme3 and jme2) was that the sorting was done via the center of the model, when a large model intersected a smaller model, this issue would happen. I fixed it by sorting to the bound’s closest edge instead of its center.


Woah, what ever you’ve done - now it works perfectly :slight_smile:

Thank you very much.

I would put more plusses to your post, but can’t. :smiley:


Hey guys,

i have a problem with the transparencies once again. It’s difficult to describe but i hope the following images can illustrate it a little bit.

The main problem is that there is something like a clipping effect. If you have a look at the first picture you’ll see that the transparency colors are calculated correct depending on the z-order. If i move the camera up some cylinders will become lighter then before. It looks like they would disappear. Maybe a video could describe it much better. Each cylinder shown on the pictures is set up with alpha blending and rendered in the transparent bucket.

Any ideas what i’ve done wrong?



Sorry for the double post but i think the following pictures illustrate it a bit better.

@Momoko_Fan Isn’t that the alpha to coverage issue?

@oOMoeOo try renderManager.setAlphaToCoverage(true); in your simpleInit (this may not work, that’s just a blind guess…but who knows)

It seems that setting the alpha coverage to true solves the problem. Could you explain what caused the problem?

Sorry, but it some cases the problem still exists :frowning:

oOMoeOo said:
It seems that setting the alpha coverage to true solves the problem. Could you explain what caused the problem?

I can't. I just read some similar post, without really understanding it completely, and one of the solutions was alpha to coverage :p
As i said it was a blind guess :p

oOMoeOo said:
Sorry, but it some cases the problem still exists :(

And it seems that i was wrong :p

here is the post I'm talking about

Oh noes, Rémy’s post has gone bipolar!

Seems like a sorting issue… By the way, are those cylinders rendered with the Lighting material?

Also, is each of them a separate geometry?

Perhaps you can make a test case?

@Momoko_Fan: Yes they are rendered with a lighting material and each one is a single geometry. The blend mode was set to BlendMode.Alpha and the bucket to transparent. Will try to build a test case.