Using shadows as a mask

Hello, I’m wondering if there is a way to sample a scenes shadows in shader somehow, so that emissive don’t render/or switch off in shadowed areas, thanks!

so sadly there’s no simple way to access if a pixel is in light or shadow, but you can separate out a lighting pass in a post process material - just divide the final render by the base colour and you end up with the lighting only - Post Processing in UE4: Cel-Shading | Live Training | Unreal Engine Livestream - YouTube

it would mean you have to so slightly more complex set up to do your emissive in the first place - probably something with custom depth and/or the stencil buffer - Custom Depth in Unreal Engine 4 - Tom Looman.

it probably wouldn’t work for something super complex but if you were doing some sort of dynamic collectable puzzle using a moving light source that might work?

1 Like

thank you! I’ll give this a shot :slight_smile: