2D Sprite Rim-Light Shader Guide (Unity URP & Godot 4)
Rim lighting separates your 2D characters and pickups from dark dungeon backgrounds without needing expensive multi-pass blur. By precomputing a distance-field Rim Mask in SpriteNormalizer, your shader can apply directional rim highlights in a single texture lookup.
How the Rim Mask Works
// Pseudo-HLSL / GLSL rim term float rim = tex2D(_RimMask, uv).r; float dirMask = saturate(dot(normalWS.xy, lightDir.xy) * 0.5 + 0.5); color.rgb += _RimColor.rgb * rim * dirMask * _RimIntensity;
Download ready-to-use Unity URP 2D HLSL and Godot 4 .gdshader files in our Pro Batch CLI + Shader Pack.