Wednesday, March 14, 2012

Toon Shading and Paint Effect in Blender

I've been playing around with Blender lately seeing as how it's packed full of up to date features including video editing, compositing, game development, not to mention it's open source and freeware as well ;) One of the main requirements for me was to evaluate Blender to ensure that I can migrate my visual style to it, the 'toon' render style based on Issac Botkin's Painting with Polygons method.

This is how you achieve this effect, very easily, in Blender:




Starting with any object, create a standard blender material


For the texture, you want one of the procedural textures, the animatable properties of which will become important momentarily.

A: I've used "clouds"

B: You want to set IPO keyframes with the "I" key for the Mapping Offset at frame 0 and frame 1. I set it to -10 X at frame 0, and +10 X at frame 1

C , D: You want to set the map's influence to only affect the displacement of the object's verticies.

E: In the curves editor, set the Channel Extrapolation Mode for the keyframes we just set to Cyclic. Now for each frame, it will cycle from -10 to +10 and will repeat each frame.

Now as far as the renderer is concerned, the object will now have the same displacement for each frame, but we are actually animating the displacement on a sub-frame basis.


To get the 'painted' effect out of the renderer, we need to use the Sampled Motion Blur, which combines a number of render passes over a user definable time period. I've typically used 4 or 5 passes depending on the complexity of the scene. Because it is a multipass technique, each render pass increases rendering time. 5 render passes means your render will take 5 times as long. Do this in stereoscopic 3D and you now have 10x the render times as opposed to NOT using this techinque ! :(

The important thing here to remember is that the renderer is taking sub-frame time slices and combining them into one image. If you have moving objects, for whatever reason ( in your animation ;) then they will appear motion blurred (which is ostensibly the original purpose for this feature....) The trick is to use a very fast Shutter speed: I've found that 0.042 frame duration works best. SO... for each frame it's actually combining 5 'slices' over a time period of 0.042 frames. Because we are using the animated texture displacement to move the verticies of the model during that time period, the overlapping render passes combine to create the 'painted' effect. Synchronizing the effect to each frame ensures that the effect will be consistent from frame to frame.


To get the toon shader look, you can use a Ramp on the Diffuse channel, as well as setting the Edge effect in the Post Processing section of the render settings. I also add in a bit of Specular, set to a very soft setting which helps the material catch a little bit of colored lights and which also gives the models a slight 3D effect without completely overwhelming the 2D tooning effect.

2 comments:

Sergof said...

Hi, it's kinda late but have you taken a look at Freestyle?
It's a project that's being integrated into blender and should be interesting for you.
freestyleintegration.wordpress.com

By the way blender isn't "freeware" but I'm just nitpicking.

David T. Krupicz said...

Hey, that looks great... I'll have to check it out.