Outlining Shadows in Unreal Engine 4

I’ve done multiple blog posts about rendering outlines in Unreal Engine 4 in the past. So when I had this idea of outlining shadows instead of objects, I figured it would be fun to simply build it as a quick experiment, just like my last Dr. Facilier textured shadows post. I enjoy these unusual experiments and I hope to keep doing them on a regular basis! The experiment’s goal was purely to verify if it was indeed possible to outline a shadow using a surface shader, and it is!

As for the implementation – in case you’re curious – is very similar to the previous post I mentioned. It’s using Unreal Engine 4’s Forward Rendering to retrieve the LightAttenuation buffer in the surface material via a tiny bit of HLSL code. So this is not a post-process effect, as you can see from the white surfaces which do not have any outline on their shadows. For some more information on how this light/shadow buffer can be used I recommend reading the other post. To figure out where to draw the outline I use an approach very similar to my prior outline implementation, instead I sample the LightAttenuation buffer instead of the CustomDepth buffer and compare it to the light attenuation value or nearby pixel. This effect does NOT work in Deferred rendering!

What do YOU think this could be used for? Let me know in the comments!


Comments are closed.