Occluded sprite's outline

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

I’m trying to make sprites occluded (overlapped) by other sprites to be more visible. For example, like Age of Empires 2 did
sprite outline

I have a vague idea on how to achieve this in a fixed pipeline, this involves stencil buffer. Still I’m not sure if this is possible in godot.

Looking at the image above I’m thinking of the following: when sprite that is marked as an obstacle is draw upon a sprite that is marked as unit, it should draw an outline of unit’s sprite. Alas I have not even a slightest clue on how this could be done. I don’t even know what exactly to google to find something to start with.