Magic Circle Shader (Procedural Runes)

A magic circle on one quad: outer rings with tick marks, a ring of rune-like marks turning one way, a six-pointed star turning the other way, a ring of dots and a soft glow in the middle.

Put it on a QuadMesh or PlaneMesh of about 4 x 4 as Material Override. Lay it flat for a summoning circle or stand it up in front of a caster. Animate appear from 0 to 1 and the rings draw in one after another. The runes come from a hash, so a new seed gives you a different circle. The main knobs are rune_count, line_width, rotation_speed and the two colors.

It’s additive and unshaded, so it glows on a dark floor. Turn Glow on. No textures, and it looked the same on Forward+, Mobile and Compatibility in 4.4 and 4.7.

The code was written with the help of an AI coding assistant.

I wrote this as a small take on the magic circles in my Dark Magic, Holy & Arcane VFX pack for Godot 4, which also has curses and spell bolts. The free version is the first link and the full pack is the second.
https://gennai.itch.io/free-magic-bolt-vfx-godot-4?utm_source=godotshaders&utm_medium=referral&utm_campaign=magiccircle
https://gennai.itch.io/magic-spell-vfx-godot-4?utm_source=godotshaders&utm_medium=referral&utm_campaign=magiccircle

Shader code
// Procedural Magic Circle for Godot 4
// MIT License. Copyright (c) 2026 gennai (https://gennai.itch.io)
//
// A magic circle drawn on a single quad: outer rings with tick marks, a ring of rune-like
// marks that turns one way, a two-triangle star that turns the other way, an inner ring of
// dots and a soft glow in the middle. Put it on a MeshInstance3D with a QuadMesh or a
// PlaneMesh (for example 4 x 4) as Geometry > Material Override. Lay it on the floor for
// a summoning circle, or stand it up as a spell cast in front of a character.
//
// Animate appear from 0 to 1 to draw the rings one after another, and back to 0 to
// close them. The runes are made from a hash, so changing seed gives a different circle.
// It is additive and unshaded, so it glows on a dark floor. Values above 1 in
// intensity bloom when Glow is on in the WorldEnvironment.
// No textures: everything is computed in the shader with sin-free hashes, so it looks
// the same on every renderer.
shader_type spatial;
render_mode unshaded, blend_add, depth_draw_never, cull_disabled, shadows_disabled, fog_disabled;

group_uniforms circle;
// 0 = nothing drawn, 1 = fully drawn. Animate this to open and close the circle.
uniform float appear : hint_range(0.0, 1.0) = 1.0;
// Turning speed of the rings, in turns per second. The star turns the other way.
uniform float rotation_speed : hint_range(-1.0, 1.0) = 0.06;
// Number of rune marks in the ring.
uniform int rune_count : hint_range(8, 40) = 24;
// Line thickness.
uniform float line_width : hint_range(0.003, 0.03) = 0.011;
// Changes the runes.
uniform float seed : hint_range(0.0, 100.0) = 0.0;

group_uniforms look;
// Colour of the lines.
uniform vec4 color : source_color = vec4(0.55, 0.3, 1.0, 1.0);
// Colour of the brightest parts and the centre.
uniform vec4 color_hot : source_color = vec4(0.9, 0.8, 1.0, 1.0);
// Brightness. Values above 1 bloom when glow is on.
uniform float intensity : hint_range(0.0, 8.0) = 2.2;
// Soft glow inside the circle.
uniform float fill_glow : hint_range(0.0, 1.0) = 0.35;
// Slow pulse of the brightness.
uniform float pulse : hint_range(0.0, 1.0) = 0.25;

float mc_hash(float p) {
	p = fract(p * 0.1031);
	p *= p + 33.33;
	p *= p + p;
	return fract(p);
}

float mc_line(float d, float w, float aa) {
	return 1.0 - smoothstep(w - aa, w + aa, abs(d));
}

// Signed distance of a regular triangle edge (0 on the edge, negative inside).
float mc_tri(vec2 p, float R) {
	float d = -1e5;
	for (int i = 0; i < 3; i++) {
		float an = float(i) * TAU / 3.0 + PI * 0.5;
		d = max(d, dot(p, vec2(cos(an), sin(an))));
	}
	return d - R * 0.5;
}

vec2 mc_rot(vec2 p, float a) {
	float c = cos(a);
	float s = sin(a);
	return vec2(c * p.x - s * p.y, s * p.x + c * p.y);
}

// How much of a part is drawn: parts open one after another and sweep round the circle.
float mc_reveal(float k, float ang01) {
	float rev = clamp(appear * 5.0 - k, 0.0, 1.0);
	return smoothstep(0.0, 0.06, rev - ang01 * 0.9) * step(0.001, rev);
}

void fragment() {
	vec2 p = (UV - 0.5) * 2.0;
	float r = length(p);
	float aa = max(fwidth(r) * 1.2, 0.0015);
	float ang = atan(p.y, p.x);
	float a01 = fract(ang / TAU + 0.5);
	float spin = TIME * rotation_speed * TAU;
	float w = line_width;
	float v = 0.0;
	float hot = 0.0;

	// outer rings with tick marks between them
	float ring_a = max(mc_line(r - 0.97, w * 1.3, aa), mc_line(r - 0.9, w * 0.7, aa));
	float tick_x = abs(fract((ang + spin * 0.5) / TAU * 90.0) - 0.5);
	float ticks = (1.0 - smoothstep(0.1, 0.16, tick_x)) * step(0.9, r) * step(r, 0.97);
	v += max(ring_a, ticks * 0.8) * mc_reveal(0.0, a01);

	// rune ring: turns one way
	float n = float(rune_count);
	float ar = ang + spin;
	float u = fract(ar / TAU * n);
	float id = floor(ar / TAU * n);
	float vr = (r - 0.68) / 0.16;
	float inside = step(0.0, vr) * step(vr, 1.0);
	float h0 = mc_hash(id + seed * 7.0);
	float h1 = mc_hash(id * 1.7 + seed * 3.0 + 5.0);
	float h2 = mc_hash(id * 2.3 + seed + 11.0);
	float h3 = mc_hash(id * 3.1 + seed * 5.0 + 19.0);
	float rw = w * 6.0 / max(r, 0.2);
	float stem = step(abs(u - 0.5), rw) * step(0.12, vr) * step(vr, 0.88);
	float bar = step(abs(vr - mix(0.3, 0.7, h0)), 0.07) * step(abs(u - 0.5), mix(0.12, 0.3, h1));
	float dot_a = 1.0 - smoothstep(0.08, 0.12, length(vec2((u - 0.5) * 0.9, vr - mix(0.25, 0.8, h2))));
	float dot_m = step(0.5, h3);
	float diag = step(abs((u - 0.5) * 1.6 - (vr - 0.5) * mix(-1.0, 1.0, step(0.5, h1))), 0.1) * step(0.3, h2) * step(abs(u - 0.5), 0.3) * step(0.18, vr) * step(vr, 0.82);
	float runes = max(max(stem, bar), max(dot_a * dot_m, diag * (1.0 - dot_m))) * inside;
	float frame = max(mc_line(r - 0.68, w * 0.6, aa), mc_line(r - 0.84, w * 0.6, aa));
	float rune_all = max(runes, frame);
	v += rune_all * mc_reveal(1.0, 1.0 - a01);

	// two-triangle star: turns the other way
	vec2 ps = mc_rot(p, -spin * 1.5);
	float t1 = mc_line(mc_tri(ps, 0.62), w * 0.9, aa);
	float t2 = mc_line(mc_tri(-ps, 0.62), w * 0.9, aa);
	float star = max(t1, t2) * step(r, 0.64);
	v += star * mc_reveal(2.0, a01);

	// inner ring and dots
	float inner = mc_line(r - 0.3, w * 0.8, aa);
	float dn = 12.0;
	vec2 pd = mc_rot(p, spin * 2.0);
	float da = fract(atan(pd.y, pd.x) / TAU * dn);
	vec2 dp = vec2((da - 0.5) * TAU * 0.22 / dn * 4.0, r - 0.22);
	float dots = 1.0 - smoothstep(0.018, 0.03, length(vec2(dp.x * 1.0, dp.y)) );
	v += max(inner, dots) * mc_reveal(3.0, 1.0 - a01);
	hot += max(inner, dots) * 0.5;

	// centre glow
	float glow = exp(-r * r * 9.0) * clamp(appear * 5.0 - 3.5, 0.0, 1.0);
	float fill = fill_glow * 0.18 * (1.0 - smoothstep(0.85, 0.97, r)) * clamp(appear * 2.0, 0.0, 1.0);
	hot += glow * 0.7;

	float pu = 1.0 - pulse * (0.5 + 0.5 * cos(TIME * 2.2 + r * 5.0));
	vec3 col = mix(color.rgb, color_hot.rgb, clamp(hot + star * 0.35, 0.0, 1.0));
	float total = clamp(v, 0.0, 1.0) + glow * 0.6 + fill;
	ALBEDO = col * total * intensity * pu;
	ALPHA = clamp(total, 0.0, 1.0);
}
Live Preview
Tags
3d, fantasy, glow, glyph, magic circle, ritual, rune, spell, summoning, vfx
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from gennai

Related shaders

Comments 0

No comments yet.