Control Your Color
Node
Color • Attributes
Description
A cube created with IndexedFaceSet that specifies a Color node. The colorPerVertex field is set to true (default) and a color is defined for each vertex of each face.
VRIGNETTE Notes
Color allows a shape to have multiple colors and gradients. This is different from diffuseColor in Material which defines only one color.
Other Nodes
Example
Rotate the vrignette to view the geometry.
Code
<x3d> <scene> <worldInfo title="X3D Color Example"> </worldInfo> <navigationInfo headlight="true"> </navigationInfo> <viewpoint position="0.0 1.0 15.0" centerOfRotation="0.0 0.0 0.0"> </viewpoint> <transform rotation="1 0 0 0.396"> <shape> <appearance> <material specularColor="0.9 0.9 0.9"> </material> </appearance> <indexedFaceSet solid="false" colorPerVertex="true" coordIndex="0 1 2 3 0 -1 4 5 6 7 4 -1 8 9 10 11 8 -1 12 13 14 15 12 -1 16 17 18 19 16 -1 20 21 22 23 20" colorIndex="0 1 2 3 0 -1 4 5 6 7 4 -1 8 9 10 11 8 -1 12 13 14 15 12 -1 16 17 18 19 16 -1 20 21 22 23 20"> <coordinate point="0.0 0.0 3.0, 3.0 0.0 0.0, 0.0 0.0 -3.0, -3.0 0.0 0.0, 0.0 3.0 3.0, 3.0 3.0 0.0, 0.0 3.0 -3.0, -3.0 3.0 0.0, 0.0 3.0 3.0, 0.0 0.0 3.0, 3.0 0.0 0.0, 3.0 3.0 0.0, 0.0 3.0 -3.0, 0.0 0.0 -3.0, -3.0 0.0 0.0, -3.0 3.0 0.0, -3.0 3.0 0.0, -3.0 0.0 0.0, 0.0 0.0 3.0, 0.0 3.0 3.0, 3.0 3.0 0.0, 3.0 0.0 0.0, 0.0 0.0 -3.0, 0.0 3.0 -3.0"> </coordinate> <color color="1.0 0.0 0.0, 0.85 0.0 0.0, 0.70 0.0 0.0, 0.55 0.0 0.0, 0.0 1.0 0.0, 0.0 0.85 0.0, 0.0 0.70 0.0, 0.0 0.55 0.0, 0.0 0.0 1.0, 0.0 0.0 0.85, 0.0 0.0 0.70, 0.0 0.0 0.55, 1.0 0.647 0.0, 0.85 0.647 0.0, 0.70 0.647 0.0, 0.55 0.647 0.0, 0.498 0.0 1.0, 0.448 0.0 1.0, 0.398 0.0 1.0, 0.348 0.0 1.0, 1.0 1.0 0.0, 0.85 1.0 0.0, 0.70 1.0 0.0, 0.55 1.0 0.0"> </color> </indexedFaceSet> </shape> </transform> <background skyColor="0.20 0.20 0.20" groundColor="0.20 0.20 0.20"> </background> </scene> </x3d>