Java Reference
In-Depth Information
light = new PointLight(Color.WHITE);
Group group = new Group(sphere, light);
group.setTranslateY(240);
group.setTranslateX(320);
scene = new Scene(group, 640, 480);
}
}
}
In this program, we let a white light shine on a sphere with a diffuse color of blue and a specular color of light
blue with a specular power of 10. The default specular power in PhongMaterial is 32.0. Therefore our sphere does
not have as focused a highlight as the default. When the program in Listing 10-7 is run, the Specular Color Example
window shown in Figure
10-8
is displayed.
Figure 10-8.
The SpecularColorExample program
Adding Texture to 3D Shapes
The
diffuseMap
and the
specularMap
serve the same purpose as the
diffuseColor
and
specularColor
, except
that the maps provide different color values for different points on the surface of a 3D shape. The
bumpMap
and the
selfIlluminationMap
are similarly mapped to the points on the surface of a 3D shape. The
selfIlluminationMap
provides colors that will shine through even if no light is illuminating the 3D object. The
bumpMap
does not contain
color information at all. It contains normal vector information (which just happens to be three numbers, which can
be encoded as an RGB color) for each point of the surface, which, when taken into account during the color rendering
calculation, will result in a bumped look.
Search WWH ::
Custom Search