< Zurück | Inhalt | Weiter >

10.7 Lighting, material attributes, and per−vertex colors

The Lights in a scene, an object’s material attributes (specifying ambient, emissive, diffuse, and specular color for an object), and the colors that have been assigned to the vertices of an object all interact to produce the final rendered surface.


If lighting or color information is not displayed correctly, note the following points:


If the colors of a GeometryArray are modified at runtime (using setColors) the geometry may also be reset using setGeometry (Java 3D 1.1).

If per−vertex colors have been assigned (using setColors), and a Material has been assigned to

a Shape3D, the per−vertex colors will override the diffuse component of the Material object.

If per−vertex colors have been assigned and a Material has not been assigned, the Shape3D will be unlit and colored solely by the per−vertex colors.


Java 3D 1.2 includes the setIgnoreVertexColors method in the RenderingAttributes class that allows this default behavior to be overridden.