These maps work with color, attaching a provided image, such as a wallpaper, to the surface of a 3D object. SelfIlluminationMap also adds an additional inside glow to the image.
For example, let's take a map of Earth and put it on a sphere:
It will look as shown in the following screenshots. Note that I've added a rotation to make the results more visible:
The material method I've used here is material.setSelfIlluminationMap(Image bumpImage). See the inline comments for more details:
// chapter12/EarthDemo.java
public void start(Stage stage) {
// preparing a material
PhongMaterial mat = new PhongMaterial();
Image image = new Image( "https://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/Reversed_Earth_map_1000x500.jpg/800px-Reversed_Earth_map_1000x500.jpg");
// we took an Earth map and used it as a material
mat.setSelfIlluminationMap(image);
// creating sphere
Sphere sphere = new Sphere(150);
sphere.setTranslateX(450);
sphere.setTranslateY(300);
sphere.setTranslateZ(400);
sphere.setRotationAxis(new Point3D(1, 1, 0));
// attaching our map material to the sphere
sphere.setMaterial(mat);
// adding a point light at the top of the scene
PointLight light = new PointLight(Color.LIGHTYELLOW);
light.setTranslateX(350);
light.setTranslateY(100);
light.setTranslateZ(300);
// setting the camera
PerspectiveCamera camera = new PerspectiveCamera(false);
camera.setTranslateX(300);
camera.setTranslateY(150);
camera.setTranslateZ(300);
Scene scene = new Scene(new Group(sphere, light), 300, 300, true);
scene.setCamera(camera);
stage.setScene(scene);
stage.setTitle("3D shapes demo");
stage.show();
// this animation will rotate a sphere for us, so viewer can see a whole globe
RotateTransition rot = new RotateTransition(Duration.seconds(10), sphere);
rot.setToAngle(360);
rot.setInterpolator(Interpolator.LINEAR);
rot.setCycleCount(Timeline.INDEFINITE);
rot.play();
}
Note how, at the end of the sample, we used an Animation API—it works with 3D objects in the same way as with 2D ones.