Introduction: Custom Toon Shader in Blender
Ever since I was little I have loved how comics and cartoons looked. The first time I've learned about Cel Shading was when I played Zelda Wind Waker. As I've mentioned on my previous Instructable about Cel Shading Real Life Pictures: "Cel Shading is a type of non-photo-realistic rendering designed to make 3-D computer graphics appear to be flat often to mimic comic books or ink paintings." By using Blender, I could achieve creating this aesthetic of a cartoon appearance in two different ways with two different outcomes. One of these methods was accomplished by using Blender Render and the other Bby using Blender Game.
Step 1: Starter
I started off by opening a new file in Blender, and deleting everything in the scene. Then I added 3 meshes: a plane and 2 spheres and applied a modifier called Subdivision Surface Modifier; this will divide the faces of the mesh giving it a smooth appearance. It is important to do this because that way the shading effect will work better. Then apply a Smooth Shading to the mesh so that it doesn't have rough edges. Then add a Sun Lamp to work out the shading for the next steps.
Step 2: Node's Toon Shader
This is the first method to create a Custom Toon Shader. To work this method I used something called Nodes; Nodes use material, light and background as an input source using a network of shading which outputs values, vectors, colours and shaders. These are the Nodes I've used to create the Toon effect:
- Geometry - Gives geometric information about the current shading point.
- Lamp Data - Obtain information about the lamp type.
- Vector Math - Performs selected math operations.
- ColorRamp - Add a gradient to the color.
- MixRGB - Mixes images by working individual pixels.
- Output - Previews and applies the nodes.
To enable Nodes Editor for the Material of the mesh click the Nodes Icon. I then added a Nodes view to start. I deleted everything except for the Output. Then I added both Geometry and Lamp Data nodes, then add another node called Vector Math. Then plug in Normal from Geometry and Light Vector from Lamp Data to the Vector Math and select from the drop down menu Dot Product.
Add a ColorRamp and connect the Vector Math to the Alpha channel of the the ColorRamp. From this point you can custom the color and the shading, make sure to have the shading diffuses about 0.001 points from is color.
To finish with, add a node called Math and connect the Lamp Data and the ColorRamp with the Color channel to Math. From its drop-down menu select Soft Light. To apply this Material connect the Math node to Output.
Step 3: Blender Render's Toon Shader
Working with Blender Render's material menu is much easier than working with nodes, and can have a similar outcome or better. For this shader I added also an outline effect which gives it more of a cartoon appearance. Blender by default for Diffuse and Secular have Toon effect already.
Create a New Material for the Toon effect. For Diffuse apply Toon, Intensity to be 1, Size to be 1.5 and Smooth to be 0.005. For SpecularHardness must be 0 for it to have no reflection. And for ShadingEmit have it be 0.2, Ambient to be 1 and Translucency to be 0.
Create another Material for the Outline effect. For Diffuse add a black color and for Shading apply Shadeless. Simple enough.
Move on to Edit mode and select All Vertices, Duplicate them by using the Ctrl+D and then form its origin, and then just Scale it little bit. With all the faces selected from the duplicated layer apply the outline material and Flip Normal. When heading on back to Object mode, turn on the Material View and the outline effect will be there. But there is a problem with it; I haven't found a way to do a proper Render of the object without turning the whole sphere black. The image of the sphere with the outline is actually a screenshot of a Blender Game Render. Please, if you've found a method for solving this problem write it down.
Those were the 2 methods for creating Toon Shader. Thank you for reading this Instructable. Hope you've enjoyed it and learned something new.