Every shape must have a color; otherwise, it would be a black spot in the final
traced scene. To add a color element to a shape, use pigment {} as
follows:
pigment { color rgb< r, g, b > } // RGB code
pigment { color color-name } // color name
You have to add pigment {} within the shape definition. For example,
the following asks for a red sphere with center at the origin and radius 5:
sphere {
0*x, // center at < 0, 0, 0 >
5 // radius is 5
pigment { // color Red here
color Red
}
}
The following asks for a navy blue open cone:
cone {
-y, 2, y, 1 open
pigment { color NavyBlue }
}
The following is a sphere with center < 1, 2, 3 > and radius 10. It is translated, rotated, translated and rotated, followed by coloring it in red.
sphere {
< 1, 2, 3 >, 10
translate < -1, 3, 0 >
rotate 30*z
translate < 5, 3, 1 >
rotate -10*y
pigment { color NeonBlue }
}
The following is the same sphere; but, red color is added first and then
translated, rotated, translated and rotated.
sphere {
< 1, 2, 3 >, 10
pigment { color NeonBlue }
translate < -1, 3, 0 >
rotate 30*z
translate < 5, 3, 1 >
rotate -10*y
}
If pigment {} contains textures, the above could produce two spheres with
different texture pattern.