When you are working with multimapped materials, you base them, for example, on the Lighting.j3md
material definition. Material definitions come bundled with the jMonkeyEngine library. The above examples taught you how to use a series of setters to specify material properties in Java. This is typically how you start when you create a new, one-off material.
Look at your hover tank code again. It takes 10 lines of Java code to configure this material, plus four lines for TextureKeys
! If you ever need the same material with the same settings for other models, it would be handy to create and configure your custom materials once, and then load them simply with one setMaterial(mat)
line from a file.
Return to the SDK; now, let's learn how to store material settings in a material file:
Right-click on the assets/Material directory and choose New…Other. Then go to Materials | Empty Material File. Click on Next.
Name the new file
tank.j3m
and save it to your...