top of page
Writer's picturefeng jessica

URP Cartoon character shader exercise



involved technology: C#、URP、HLSL


This project is mainly the exercise for Toon shader basic principle under the Unity URP pipeline. I implemented the character outline, cel-shading, and multi-light source shadow of character cartoon rendering under the URP pipeline. The models and textures are from internet open source.




Use the external expansion method to outline, control the width of the outline according to the character’s Z value and the camera’s for value, and the Z offset value to eliminate some unnecessary outlining weight and outline thickness attributes.


The first-order Cel shading is used to set the shadow’s cut-off threshold, and NdotL controls the light. At the same time, use smoothstep function and variables to control the softness and hardness of the shadow.


Traverse multiple light sources and calculate all lighting effects, including self-illumination, indirect light, and direct light; the realization of the shadow is to use ApplyShadowBias() function in the ShadowCaster pass to obtain the special clipping space coordinates for shadow projection, and the Z reverse processing is also required.



23 views0 comments

Recent Posts

See All

Comments


bottom of page