JavaFX 3D Tutorial #10 – Self Illumination

JavaFX Self Illumination Example

In JavaFX 3D, you can make use of self illumination maps to provide glowing effects for objects. Self illumination allows to add extra details for the objects.

Self Illumination Map

Self illumination map allows to add an additional glow to the image. You can see the effect in the following image.

JavaFX Self Illumination Example

JavaFX PhongMaterial provides an option to set illumination map using the method

public final void setSelfIlluminationMap(Image value)

It takes an image as parameter. The glow color will be the color used in image. A dark pixel doesn’t contribute to the glow. For example, in the above earth illumination case, I have used following illumination map.

Earth’s illumination map

 

PhongMaterial material = new PhongMaterial();
material.setDiffuseMap(new Image(getClass().getResourceAsStream("wood.jpg")));

//Set self illumination map
material.setSelfIlluminationMap(new Image(getClass().getResourceAsStream("illuminationMap.jpg")));

Box box = new Box(100, 20, 50);
box.setMaterial(material);
return box;

 

Visit JavaFX 3D Course Index Page

Muhammed Afsal Villan
Muhammed Afsal Villan is an experienced full-stack developer, specialized in desktop and mobile application development. He also regularly publishes quality tutorials on his YouTube channel named 'Genuine Coder'. He likes to contribute to open-source projects and is always enthusiastic about new technologies.

29 COMMENTS