2D outline shader's icon

2D outline shader 1.0.0 Shaders 4.0 Community

Submitted by user Julian-Vos; MIT; 2024-04-01

Adds an outer or inner stroke to a texture. Just attach the shader to a ShaderMaterial and the ShaderMaterial to a Sprite2D or AnimatedSprite2D. Less suitable for textures with anti-aliased edges. Shader parameters:

- color
- width
- pattern (diamond, circle, square)
- inside
- add_margins (to make room for an outline)
- number_of_images (number of horizontal and vertical images in the sprite sheet)

When using a sprite sheet: if the images contain a few semi-transparent pixels from adjacent images, try increasing the 0.0 at lines 41 and 69 to a value like 0.1.


View files Download Submit an issue Recent Edits