All in one Cell Shader

Hey everyone, I’ve just finished creating a shader for Blender Internal that creates cell shading. I had followed some tutorials and while they were extremely useful, they didn’t include some of the features that I was looking for. I created this shader as an attempt to mimic the style of the show RWBY, where 3D models are shaded to look 2D. This node tree was inspired by these two tutorials I found which I combined and modified into one shader since they both took a slightly different approach

So, onto the nodes!

So this starts out as toon material with a size of 1 and the smooth set to zero. Then, by using the dot product of the object’s normal and the lamp’s vector, the shadows are simulated. This works fine in most cases however there are some times where there should be shadows but they aren’t there. This is why I mixed this map with the regular shader so the shadows are correct.

Moving onto the colour. The easiest way to do this is to use Vertex Paint because that way every object can have the same material and all that needs doing is changing the vertex paint of each object to the correct colour. A hue, saturation, value node is then used with a mix RGB node to darken the shadowed are using the output of the shadow group as the factor. The value node can be used to set the darkness.

Finally, there is the lamp section. This is the feature I wanted to see. other cell shaders I’ve seen aren’t affected by a lamp’s colour or strength. While this is a stylistic feature, I wanted to add the ability to achieve this. So I used the lamp’s colour as an overlay and the saturation as the factor; the more coloured the light is, the stronger the effect. So for the next image Ive connected the lamp section into the material output.


Next up is the anime outline. There are two ways this can be done, through geometry or through Freestyle. I went down the geometry route as that is what the creators of RWBY did. This is achieved by using a Solidify modifier with the following settings
Solidfy

Notice the Material Index Offset is set to 1. This is important. Now a second material is added to the object, which is a shadeless black material with the Geometry Node’s “Front/Back” output controlling the alpha. This means that only the edges are visible. Remember, this material must not be traceable and have it must have transparency applied

4 Likes

this looks amazing
i v sow the tut before !!! its good, but i found that it has one problem !!!

you have to change the colors of the node setup for every environment !!! day noon night !!! which was really an anoing thing to me

i am not sure about this ,but have you tryd to scale down the himi light along the z axis, it emits the whold objects from all directions with the same value !!! it helps alot

I’m not sure what you mean

1 Like

the first part or the 2nd part !!!

Both really

this type of shading setup only cars about the light source , it doesnt give much attintion for light color or light strength !!! which is good for cartony styles !!!
but it will git hardre if your looking to place your character in defrent invironments where the light changes !!!

i hope this makes sens !!!

Ahh I get you. There is a workaround where you would use a Vector Math node to add multiple lamps, and then a Mix RGB node for the colour. I can’t work out how to do this easily. By combining the shader itself, the shadows work for multiple lamps, it’s the colour that’s the issue. I’ve yet to see anyone figure this out yet

1 Like