Cartoon shading

Blitz3D Forums/Blitz3D Programming/Cartoon shading

http://shawnswift.com/blitz/dtsmashtest.zip

Download this. There's source. It's free to use.

This shows you how to take a simple gradient image and convert it at runtime to a spherical environment map which you can then apply to characters to get a cel shaded look. It also shows you how to make those black outlines.

The cel shaded "glass sphere" effect on the eyes is done with a manually created spherical environment map.


There are limitations with this method. Cubic environment maps weren't in Blitz when I wrote this, or at least weren't on all 3D cards, so it generates spherical environment maps.

The problem with using spherical environment maps for this is that it severely limits the ways in which you can move the camera, because in effect, the light source will be attached to the camera.

If you decide to have the light source directly above the characters, then you can orbit them around the Y axis, but that's the best you can do. You won't be able to move the camera up or down without the light source appearing to move with the camera.

The fix for this should be fairly easy though. I think you need to change the code so that it renders a cubic environment map from INSIDE the cel shaded sphere the program creates to render the spherical environment map. Then you would apply that cubic map to the fullbright model with the right rendering mode for the cubic map. (There are two, I don't know which is the right one.) This will then make it so the light source's direction is always where you want it to be no matter how you move the camera.

Don't email me for support please. :-)