29 Jan From 3D Model to Cartoon
I’ve been working in the development of a cartoon shader in Blender for NPR (Non Photorealistic Rendering), which I’m going to use for rendering Baby Hell.
After much tweaking the toon shader and the render nodes in Blender, I obtained a pleasing result that looked like this:
But to get this results the shader was not the only thing I had to work with.
Most of the effort was spent in generating UV maps for all the objects, painting nice-looking textures and experimenting with the lights and render nodes to get the best look possible.
Cartoon Shader tested on Characters
The simple models looked fantastic, but how would my “toon recipe” work when applied to more complex shapes?
Well, fortunately I already had a 3D character modeled in Zbrush that I could use for testing.
This model was complex enough to be a good judge of what my toon shader and render nodes could do…
After rigging and posing the character, I got the following result:
I felt very pleased with this result. But again, most of the magic of this image occurred thanks to the textures and the lights in the scene.
To get good results, I had to obliterate the shadows in the material, by using a Sun lamp parented and aligned with the Camera, so the light always shoots at the parts of the model that are facing the viewer.
For the shader itself, I used the Default Toon shader from Blender (not the one for Cycles, but the standard one)
I enabled the Ramp option, and set it to Linear, the Input to Result, and the Blend to Mix.
The trick to get rid of the shadows was to increase the size to 2, but even that won’t get rid of them completely and they will sometimes still be visible in the curved parts (see the girl’s calves for a reference).
To make the remaining shadows look good in the finished render I increased the Emit to 0.3
Having these settings, the material itself can get already a quasy-perfect cartoon look!
Cartoon Shader tested on a Full Scene
O.K! So the character also looked great!
The last test before I could be satisfied with my Toon Shader was to test it in a whole scene.
Of course for this task using just one Sun for lighting would be very dull… But the killer of NPR renders is usually the very 3D-look that the shadows cast by lamps generate.
No problem. I figured out a way of “illuminating” the scene by using Halo materials for the lamps in a separate render layer, which I would later blur and add to the main rendered scene.
This was the result:
I admit I was a little skeptical of what the Blender render nodes and materials could do for me but after seeing all these samples I was pretty much convinced.
What do you think? Does it pass the test?
Final Touch: The Cartoon Lines
I have a thing against the Freestyle render. I just don’t like it.
I watched the Blender Cookie tutorials, but even then, I still can’t get it right.
It seems to me that the calculations of this renderer are somewhat inaccurate, and the contours always look jagged and broken.
It also takes centuries to render. So, yeah… I hate the thing.
I looked on the internet for a friendly solution, and I hit the jackpot when I found the blog of bmania—a great Japanese dude that had all the answers I needed!
From reading some of his posts—gosh that was hard, thank you google translate!—I developed the following render node tree for generating very accurate Cartoon Lines:
These nodes got me where I wanted, but still I think there is room for improvement.
BTW, feel free to use this sheet as reference to make your own NPR in Blender. If you have any question about the nodes, please ask me in the comment section, or check bmania’s blog 🙂
There is however a problem I have not been able to fix.
It seems that the Laplace filter doesn’t work the same way when the object is close to the camera as when is far away, resulting in good static images, but in terrible animations.
I suppose there must be some kind of Input, Converter or Vector nodes that I can use to equalize this filter and fix the problem… But I haven’t had the time to look into it yet.
If you have any idea you can share with me, I would really appreciate it!
But until we figure out what is causing this problem and how to fix it, the node three will have to stay like this…
Join the discussion
What do you think about bmania’s render nodes? Do you think this result looks good enough for NPR?
Have you tried something similar? Can you help me improve my recipe?
I patiently await for your insights!
hank you for reading this post! If you liked the contents, don’t keep it to yourself… Tell your friends! Thanks to your support I can create amazing projects. Check them out on my web/social media and tell me what you think!
See you there!