I’m following the jMonkey documentation to learn about materials, and I got transparent objects and shaded objects working, but when I tried to add textures to a shaded object, the game crashes with this exception:
IllegalArgumentException: Material parameter is not defined: DiffuseMap
This is the code that makes the material which is causing the issue:
brickMaterial = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
TextureKey brickKey = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg");
brickKey.setGenerateMips(true);
Texture brickTexture = assetManager.loadTexture(brickKey);
brickMaterial.setTexture("DiffuseMap", brickTexture);
brickMaterial.setColor("Ambient", ColorRGBA.White);
brickMaterial.setColor("Specular", ColorRGBA.White);
brickMaterial.setFloat("Shininess", 128f);
The docs says that I should use DiffuseMap for “Phong-illuminated” materials but the program says it is invalid…?