daily bump till answer if will be integrated, and if not reasons why. Works after a very small change to the material, since definitions changed a little. (also int the testcase one texture changed from png to jpg)

It’s added in last SVN, thanks for the contribution @phate666

I added a check for the TextureArray capability in the test case that throw an UnsupportedOperationException, since it’s a ogl3.0 feature.

Also I put the UnshadedArray material files in the test repo only.

BTW do you know if there is a limitation on how many textures you can send to the GPU like this?

is there any chance for a ShadedArray.j3md?

Well yes, it just depends on if anyone writes it.


How can I add textures with alpha channel? It seems that doesn’t work with the following code:


mat = new Material(assetManager, “Textures/UnshadedArray.j3md”);

Texture tex0 = assetManager.loadTexture(“Materials/Glass.png”);

List<Image> images = new ArrayList<Image>();


TextureArray tex = new TextureArray(images);

mat.setTexture(“ColorMap”, tex);



I guess the shader(fragment) is just ignoring alpha values

ok but how can I add alphachannel-support to the fragmentshader?

The fragment shader is in fact writing the alpha value from the texture into the pixel. Something else must be wrong …

Ok i built a custom mesh here is my code:


//First I set all buffers

FloatBuffer bufferpos = BufferUtils.createFloatBuffer(max_cubes_per_chunk * 24 * 3);

m.setBuffer(Type.Position, 3, bufferpos);

FloatBuffer buffertex = BufferUtils.createFloatBuffer(max_cubes_per_chunk * 24 * 3);

m.setBuffer(Type.TexCoord, 3, buffertex);

IntBuffer bufferind = BufferUtils.createIntBuffer(36 * max_cubes_per_chunk);

m.setBuffer(Type.Index, 1, bufferind);

FloatBuffer buffernorm = BufferUtils.createFloatBuffer(max_cubes_per_chunk * 24 * 3);

m.setBuffer(Type.Normal, 3, buffernorm);

VertexBuffer pvb, tvb, ivb, nvb;

FloatBuffer bufferVert, bufferTex, bufferNorm;

IntBuffer bufferInd;

//Get Meshbuffers

pvb = m.getBuffer(VertexBuffer.Type.Position);

tvb = m.getBuffer(VertexBuffer.Type.TexCoord);

ivb = m.getBuffer(VertexBuffer.Type.Index);

nvb = m.getBuffer(VertexBuffer.Type.Normal);

//Get DataBuffers from Meshbuffers

bufferVert = (FloatBuffer) pvb.getData();

bufferTex = (FloatBuffer) tvb.getData();

bufferInd = (IntBuffer) ivb.getData();

bufferNorm = (FloatBuffer) nvb.getData();






//Then i write all datas (texcoords, vert, normals, indexes) to the buffers

//+ updating at the end








It runs great but the textures with alphachannel are black boxes for example:

how can I solve that?

Are thy in the Alpha queue bucket? (You need to have transparent objects in another queue than non transparent ones.

Also transparent boxes are not a perfect case for batching in a box world, since depending on case there is no right renderorder so taht all transparencies are correct)

yes i have set the transparency bucketmode


should i build a new custom mesh only for transparent boxes?

so there is no way to handle transparent and solid blocks in one mesh?

Forgive me if this has been covered already, but what makes the background of your screen shot blue? Do you have a sky or have you set the viewport’s background color?

I have set the vieport’s backgroundcolor:

[java]viewPort.setBackgroundColor(new ColorRGBA(0.7f, 0.8f, 1f, 1f));[/java]

Also the blend mode of your material must be Alpha


I have already set the blend mode to alpha but it has no effect

[java]mat = new Material(assetManager, "Textures/UnshadedArray.j3md");

Texture tex0 = assetManager.loadTexture("Materials/Glass.png");

List<Image> images = new ArrayList<Image>();


TextureArray tex = new TextureArray(images);

mat.setTexture("ColorMap", tex);


It works!

I only have to add an alphachannel to all my textures.

thx for your help