Transparent, but selectively opaque?

I’m attempting to do something along the lines of a “ghost car”, similar to the game Trackmania (see screenshot #1).

Though it’s simple to set up a Standard Shader with a Fade rendering mode, I get an effect where pieces of the same mesh, or set of meshes, are seemingly added on top of it. (see screenshot #2).

What I think I want is for the fade shader to either not also render faded shaders behind it. So it’s transparent to everything, except itself. Simply, I want Unity to do the effect of screenshot 1, not screenshot 2.

I’m a shader newbie, so I’m not sure exactly what effect or setting I should even begin exploring with, so even a point in the right direction would be much appreciated! =) Feel free to prompt me to explain anything further with more questions if required.

Trackmania - The goal


Unity - The current result
2960018--219700--CurrentEffect.PNG

You need a shader that does two passes, one that just writes to depth, and a second that renders the transparency, like this one:

1 Like

did it work? Because the mentioned shader does not work, if you have multiple objects (which even the simplest car has), so assigning the ghost-shader to a complex model like a car does not work.