Texture transparency on custom Mesh

I’m trying to place a minecraft like door and the windows are showing as grey and not transparent. The mesh is custom and programmatically generated. I have included the code for my mesh and the material.

public class BlockChunk_Material extends Material{

public BlockChunk_Material(AssetManager assetManager, String blockTextureFilePath){
    super(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    Texture texture = assetManager.loadTexture(blockTextureFilePath);
    setTexture("ColorMap", texture);


    private static Mesh generateMesh(){
    Mesh mesh = new Mesh();
    mesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(positions));
    mesh.setBuffer(Type.Index, 1, BufferUtils.createShortBuffer(indices));
    mesh.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(normals));
    mesh.setBuffer(Type.TexCoord, 2, BufferUtils.createFloatBuffer(textureCoordinates));
    return mesh;

When generating the geometry there is an opaque and transparent version.

Any help is appreciated.

Do you set



Yes for the transparent geometry

The same thing happens for Glass. You can see through it through certain angles.

Then your grass is in the transparent bucket.

Glass and grass are in the same bucket, whatever the case… and they shouldn’t be.

1 Like

Thanks. That gives me a starting point.

I’m seeing something very strange. I’m close I think. The Glass renders correctly if either a Door or a Glass block is loaded from a save game. If not then the Glass block is completely invisible.

The window of the Door is weird. You can see some blocks at certain angles but not others. See the screenshot below. Any ideas?

Another clue is that the windows change with the sky color. I’m using the SkyControl plugin for the sky.

Set the alpha discard threshold to something reasonable… though the last pic looks like the door isn’t in the transparent bucket.

Search for something like “alpha sorting” if you want to understand better why this happens. It comes up once a week or so.

Not sure what it was. But I started from scratch and got it working. As I ease features back in I’ll be sure to notice if something breaks it again.

Thanks for the help.

1 Like