Pro Java 9 Games Development Leveraging the JavaFX APIs

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

Now that we have created the (easier) specular or bump map effect Image asset, let’s create one with
color to show how a diffuse color map will work. Later, we will use these in conjunction with each other (in
different shader channels) and experiment with what these PhongMaterial properties can do for our pro Java
9 games development.
To make sure your color data is separate from your effect (grayscale) data, select the Color Map layer,
which will turn blue to show it is selected, as shown on the left in Figure 13-10. If you like, you can turn your
Grayscale Map layer’s visibility off by clicking the eye icon at the left side of the layer. In the Position fields,
set 0, 0, and in the Size fields set 32, 256. This will again put the selection at one-eighth span and at the left
side of the canvas. Click the Black color square on the FG/BG color swatch (color selector) to bring up the
color picker dialog and set a green color, as shown in Figure 13-10. Once you click OK, this will set FG Color
to Green, and BG Color will remain White. Use the Edit ➤ Fill with FG Color menu sequence, and fill the
first of four stripes with green. Since the layer is transparent and the background is White, the resulting
composite will be a green-and-white texture map (eventually four alternating color-and-white stripes). Next,
drag the selection 64 pixels to the right and position it for the second stripe fill; then edit the Position fields
to set 64, 0 and leave the Size field set to 32, 256. Use the color picker to set a blue color, and again use the
Edit ➤ Fill with FG Color to create a second blue stripe. Next, drag 64 pixels to the right to position 128 (or
set the Position fields to 128, 0), use a color picker to select a yellow foreground (FG) color, and use Fill with
FG Color to fill your third stripe. Finally, drag the selection to position 192,0 (or set using the Position fields),
use your color picker to select a red foreground (FG) color, and then use the Edit ➤ Fill with FG Color menu
sequence one last time to complete the beach ball color (diffuse, glow) application texture map creation.
Figure 13-10 shows the finished result in GIMP.


Figure 13-10. Create a beach ball texture in the Color Map layer and an on/off (black/white) grayscale
striped texture

Free download pdf