Creating an Alpha mask at runtime to simulate shadows

So I read this post and many others like it about creating shadows in 2D games and I really want to recreate this. I understand the ideas behind what they’re doing, but not the specifics of how to accomplish this in UE4. I imagine it probably isn’t possible in blueprint, but I don’t know where to start with creating an alpha mask based on raycasts in C++ and I can’t seem to find any documentation on it, could somebody at least point me in the right direction to get started working on something like this in UE4?

Another method

Have you thought about using a post-process effect where a dynamic light effects shadows in a similar way? However, you then rely on shading and a moving light (attached to your controller). Just a thought.