Toon and Cel Shading in Unity URP
Toon shading, or cel shading, replaces the smooth fall of light across a surface with one or a few hard steps, and chooses the colour of the dark side instead of letting it fade towards black. Give the shadows that land on the model the same hard edge, and you have the cartoon and anime look.

How toon shading works
Section titled “How toon shading works”Every lit shader starts from one number per pixel: how much the surface faces the light, the dot product of its normal and the light direction (N·L), from 1 facing the light to 0 side on and below 0 facing away. A standard shader uses it as it is, so light fades smoothly. A toon shader changes what it does with it:
- A step. Below a threshold the pixel is shaded, above it lit. A narrow soft band at the threshold keeps the edge from looking jagged.
- A ramp. N·L, remapped from 0 to 1, picks a colour from a gradient texture one pixel tall. Hard changes in the gradient become bands, and its dark end is the shade colour.
- A shade colour. The dark side gets a colour you choose, often a cool blue or purple, instead of darkness.
- Received shadows with their own step. The shadow map’s edge is soft. Next to hard light bands a blurry shadow looks out of place, so toon shaders step it too.
- Extras: a rim of light at grazing angles and a hard edged highlight, both stepped the same way.
Toon shading without an asset
Section titled “Toon shading without an asset”In Shader Graph, toon shading means an Unlit graph that does its own lighting, because the Lit graph does URP’s. Shader Graph has no node for the main light, so a Custom Function node calls URP’s GetMainLight(), and the graph steps or ramps the result as above. Received shadows also need the shadow keywords added to the graph. Recent Shader Graph versions save you most of this: Unity 6.3’s Shader Graph has a Custom Lighting sample (Package Manager, Shader Graph, Samples) with a Custom Lighting Toon graph and subgraphs for the main and additional lights, ready to start from. Unity 6.0’s Shader Graph does not have it. Below, two graphs from the demo of All In 1 Shader Nodes, lit by its toon lighting and rim nodes:

In code, the whole idea fits in one URP shader. This one steps N·L into lit or shaded, gives received shadows the same step, and colours the shaded side:
Shader "Custom/SimpleToon"{ Properties { _BaseMap ("Base Map", 2D) = "white" {} _BaseColor ("Base Color", Color) = (1, 1, 1, 1) _ShadeColor ("Shade Color", Color) = (0.35, 0.3, 0.55, 1) _Threshold ("Threshold", Range(0, 1)) = 0.5 _Softness ("Softness", Range(0.001, 0.5)) = 0.02 }
SubShader { Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" }
Pass { Name "ForwardLit" Tags { "LightMode" = "UniversalForward" }
HLSLPROGRAM #pragma vertex vert #pragma fragment frag #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
TEXTURE2D(_BaseMap); SAMPLER(sampler_BaseMap);
CBUFFER_START(UnityPerMaterial) float4 _BaseMap_ST; half4 _BaseColor; half4 _ShadeColor; half _Threshold; half _Softness; CBUFFER_END
struct Attributes { float4 positionOS : POSITION; float3 normalOS : NORMAL; float2 uv : TEXCOORD0; };
struct Varyings { float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; float3 normalWS : TEXCOORD1; float2 uv : TEXCOORD2; };
Varyings vert(Attributes input) { Varyings output; output.positionWS = TransformObjectToWorld(input.positionOS.xyz); output.positionCS = TransformWorldToHClip(output.positionWS); output.normalWS = TransformObjectToWorldNormal(input.normalOS); output.uv = TRANSFORM_TEX(input.uv, _BaseMap); return output; }
half4 frag(Varyings input) : SV_Target { half4 albedo = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv) * _BaseColor; Light light = GetMainLight(TransformWorldToShadowCoord(input.positionWS));
// How much the surface faces the light, from 0 (away) to 1 (towards), stepped into lit or shaded half facing = dot(normalize(input.normalWS), light.direction) * 0.5 + 0.5; half lit = smoothstep(_Threshold - _Softness, _Threshold + _Softness, facing); // Received shadows get the same hard step, so their edges stay crisp too lit *= smoothstep(0.5 - _Softness, 0.5 + _Softness, light.shadowAttenuation);
half3 color = albedo.rgb * lerp(_ShadeColor.rgb, light.color, lit); return half4(color, 1); } ENDHLSL }
// Casting shadows and the depth texture, borrowed from URP's Lit shader UsePass "Universal Render Pipeline/Lit/SHADOWCASTER" UsePass "Universal Render Pipeline/Lit/DEPTHONLY" }}What it leaves out, and what each costs to add: additional lights (a loop over URP’s light list), ambient light and reflections (the shade colour stands in for them), fog, a ramp texture instead of the single step, rim light, and URP’s screen space shadows. Each is a few lines here or a few nodes in a graph, and each is one more thing to keep working across URP versions.
With All In 1 3D Shader
Section titled “With All In 1 3D Shader”Don’t own it yet? → Get it on the Unity Asset Store
Toon shading is a choice of Light Model in the material’s Lighting section, and it combines with every other effect in the shader.

- Toon is the single step. Toon Cutoff sets where light turns to shade, and Toon Smoothness how soft that edge is: the default 0.5 is soft, and values near 0 give the hard cel edge.
- ToonRamp reads a ramp instead, for several bands and a colour per band. Toon Ramp is edited as a gradient right in the material inspector, so its dark end is the shade colour for that material.
The clip at the top of this page shows both, and a three band ramp, while the sun circles.
The rest of the toon look comes from effects that sit next to the light model. Light Models and Effects List cover them all.
- A shade colour for the whole scene: Custom Shadow Color, set with a Shadows Configurator component. The colour is the darkest the main light’s shading can get, so pick a dark one. A saturated colour also tints lit surfaces that are darker than it in its strongest channel, such as warm ground under a purple shade, so in warm scenes a ramp’s dark end is the gentler way to colour the shade. See Shadow Color.
- A hard rim: Rim or Fresnel, with Min Rim and Max Rim close together.
- A hard highlight: Specular Model Toon, or AnisotropicToon for hair.

Crisp shadows that keep the toon look
Section titled “Crisp shadows that keep the toon look”Tick Receive Shadows on every material shadows should land on, and set its Shadow Type to Stylized: Cutoff then decides where the shadow’s edge falls, and the edge is hard. Stylized shadows come from the main directional light only. See Receive Shadows and Stylized Shadows.

With ToonRamp, a received shadow takes the ramp’s darkest colour, the same as the side facing away from the light. Before version 2.8 it landed on the middle of the ramp instead, so on the default ramp cast shadows came out light. Near the edge between light and shade the ramp lets the shadow map in gradually, so the shadow map’s own jagged edge does not show as a band there.
Outlines with toon shading
Section titled “Outlines with toon shading”An outline is usually the other half of the cartoon look. All In 1 3D Shader draws it per model, in the same material; the 3D outlines guide compares that with screen space outlines, and Outlines covers the settings.
Choosing a toon shader
Section titled “Choosing a toon shader”If the toon look is your whole game, dedicated toon assets such as Toony Colors Pro 2, Flat Kit and Quibli, and Unity’s own Toon Shader package, focus on that one look and give it more controls. All In 1 3D Shader’s toon models are one choice among its light models, alongside its other effects in the same material, which suits a game that mixes the toon look with other effects or keeps it to some objects.
What it does not do
Section titled “What it does not do”- HDRP. The 3D Shader supports URP and the Built-in pipeline.
- Stylized shadows from other lights. Point and spot lights, and lightmaps, keep their ordinary shadows.
- A shade colour per light. Custom Shadow Color follows the main light only.
