Making a better Unity toon shader

I’ve been working on a game now for about one month when I stumbled across the idea of cel shading as well as using an outline on my game objects to give a “toon link” + anime/comic book style. While the unity default unlit toon shader worked for a long time, I began to find the flaws in the shader: how the outline hovers above the game object’s outline instead of on it, how for some reason when I apply a toon shadered material on the floor my shadows stop casting on the floor.

I’m just asking for help on how to make, which I have already searched for, or an already made cel shading script which includes shadows, cel shading and and outline (and maybe emission).

If you working with vert/frag shader, you need to add the shadow value to your output color.

You can ref to the example here (Receiving shadows section).

I’m not very experienced with shaders (as in, had about 1 week of google research) so I need some clarification on what to do. Sorry, I’m just new to this. I linked the standard unity toon outline shader and I was just wonder what exactly could I do to make my objects receive shadows and not just cast them (because I use this shader on my floor). Also how can I add an emission modifier, and is there a way to get better outlines because the default unity outline has some graphical errors.

And by the way, thanks for the quick response!

2766861–199903–ToonLitOutline.shader (1.12 KB)

After some more research I have located an asset pack in the asset store which contains the toon shader that looks like the one I want! It is called MK toon (For anyone wondering). I haven’t got a chance to try it out but it looks like exactly what I wanted. Thanks for the support!

If you want full shadows then find this code in MK Toon’s MKToonDefault.shader:

        CGPROGRAM
        #pragma shader_feature _USE_NORMAL_MAP
        #pragma shader_feature _USE_RIM
        #pragma shader_feature _LIGHTMODE_DEFAULT _LIGHTMODE_TRESHOLD _LIGHTMODE_LEVELS
        #pragma shader_feature _USE_SPECULAR
        #pragma shader_feature _USE_CUSTOM_SHADOW
        #pragma shader_feature _USE_M_TEX
        #pragma fragmentoption ARB_precision_hint_fastest
        #pragma surface surf MKToon interpolateview
        #pragma target 2.0

And change to:

        CGPROGRAM
        #pragma shader_feature _USE_NORMAL_MAP
        #pragma shader_feature _USE_RIM
        #pragma shader_feature _LIGHTMODE_DEFAULT _LIGHTMODE_TRESHOLD _LIGHTMODE_LEVELS
        #pragma shader_feature _USE_SPECULAR
        #pragma shader_feature _USE_CUSTOM_SHADOW
        #pragma shader_feature _USE_M_TEX
        #pragma fragmentoption ARB_precision_hint_fastest
        #pragma surface surf MKToon interpolateview fullforwardshadows //added shadows
        #pragma target 2.0

Unfortunately MK Toon has the same outline hover effect though, but at least you get full light and shadow from all light types and can also add normal maps.

Thanks for the response, I’ll see what I can do with the MK Toon shader now.

Hey ! I’m trying to use the MK Toon Shader as well, it’s great for the shadows, but I’m trying to change the outline color and it just doesn’t seem to be working, it remains black even tough there is an option is the shader parameters.

Any idea ? Tip ?