There are many ways to make a toon shader, and many bells and whistles you can include on it depending on the way you want your game to look. Here's a basic example toon shader with some of the little touches I like to add to my own toon shaders.
The main feature that I'm a big fan of, and I include in every toon shader, is that the light wraps around an object to create a rim light even when the normals shouldn't allow it. When the light is behind the object (dot product of the negated view and light direction), add extra light, masked by a rim mask (dot product of normal and view direction, or use fresnel), to the standard light setup (dot product of normal and light direction). Dot products everywhere! When this is added in before the posterising toon effect, it creates a nice wrap around rim light.
Some other optional added extras are a saturated line on the edge between lit and unlit areas on the mesh, and a shadow colour that is the complementary colour to the light colour. You can see in the gif, when the sphere is untextured, that the yellowish light creates a purplish shadow.
There's also an outline that only shows itself on the side of the mesh facing away from the primary light.
Puck Loves Games
2020-04-17 12:52:26 +0000 UTCPuck Loves Games
2019-07-31 00:29:04 +0000 UTCStrook
2019-07-30 22:39:22 +0000 UTC