Change confines of a sprite without resizing the sprite itself

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

Hi, I’d like a way to have the overall size of the sprite object increase without actually changing the sprite itself. So for a square sprite, for example the default Godot icon, there would be some empty space between the confines of the sprite object but the texture itself is still the same size.

This will allow me to use shaders to draw an outline around the texture without parts of the outline being cut off, as they only display within the sprites boundaries.

I know I could just edit the image in separate software and reimport it but it would be much more convenient and consistent if I could do it using code within the engine.

If anyone has any advice on how this could be accomplished, or offer alternative ways to create a similar outline effect, this would be greatly appreciated.

Thanks,
tewi

:bust_in_silhouette: Reply From: Dlean Jeans

Check out the Godot’s Sprite Shaders Demo which has an outline shader.
There are also a bunch on Reddit.

Thanks, I’ll have a poke about

tewi | 2019-07-02 22:59