This example shows how to assign color to each polygon by using an index.
#VRML V2.0 utf8 Group { children [ Shape { appearance Appearance { material Material { ambientIntensity 0.1 diffuseColor 1 1 1 } } geometry IndexedFaceSet { coord Coordinate { point [ 0 5 0, -2.5 0 -2.5, 2.5 0 -2.5, 2.5 0 2.5, -2.5 0 2.5 ] } Six colors are defined because there are six triangles making up the pyramid. color Color { color [ 1 1 1, 0 0.5 1, 1 1 0, 1 0 0, 0 1 0, 0 0 1 ] } colorPerVertex FALSE solid FALSE creaseAngle 0.5 coordIndex [ 0, 4, 3, -1, 0, 3, 2, -1, 0, 2, 1, -1, 0, 1, 4, -1, 1, 3, 4, -1, 1, 2, 3, -1 ] The browser picks a color for each polygon according to the order of the color indecies. colorIndex [ 5, 4, 3, 2, 1, 0, -1 ] } } ] }