Screen Space Ambient Occlusion - Custom Lighting Models - Episode 9 @BenCloward
Screen Space Ambient Occlusion - Custom Lighting Models - Episode 9  @BenCloward
Uploaded March 2025 | Updated November 2026, 1 day ago
In this shader tutorial, I show how to write the code required to bring screen space ambient occlusion into our custom lighting model in Unity. Once available we can use it in the traditional way to darken the ambient - but we can also use it in other, unique ways to get just the look we're looking for.

Here's the code for the Custom Function node:

#if defined(_SCREEN_SPACE_OCCLUSION) && !defined(_SURFACE_TYPE_TRANSPARENT) && !defined(SHADERGRAPH_PREVIEW)
float ssao = saturate(SampleAmbientOcclusion(ScreenPos) + (1.0 - _AmbientOcclusionParam.x));
IndirectAO = ssao;
DirectAO = lerp(1.0, ssao, _AmbientOcclusionParam.w);
#else
DirectAO = 1.0;
IndirectAO = 1.0;
#endif

Take a look at the playlist for the whole series:
youtube.com/playlist?list=PL78XDi0TS4lGnGa7L2X4o3UV-XYZEKNwj

Here's last week's video on making our custom lighting model modular:
youtu.be/Ak40WLdV3ic

Shader Book Recommendations
bencloward.com/resources_books.shtml

------------------------------

Theme Music
Peace in the Circuitry - Glitch Hop
teknoaxe.com/Link_Code_3.php?q=1526

Background Music
Speo - The Little Things
youtube.com/watch?v=kvCYuyyLgC0

#UnrealEngine #shadergraph #Unity
Screen Space Ambient Occlusion - Custom Lighting Models - Episode 9URP Specular - Custom Lighting Models - Episode 19Interior Mapping - Shader Graph Basics - Episode 34Substrate Car Paint - Unreal Substrate - Episode 9Particle System Soft Edges - Advanced Materials - Episode 54Vertex Lighting - Custom Lighting Models - Episode 2Terrain Advanced Auto Material - Terrain Shaders - Episode 16Random Noise - Shader Graph Basics - Episode 35Simple Button - Procedural Shapes and Patterns - Episode 5Calculating Specular Highlights - Custom Lighting Models - Episode 3Fast Terrain - Terrain Shaders - Episode 5Substrate Puddles - Unreal Substrate - Episode 13
Ben Cloward |

Screen Space Ambient Occlusion - Custom Lighting Models - Episode 9

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER