JavaFX 3D Tutorial #11 – Bump Maps for Wringles

JavaFX Bump Maps

In the last chapter, we saw how to create glowing objects with self illumination. In this chapter, we will see about bump mapping in JavaFX.

Bump Maps

According to Wikipedia, Bump mapping is a computer graphics technique for simulating bumps and wrinkles on the surface of an object. Surfaces are not always super smooth. They mostly have some form of deformations. Bump mapping allows to add this extra detail to the surface.

JavaFX PhongMaterial provides option to set bump maps using the method.

public final void setBumpMap(Image value)

Let’s have a look at example code snippet.

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

//Set bump map
material.setBumpMap(new Image(getClass().getResourceAsStream("bumpMap.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.

25 COMMENTS