"see behind wall" shader

Hello everyone!, I’m trying to write a shader to render a “ghostly” image of an object when it’s behind other geometry. Something like this

https://imgur.com/YwtU856

In this video, Freya Holmer explain how to create this effect in HLSL, Shader Basics, Blending & Textures • Shaders for Game Devs [Part 1] - YouTube

I’m new to GLSL shaders ( I’ve only created shaders in HLSL and with node editors before) so I’m struggling to create the same effect in GLSL

any ideas?

thanks!

@mvaligursky Would we need to do a grab pass for this and check against the depth buffer to do something similar?

In the video above, they seem to raycast from the camera to the object’s center, and based on hit / no-hit they simply swap the material. It does not render half of it normally and half of it behind, always whole object based on the center.

1 Like

You are right, looks like it’s a simple raycast from the camera to the object, no depth buffer testing.

I will try that. Thanks Martin and Steven!

Was there ever a solution for this that was purely shader based, eg without swapping materials based on a raycast, but highlighting just the part of an object that’s obscured by another object?