This example shows how to assign a color to each polygon face in the object.


#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.
The browser picks a color from the list in order.

            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 ]
         }
      }
     ]
}