Chimpy Shader
Some guys asked me how we were able to get the chimps monkeys (acutally they’re no chimps, cause chimps don’t have a tail) look so cartoony. The effects for this are very trivial and easy to explain, but here we go:
The basic combination of the shader is a classic “albedo * diffuse + specular” term without any emissive properties. Since we only have only one directional light, we can fake as much as we want to
The diffuse part is a simple lambertian term, but with a small addition. You guys know what I’m talking about:
The standard lambertian term results in values from -1 to 1, which is bad for lighting case 50% of the lit surface will be black (since 0 is totally black). I came across the idea to use the “half lambertian term“:
This inofficial variant - first used by Valve Software in 1998 in Half-Life - has the property to result in values from 0 to 1. Means the lit surface appears more lightened and not overdarkened. But however, this will only result in a standard diffuse ligthing from white to black:
Of course you can tint it by multiplying with the ligths color, but that does not look cartoonish enough. Since the diffuse lighting is in range [0, 1], we can use a 1D texture for tinting the result:
This looks far more cartoonish and still semi-realistic. Furthermore it has the important availability of being artist-tuned. Can’t wait to see it?
But the diffuse ligthing itself doesn’t make a good lighting. And then the monkey still has a helmet that should look more like metal than the skin of a monkey. I have to admit that the helmet doesn’t look metallic in the final result, but we can take that. We use a separate “sfx” texture for scaling different factors on the whole model, like the intensity of specular and rim ligthing. Oh, did i mention rim lighting? Rim lighting has become a must in non-realistic renderings. Refer to Team Fortress 2 or Battlefield: Heros: They all use rim lighting. And so do we:
Note that there is specular lighting on the helmet only
This is due to our magic sfx texture. And one more time - this can be artist-tuned. And my artist likes it
In the end we came up with a little hacky solution. Since we use Parallel Split Shadow Maps for getting some semi-uber-shadows, the whole monkey should be shadowed too. That means we have to scale the specular and rim influence by taking care of the shadowness. In the end this looks satisfying. When the player enters a shadowed area, the specular and rim lighting disappears - guess why?
We also don’t use any filtering method on the shadows dropped onto the monkey. This saves a bit of performance that isn’t mentionable, but you don’t even realize it while playing. The white box shows what I mean.
Please, if you have any further questions or if you’re interested in the code, don’t hestitate to drop us a line
Indies for the win!



Trackback
RSS Feed

There are no comments yet!