Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 13 ■ 3D MoDel ShaDer Creation: USing the JavaFX 9 phongMaterial ClaSS

phongMaterial.setSpecularMap(specularMap);
sphere = new Sphere(100, 24);
sphere.setRotationAxis(Rotate.Y_AXIS);
sphere.setRotate( 25 );
sphere.setMaterial(phongMaterial);


It’s time to again use the Run ➤ Project work process and render this shader pipeline into your 3D
Scene. As you can see in Figure 13-16, the specular highlight on the Sphere primitive seems to get cut off
with the line between the yellow and the white color. This is caused by the specular map (turning down
the specular highlight intensity) for alternating areas of the texture map. This can be seen on the Cylinder
primitive as well. You may have noticed by now that I decreased the Camera object distance from the center
of the Scene, from 250 units away to 100 units away, to zoom into the view, and I increased the size of the 3D
primitives so we can see the texture mapping effects more clearly.


Figure 13-15. Add a SpecularMap Image reference to the shader pipeline to control the specular highlight
intensity

Free download pdf