Marching ants selection outline
In your harnessGodot shaderMIT
Mark a selected sprite with the classic animated dashed outline: alternating dark and light dashes move along the edge of the sprite's alpha shape, drawn inside or outside the edge.

What it takes and gives
- Shader type
- canvas_item
- Parameters
- dash_dark (vec4 = 0.05, 0.05, 0.05, 1), dash_light (vec4 = 1, 1, 1, 1), dash_pixels (float = 6), speed (float = 12), width (int = 1), outside (bool = yes), alpha_cutoff (float = 0.5)
- Use it on
- A Sprite2D (or other textured CanvasItem) with transparent space around its shape, assigned to the node as usual.
- Result
- The sprite outlined by small alternating black and white dashes.
- Renderers
- compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
- Placement
- res://baltor/godot_shaders/sprite_marching_ants/
Limits. Dashes follow a screen-space diagonal pattern, not the arc length of the outline, so their spacing varies with edge direction. Effects outside the shape are drawn inside the texture rectangle, so the texture needs a margin.
Details
- Kind
- Godot shader
- Engine
- Godot 4.3 or later
- Files
- 11 files, 67.1 KB
- Licence
- MIT
- Declared effects
- reads files, runs commands
- Checked with
- Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
- Checks
- contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
- Techniques
- Edge detection by neighbourhood alpha comparison, Animated screen-space dash pattern
- Tags
- godot shader, canvas item, selection, marching ants, outline, editor, 2d
- Identity
library.supply.creative_originals.dd468b1b0194b1e4c97a7157.ef1ec02ffd14f1c4- Version
ef1ec02ffd14f1c4b04d772775d67458456f55a3eb03eda6e56fb5ad46c9e5c9
The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.
Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.