Creating a See Through shader

In 3D games is common to see an object being obstructed by another.
This problem can be easily solved with a custom shader.

To start, download this shader.

If you open the file, you can see that is a simple shader, with a basic light.
The ZTest option is Lequal, which makes the object only be rendered if there is no object in front.

In order to have a See Through effect, you must have another pass using the ZTest with Gequal which render's only if there is an object obstructing the view.

Replace the comment that says "Insert the new Pass here" with this:

Return to unity, and everything should be working.

You can read more about Culling and Depth test in the unity manual.

If you like it, please consider supporting me!
This way I can make this kind of content more often 💙  

If you are a 5$+ Patron, you can download the tutorial files here.

Become a patron to

Unlock 6 exclusive posts
Be part of the community
Connect via private message