O'Reilly logo

jMonkeyEngine 3.0 Beginner's Guide by Ruth Kusterer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – lights on!

You can use any combination of light sources from the com.jme3.light package: ambient lights, directional lights, point lights, and spot lights. Remove the lights from HoverTank.java file's simpleInit() method, and add them back one by one to see the difference.

  1. Add an ambient light. Try multiplying the color by different scalars, larger or smaller than 1.0f, to increase or decrease its brightness. Note how it illuminates the whole scene evenly. Try setting the color to something other than White.
    AmbientLight ambient = new AmbientLight();
    ambient.setColor(ColorRGBA.White.mult(5f));
    rootNode.addLight(ambient);
  2. Remove the ambient light and add a point light. Move it to different locations to see the difference. Try different ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required