(This series of articles is about the capabilities of GViz, a machinima toolkit for UDK.)
The ingame shader for the characters is mostly done.
It can create generic materials:
(Yeah, Victor sometimes resembles another guy also on the ICAO alphabet…)
But it also has features specifically made for virtual actors:
The most apparent of those is the clothing: the different parts of the garment can be independently colored or removed.
To achieve this, the mesh has a second UV set (along with a full unwrap) which maps a small texture of 8 different colors:
Each color identifies a piece of clothing. The shader creates black and white masks from these colors using basic math then blends in the related color parameters of the current material instance.
The order of colors is important: the border between masking colors usually appear in the middle of polygons as opposed to polygon edges. This way the position and shape of the end of clothing pieces are not restricted by the topology of the mesh. You can see that on the zoomed in view of the knee: the shorts has an edge pretty different from the edge flow of the geometry.
The bilinear filtering is turned off so no blending occurs between the colors, as it screws up the mask generation later on.
The arrows show the order of clothing pieces: Black means uncovered skin, white is “cap” (or hair). Red is the T-shirt which has two neighbors, the green long sleeves and the cyan pants, and so on.
Otherwise the character uses 3 more, grayscale textures: diffuse map (only in the case of the camo guy), a cavity map and an accessibility map. The latter is a combination of 3DS Max’s subsurface scattering approximation and ambient occlusion maps.
Another (optional) texture is for the “logo”, some kind of a pattern on the clothes. It’s basically a distance field image baked onto the low poly geometry. The DF was generated from black and white patterns, in this case lines made in Illustrator.
Since it’s a distance field, changing the thickness and border smoothness of the shapes are easy. In theory all the fancy stuff I wrote about earlier could be implemented but I’m not sure it will be necessary.
Now I go back to fix a few things in the geometry then it’s time to make the final skeleton and the skinning.