Godot Version
4.2.1
Question
I am trying to make a simple outline shader to add black outlines around the sprites in my project. My sprites are all 8x8 in actual pixels, and come from sheets where they are packed together. I have been able to find shaders online that are made for this, but all of them have the issue of considering neighboring sprites from the sheet. This causes unwanted effects, as shown in the provided screenshots. The gray feet from the above sprite are visible at the top of the skeleton sprite’s head.
Here are a few shaders I’ve found that produce the same incorrect result:
I don’t have much experience with shaders, so I’m not sure what I should do. It seems that the solutions would either be edit the shader so it pretends the surrounding pixels are blank, or convince godot to treat the sprite as a standalone image before the shader is applied. I’m not sure how to accomplish either of these, though. The same issue happens whether using sprite frames with an AnimatedSprite2D (screenshot above) or an atlas texture with a regular Sprite2D. All of my textures are packed closely together this way, so manually separating them would involve many hours of work.