Making objects 'see-through', based on objects in front of them

I’m currently prototyping something for a hobby project and I am utterly stuck right out of the gates;
For the Life of me I can’t figure out how I would start to go about solving this issue (I have a photoshop prototype, but I lack ideas how i would do this in an engine), so perhaps you guys have an idea:

I have a plane on which the camera is focused. I also have objects in front of the plane, as well as some behind it. The objects in front of the plane are marked with a flag, and their opacity is 0%.

What i want is this: all of the flagged objects should also make the plane see-through, based on their shape and size relative to the camera.

Do I script this? Or is it code? A Shader? Any ideas where I can start my search? References?

Usually I’d like to think I’m smart enough to google my way to some sort of hacked-together-prototype, but I’m drawing a complete blank on what to even type into the search engine here.

Thanks for the help!

I guess this would be a shader, now I am not an expert (I actually hate shader programming) but if you could render the objects that are infront of the plane into a separate render texture (those objects only - using layers I suppose) and feed that into a shader on the plane - you would know where the objects were and could treat that as some kind of transparency map.

Just a braindump. Probably wrong. but I tried!

1 Like

What you need is the stencil buffer. Here you will find a very detailed answer by supernat, giving you exactly what you need for your project.

4 Likes

Cheers Thomas! That’s spot on what I need.
And thanks for trying, Korno :smile:

2 Likes