Most of the materials used in Lair of the Kobolds are greyscale in texture. For instance, here is the world with no coloring applied
Here is a screenshot of the same type of area with coloring
This is done by applying the color to the object in the shader based on the color of the texture.
Coloring the Terrain
The simplest one is the terrain textures. Two colors are applied to it, one color to the dark pixels, a different color to the light pixels, and a blend of those colors in between. In the screenshot above you can see that the grass goes from a green to a yellowish green as those are the two colors applied. The formula for this kind of coloring in a cg shader is: outColor.rgb = texture.rgb * lerp(primaryColor, secondaryColor, readtex.r).
This allows just a few variations in tiles to create vastly different environments. Below is a savanna area created by recoloring the grass and dirt textures.
Coloring the Kobold
The kobold is colored slightly differently. He uses each of his color channels as a map to each of three input colors. The eye is mostly red, meaning that the first color input will have most influence on it. The chest and ears are green which is mapped to the second color, and the rest of the body is mostly blue which maps to a third color. The formula for the kobold’s color in a cg shader is: outColor = texture.r*color1+texture.g*color2+texture.b*color3.
By changing the colors I can get many different kobold variations, as well as create effects such as a chameleon skill that will color the kobold the same as the ground he stands on.