SolidColor.j3md

I seem to be having issues with this material definition in my scene.


  1. The m_Color is a Vector4 data type which seems to imply it supports transparency, but no matter what value I set the alpha value to I get no transparency.
  2. Very strange results occur when you take an object colored with SimpleTextured (and contains transparency) and put it on top or in front of an object colored with SolidColor. It’s almost as if the object with the SolidColor material is being ignored in those calculations.





    Here’s what I’m doing for my materials & how to reproduce:

    [java]

    // this material is applied to a simple geometry (Quad)

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

    greenMarker.setColor(“m_Color”, new ColorRGBA(0, 1f, 0, .5f)); // how come the alpha is ignored??

    [/java]



    [java]

    // the material to be used on an object (in my case another Quad) and put on top or in front of the SolidColor

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

    mat.setTexture(“m_ColorMap”, assetManager.loadTexture(“Textures/” + key + “.png”)); // put in any image with alpha channel

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

    [/java]



    Anyone else experience these problems with SolidColor materials?

Ok, ignore my first issue #1. After posting I realized I forgot to set BlendMode.Alpha on the material (greenMarker). It works now, however issue #2 is still an issue.

Ok, I figured out my problem. The solution is to make sure you call this on your geometry (the one with the SimpleTexture material):



[java]

mark.setQueueBucket(RenderQueue.Bucket.Transparent);

[/java]