Pro Java 9 Games Development Leveraging the JavaFX APIs

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

Next, change your setSpecularPower() method call value to 100 (or 100.0d) and then use the Run ➤
Project work process to view your primitives with a higher specular power, which will make them shinier, or
more “glossy,” as you can see in Figure 13-8.


Now that we have covered basic diffuse color and specular color and specular power attributes in the
first part of this chapter, let’s get more advanced and get into applying images created in GIMP to learn
advanced texture mapping using the four texture map effects (bump/normal, diffuse, specular, and glow or
self-illumination) channels.


Using External Image Assets: Creating Texture Maps


The most powerful capabilities of the PhongMaterial class and its algorithms are the four texture map
properties that are supported. This gives you four shader channels to affect your surface color (diffuseMap):
shininess (specularMap), illumination (selfIlluminationMap), and height (bumpMap or normal map). Think
of this kind of like digital image layer compositing, where these four channels will be combined by the Phong
Shader Rendering Algorithm before your specular color and power are applied to the surface (as guided by
your specularMap property Image object, if present in the PhongMaterial shader pipeline).


Using External Third-Party Software: Creating Maps Using GIMP


Java 9 and JavaFX are designed to be flexible enough to allow you to use advanced (professional) third-
party software such as GIMP (digital image compositing), Blender (3D modeling), Fusion (special effects),
Inkscape (SVG content), or Audacity (digital audio editing). Texture maps are usually best crafted and
refined in professional pixel editing and layer compositing software such as the free open source GIMP 2.8
(soon to be GIMP 3.0), which is extremely powerful.


Figure 13-8. A specularPower property set at 100 will actually contract or reduce the specular highlight on the
surface

Free download pdf