[Solved] Transparency/Shader problem

I’m having trouble getting transparency to work right with some Materials I’m using. The intent is for a wall to be translucent and the floor behind it to be opaque (should be able to see the floor tinted by the wall). Seems like it should be simple, but I’m missing something because the floor is not showing through the wall.

It seems that if I set the material to the standard “Common/MatDefs/Misc/Unshaded.j3md” that transparency seems to work fine. However, I need to use a different shader for other reasons and I can’t seem to figure out what the difference between the standard shader and my shaders is.

Here’s the java code to set everything up.

Texture tex = m_application.getAssetManager().loadTexture(“Textures/wood.jpg”);


Material m_woodFloor = new Material(m_application.getAssetManager(), “MatDefs/Unshaded.j3md”);

m_woodFloor.setTexture(“Tex”, tex);

m_woodFloor.setFloat(“TexScale”, 1.0f);

m_woodFloor.setFloat(“Alpha”, 1.0f);



Material m_wallMaterial = new Material(m_application.getAssetManager(), “MatDefs/Wall.j3md”);

m_wallMaterial.setColor(“color”, ColorRGBA.Blue);

m_wallMaterial.setFloat(“alpha”, 0.1f);



Here are my shader programs:


uniform vec4 m_color;

uniform float m_alpha;

void main(void)


// set color

vec4 color = m_color;

color.a = m_alpha;

gl_FragColor = color;



uniform sampler2D m_Tex;

uniform float m_TexScale;

uniform float m_Alpha;

varying vec2 texCoord;

void main(void)


// set color

vec4 outColor;

outColor = texture2D(m_Tex, texCoord.xy * m_TexScale);

outColor.a = m_Alpha;

gl_FragColor = outColor;


try to add:


and floor do not need that:


m_woodFloor.setFloat("Alpha", 1.0f);



why it could need it? use Common/MatDefs/Misc/Unshaded.j3md instead of yours MatDefs/Unshaded.j3md

Thanks on both accounts. I didn’t realize I had those redundant lines. It looks much better!