Coloring the World

Most of the materials used in Lair of the Kobolds are greyscale in texture. For instance, here is the world with no coloring applied

Screenshot of lair of the kobolds with no color applied

World with no color

Here is a screenshot of the same type of area with coloring

Screenshot with color applied

World with color

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.

Savanna map

Savanna map created by recoloring 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.

Kobold with unmodified texture colors

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.

Kobolds with a chameleon effect

 

 

This entry was posted in Lair Of The Kobolds. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback.

Leave a Reply

Your email address will not be published. Required fields are marked *

Your email address will never be published.