That's the modelling part finished, the next step I'll deal with is the shaders.
To get the 'cell painted' cartoon look the following shader script is used:
models/players/player_name/texture_name
{
{
map models/players/player_name/texture_name.tga
rgbGen identity
}
{
map models/players/player_name/shade.tga
blendfunc filter
rgbGen identity
tcGen environment
}
}
I'll explain what each of those lines mean. The first line is just the name of the shader. For player models the shader is always named as the texture name, including its full path, but excluding its extension. Replace "texture_name" with the name of the actual texture image you are using. The next two lines tell the game to draw the texture as it is, with no lighting effects. Player model textures are normally drawn with "rgbGen lightingDiffuse" which gives realistic smooth shading, but "rgbGen identity" leaves the texture as it is, with no lighting effects. Here is one of the textures I used for Honey:
Notice that it has no shadows, just flat areas of color. That is because the next stage of the shader applies the shadow effect. This image...
..."shade.tga" is mapped onto the model with environmental mapping (tcGen environment). Environmental mapping is normally used for creating bright reflections, but in this situation instead of using an image to brighten the model, we are using it to shade the model. The "blendfunc filter" line means that the image will only be used to darken the model. So, the white parts of the image have no effect on the model, and the grey parts darken it slightly. This gives a clear 2-tone look to the model - like this...
If you wanted to have 3 shades on your cartoon character then you could use an image like this for "shade.tga"...
I find it is clearer with just one shade tone but you should experiment to see what suits your character best. Also you might not want to use this effect on the face of your character. Oh Honey it looked really bad on her face, something like a 5 o'clock shadow, so I used an extra pass on the shader for the texture that mapped her face...
{
map models/players/player_name/texture_name.tga
rgbgen identity
alphaFunc GE128
}
This script re-draws the original texture over the shaded layer, but through and alpha channel. So your image has to be a 32-bit TGA with and alpha channel masking out all areas except the face (and anywhere else you want re-drawn without shadows). These lines go at the end of the shader script, just before the final brace.
That's it, if you have any questions or comments mail me - cokane at cokane dot com.




July 14th 2000
|