Baltor Get started

Gallery / Godot shaders

Morphing signed distance shapes

In your harnessGodot shaderMIT

Draw resolution-independent shapes from 2D signed distance functions (circle, rounded box, star, heart) and morph between them over time, with fill, outline, glow and optional distance contour lines.

Render of Morphing signed distance shapes
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
canvas_item
Parameters
fill_color (vec4 = 0.95, 0.45, 0.55, 1), outline_color (vec4 = 1, 1, 1, 1), glow_color (vec4 = 1, 0.5, 0.7, 1), background_color (vec4 = 0.1, 0.08, 0.16, 1), morph_speed (float = 0.4), shape_index (float = 2.5), animate (bool = yes), size (float = 0.3) and 3 more
Use it on
A ColorRect (or any CanvasItem) sized to the area to fill; UVs span 0 to 1 across it.
Result
A pink shape halfway between a star and a heart with a white outline, glow and distance contours.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/sdf_shape_morph_2d/

Limits. The star and heart functions are approximate distances (bounded but not exact), so outlines vary slightly in width. Blending distances does not preserve exact area during a morph.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 78.0 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
2D signed distance functions, Distance blending for morphing, Derivative anti-aliasing of iso-lines
Tags
godot shader, canvas item, sdf, signed distance, morph, vector shapes, ui
Identity
library.supply.creative_originals.9c08a47410d78e2ba0a4e761.9723897ec89ab915
Version
9723897ec89ab9151087de6b85f75f422da1f0838f6911f1bd8630bb275bb80a

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.