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

 

 

Posted in Lair Of The Kobolds | Leave a comment

Cavern Painters

Last Week I showed how the skeletons for the dungeons in Lair of the Kobolds are formed. This week I worked on painters to make these dungeons more varied, and the rules that govern the painters. There are currently three kinds of painters: a painter that makes a rectangular room like the basic rooms shown in the last post, a painter that carves a windy cavern corridor between a room’s connections, and a painter that carves a blobby cavern in the room.

A dungeon using room painters

A dungeon using room painters

The dungeon creator figures out which painter to use based on rules. The main route between the entrance and the exit (stairs down in this case) has to be a cavern corridor or cavern room. Any rooms off the main path may get a cavern or rectangle. To create complexes of carved out rectangular rooms like someone lives there, the rectangles can only connect to other rectangles.

Other rules govern the system too, for instance, a dead end may only be a rectangular or cavern room, not a corridor (though some really small dead end rooms right now look like a corridor just ends.)

Eventually the room painters will also do things like insert monsters and objects into the rooms, but these simple painters will do for now.

Posted in Dungeons, Lair Of The Kobolds | Leave a comment