Before the renderer calculates the shading of an object, the surface of that object is divided up into small individual flat surfaces, called micropolygons. Each micropolygon is a single plane. This allows the renderer to calculate a normal for that area of the surface. The size of these micropolygons can be controlled by the Shading Rate in the Render Options Editor. If you decrease the Shading Rate, more smaller micropolygons are generated for the surface and the closer the rendered surface fits the geometrically defined surface. The purpose of the surface shader is to tell the renderer what to color each micropolygon.
The only operation box required for a surface shader is a 'Ci' box:
This is the output color. This single box can actually be a 'surface shader' all by itself; selecting the color value will return a constant color for the entire object, regardless of the scene's lighting.
But it's a little more useful if you take the scene lighting into account. To do this, it's recommended you use one of the pre-defined shader boxes, such as 'plastic':
This box lets you control how the surface color reacts to light at every given micropolygon.
To really have fun, you'll want to change the color procedurally, in other words, control it with a pattern or a math function.
Patterns usually return floating point values which can be used to vary the color of the ambient, diffuse, and specular colors.
Here's an example of a simple plastic shader:
In this case we're controlling the intensity of the diffuse component using the checks pattern. The output value is either 1 or 0, which turns the diffuse intensity on or off. The rendered image looks like:
The black squares are the diffuse intensity at 0, the colored squares are where the diffuse intensity is at 1.
To better demonstrate how the ambient color and specular highlights are affected, here is the same example with the ambient color set to red, and the ambient intensity increased to 0.3:
Note the ambient color and the specular unaffected by the checkered pattern.
(TODO: Insert discussion on texturemapping here)