Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 13 ■ 3D MoDel ShaDer Creation: USing the JavaFX 9 phongMaterial ClaSS


I fooled around with this value, changing it and rendering via Run ➤ Project. The default, shown in
Figure 13-5, seems to be around 20, or 20.0d. Changing this value gives very subtle changes; lower numbers
will serve to widen the specular highlight (try a zero setting, but don’t use it in your games other than for
special effects), and high numbers will constrict it to a pinpoint on any curved surface. Flat surfaces will not
be affected much by this, if at all.
Use a Run ➤ Project work process to see how a specularPower setting of 12 will expand a specular highlight.
This can be seen in Figure 13-7.


Figure 13-6. Call the setSpecularPower() method off of the phongMaterial object, passing the double value of 12


Figure 13-7. A specularPower property set to 12 will expand the specular highlight on the surface

Free download pdf