In my libgdx project I'm trying to add additional materials to model. Actually, I need to obtain texture combination - texture of the following material must be placed on the texture of the previous one. In some cases with transparency.
Something like that
Model knight = assets.get("data/g3d/knight.g3db", Model.class);
knightInstance = new ModelInstance(knight);
Material additionalMaterial = new Material();
knightInstance.materials.add(additionalMaterial);
knightInstance.materials.get(0).clear();
knightInstance.materials.get(0).set(TextureAttribute.createDiffuse(assets.get("data/g3d/checkboard.png", Texture.class)));
BlendingAttribute blendingAttribute1 = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, 0.4f);
knightInstance.materials.get(0).set(blendingAttribute1);
knightInstance.materials.get(1).clear();
knightInstance.materials.get(1).set(TextureAttribute.createDiffuse(assets.get("data/g3d/tiles.png", Texture.class)));
BlendingAttribute blendingAttribute2 = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, 0.6f);
knightInstance.materials.get(1).set(blendingAttribute2);
Offcorse, It doesn't work. Only first material is visible. Is that possible to do in LibGDX?