How to do outline and overlay of 3d meshes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By joeyq

In many 3d games (like Overwatch, Cyberpunk 2077, Halo, Apex Legends) you can get a outline and tint overlay of important mesh objects.
In Halo for example enemies are drawn red, friendlies and items blue, special items gold.

The outline and tinted overlay are drawn on top of everything else and also have an alpha so you can see the meshes and material behind it.
These outline and tinted overlays also only should appear when specific criteria is for example the mesh objects are within a specific area or within distance to something.
How do you do this in godot?
An example project would be appreciated.

Take a look there :

I tried to do this, but I can’t pass the limitations. Outline behind wall can be acieved by render_mode depth_test_never, but it can only be true or false, I don’t know how to apply uniform conditions for it. It propably requires overriding DEPTH inside shader

Inces | 2021-12-29 21:50