Quick sub surface scattering solution with Unity URP shader graph.

Sub Surface Scattering is the phenomena when light enters a surface, bounces around and exits the surface. This is seen easiest when you close your eyes and look at the sun, or place a flashlight under your hand. Your skin glows red as the light bounces around inside you.


Adding sub surface scattering (SSS) for your game characters’ skin makes it feel more real. On game characters the SSS effect is mostly seen on the ears. But it does affect things like hair, beard, fingers, nose quite prominently as well. SSS however can be expensive to render. But it can be easily faked! This fake SSS looks good enough and is performant enough to run on mobile phones! This solution has one drawback though: it only supports one directional light. This is plenty for me though!

As usual I started by googling for “SSS for Unity URP”. It was a success as I immediately stumbled upon a really helpful tutorial video on just the thing. The video does not allow instructions for a real SSS solution, but for a very cheap approximation that I could make even better by utilising my custom shadow rendering.

SSS tutorial with a great explanation of what SSS is!

I followed this tutorial until the normal calculation pass before I recognised the technique and went off script from there. I created a new shader graph for character materials.

The basic principle that this SSS solution used was actually the exact same method I used to fake back lighting for the smoke in Pax Dei in Unreal 5, so I knew what to do.

full sub surface scattering shader graph
SSS character material shader graph

Download the shadergraph & the custom lighting HLSL.

I wanted this to support the basic features that Unity’s lit material does, namely basecolor, rgb specular, smoothness from specular alpha, alpha masking, normal map and then the new SSS features, which include SSS intensity SSS normal influence, SSS color and SSS RGB texture.

sub surface scattering shader graph material inputs
SSS character material inputs

I will include a download link to the shader graph in here, so you do not need to recreate based on these images but can simply download the graph. You may need to reapply the custom lighting HLSL code in to the custom node.

SSS shader graph custom lighting node
The custom lighting node

The concept behind the SSS shader is that when the light is facing the camera, we expose the SSS mask texture on the edges of the mesh with a fresnel dot product, as on the edges the light would usually travel shorter period within the volume of the mesh.

Then using the custom lighting node we can hide the SSS shading on the areas that are in shadow. The shadow mask projects trough the mesh, making sure that we do not get light bleed through the material in areas where the light does not hit. With low resolution soft shadows this adds a very nice effect to the SSS, making materials appear thicker and avoids nasty glowing edges when the meshes are in shadow.

When the shadows are soft and the details are small, this feature makes the SSS look really convincing!

sub surface scattering texture
The RGB influence mask for sub surface scattering for the main character

The RGB influence mask for the sub surface scattering effect is simply a copy of the character RGB texture, with all areas without SSS coloured black, and areas with SSS coloured with the SSS color. I left the hair gray, but added a ton of red tint for the skin to mimic light bouncing through the blood inside the skin.

This is a very simple SSS trick. It is completely fake and not at all correct, but it looks very convincing and I am quite happy about it! It does exactly what I want it to do.

Leave a Reply

Your email address will not be published. Required fields are marked *


Social Links