Lighting.j3md
is a Phong-illuminated material definition that makes the most of your materials. It's probably the material definition that you will use most often.
All examples in this category show illuminated materials; this means you must add a light source to the scene to be able to see them! Here is a code snippet that creates two useful light sources from the com.jme3.light
package, and attaches them to your rootNode
. More details about lights later.
DirectionalLight sun = new DirectionalLight(); sun.setDirection(new Vector3f(1, 0, -2)); sun.setColor(ColorRGBA.White); rootNode.addLight(sun); AmbientLight ambient = new AmbientLight(); ambient.setColor(ColorRGBA.White); rootNode.addLight(ambient);
Let's look at the simplest case first: A material with plain material colors, without textures, but with shading.