Posted a question in unity answers with no reply, so I am trying now on the appropriate forum:)
Is the shader used for the overdraw effect available somewhere? You can view it in the authoring scene tab , the second drop down is normally set to rgb but you have other options, including overdraw.
I really like this shader, so hopefully, someone can put me in the right direction to build it, as I am not yet very knowledgeable with shaders unfortunately.
Can this be made into an Image Effect? If so, how? I would want this shader to affect everything visible by the camera instead of switching materials of objects at runtime…
No. Quite explicitly this would be impossible as just an image effect. An image effect can only work on the image(s) that has been rendered, and since (presumably) the entire scene wasn’t rendered in flat translucent colors to begin with there’s no way for an image effect to show things that were hidden behind other things in the original image.
However it would be possible using a replacement shader.
Thanks… I’ve achieved what I wanted with a ReplacementShader This will work great for a Stealth game I’m working on. However… Is it possible to make a ReplacementShader only affect certain objects in the scene, or rather ignore certain objects in the scene on a certain Layer or with a certain tag?
Making a whole level using this overdraw effect looks good, but with a lot of models in the scene it kinda makes no sense…
If you don’t want an object to render at all, just make sure it has a tag that isn’t listed in the replacement shader. For example, you could have your replacement shader use a tag name of “Stealth”, then walls would use the value “Stealth”="Wall’, enemies “Stealth”=“Enemy”, etc. Objects you don’t care about don’t get the tag at all, or use a tag value like “Hidden”. This does mean you have to either use custom materials, or assign the tags via script:
If you want to render the scene with the replacement shader, but have some objects render normally, that you can’t do. For that people generally just render the entire scene as is and either manually swap the materials on objects, or they just render everything and then use a replacement shader pass to render on top like this:
I found that video yesterday and it was great. However he forgot to include the modified Standard Shader and the shader he included doesn’t work like it does in the video; i.e the outline is always drawn no matter if the character / object is behind a wall or not so I will try to fix that…
Is it possible to replace/edit the actual shader used by Unity to display scene overdraw? I find a color ramp from green through yellow to red is more intuitive for artists.