I came across this site last week : http://ncase.me/sight-and-light/
The effects that are generated on this site interested me and I was interested in trying to recreate them. I found the code online here: https://github.com/ncase/nothing-to-hide/ and was able to work out what it was doing, but it seemed quite complex to me.
It seems like the level’s walls/obstacles have to be hard coded directly into the level and then a ray cast can find the corners of the walls/obstacles and and area can then be mapped out and a shader then sorts out what is foreground and what is background.
I was wondering is this could all be done in a shader. Being without the internet this month has made my search very difficult .. having to rely on my ex to access the internet. I have found a couple of shaders on shadertoy.com and am trying to investigate aspects of them. I have no real results at the moment, but will hope to have something by next week.
If I can’t solve the problem using just a shader, I will use the method of applying a cut out so the shader can correctly show the background. Regardless of which of these methods I will be using, a full report will be available next week.