3s LoopSweeping violet-cyan spell blade arc with glowing runes, trailing motes, and arena floor bounce.
summoning-circle-ascension-pillar.glsl · 928 lines · GLSL ES 3.00 · MIT
#version 300 es
// Summoning Circle Ascension Pillar (summoning-circle-ascension-pillar.glsl)
// Upstream study: https://github.com/gokayfem/glsl-studies/blob/main/vfx_animated/lib/10_summoning_circle_ascension_pillar.glsl
// License: MIT (Copyright 2026 Gokay Aydogan) + MIT/CC0 helpers — https://pixelfx.io/LICENSE-SHADERS.txt
// Uniforms: uResolution (vec2), uTime (float), uOpen (0..1), uLightMode (0..3), uCamMode (0..1)
precision highp float;
precision highp int;
uniform vec2 uResolution;
uniform float uTime;
uniform float uOpen;
uniform int uLightMode;
uniform int uCamMode;
out vec4 fragColor;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
// ============================================================================
// Math & Procedural Utilities (including Seamless Periodic fBM)
// ============================================================================
mat2 rot2(float a) {
float c = cos(a), s = sin(a);
return mat2(c, -s, s, c);
}
float hash11(float p) {
p = fract(p * 0.1031);
p *= p + 33.33;
p *= p + p;
return fract(p);
}
float hash12(vec2 p) {
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
float vnoise2(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
float a = hash12(i);
float b = hash12(i + vec2(1.0, 0.0));
float c = hash12(i + vec2(0.0, 1.0));
float d = hash12(i + vec2(1.0, 1.0));
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
float fbm2(vec2 p) {
float v = 0.0;
float a = 0.5;
mat2 m = mat2(0.8, 0.6, -0.6, 0.8);
for (int i = 0; i < 4; i++) {
v += a * vnoise2(p);
p = m * p * 2.03 + 17.1;
a *= 0.5;
}
return v;
}
// Tileable 2D value noise with exact integer period -> bit-exact seamless 3.0s animation
float vnoisePeriodic(vec2 p, vec2 period) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
vec2 i00 = mod(i, period);
vec2 i10 = mod(i + vec2(1.0, 0.0), period);
vec2 i01 = mod(i + vec2(0.0, 1.0), period);
vec2 i11 = mod(i + vec2(1.0, 1.0), period);
float a = hash12(i00);
float b = hash12(i10);
float c = hash12(i01);
float d = hash12(i11);
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
// 4-octave tileable fBM: shifting p by phase * period is 100% seamless across all octaves
float fbmPeriodic(vec2 p, vec2 period) {
float v = 0.0;
float a = 0.52;
for (int i = 0; i < 4; i++) {
v += a * vnoisePeriodic(p, period);
p = p * 2.0 + vec2(3.7, 5.1);
period *= 2.0;
a *= 0.5;
}
return v;
}
// ============================================================================
// 2D Geometric SDF Primitives for Arcane Summoning Circle & Floating Sigils
// ============================================================================
float sdRing(float r, float rad, float halfW) {
return abs(r - rad) - halfW;
}
float sdBox2(vec2 p, vec2 b) {
vec2 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0);
}
float sdEqTriangle(vec2 p, float r) {
const float k = 1.73205080757;
p.x = abs(p.x) - r;
p.y = p.y + r / k;
if (p.x + k * p.y > 0.0) p = vec2(p.x - k * p.y, -k * p.x - p.y) * 0.5;
p.x -= clamp(p.x, -2.0 * r, 0.0);
return -length(p) * sign(p.y);
}
float lineMask(float d, float width) {
return smoothstep(width, width * 0.15, abs(d));
}
float lineGlow(float d, float width, float halo) {
float core = smoothstep(width, width * 0.12, abs(d));
float soft = exp(-abs(d) / max(halo, 0.001));
return core + soft * 0.30;
}
// ============================================================================
// Dark Ancient Stone Temple Floor Paving & Relief
// ============================================================================
vec3 stoneFloorPattern(vec2 p) {
float r = length(p);
float th = atan(p.y, p.x);
float ringIdx = floor(r * 1.45);
float ringF = fract(r * 1.45);
float segCount = max(6.0, floor(6.0 + ringIdx * 5.0));
float segShift = hash11(ringIdx * 13.7 + 1.3) * TAU;
float thS = mod(th + segShift, TAU);
float segF = fract(thS / TAU * segCount);
float segIdx = floor(thS / TAU * segCount);
float nWarp = (vnoise2(p * 3.5) - 0.5) * 0.055;
float dRing = min(ringF, 1.0 - ringF) / 1.45;
float dSeg = min(segF, 1.0 - segF) * (TAU * max(r, 0.25) / segCount);
float seamDist = min(dRing, dSeg) + nWarp * 0.28;
float crackN = abs(fbm2(p * 2.8 + vec2(3.1, 7.4)) - 0.5);
float crack = smoothstep(0.020, 0.003, crackN) * smoothstep(0.35, 1.4, r);
float mortar = smoothstep(0.028, 0.004, seamDist);
float bevel = smoothstep(0.004, 0.052, seamDist);
float id = hash12(vec2(ringIdx, segIdx));
float h = bevel * (0.80 + 0.20 * id) - crack * 0.25;
return vec3(clamp(h, 0.0, 1.0), max(mortar, crack * 0.72), id);
}
// ============================================================================
// Arcane Summoning Circle Inscribed on Floor (y = 0)
// ============================================================================
vec3 evaluateSummoningCircle(vec2 p, float phase) {
float ang = phase * TAU;
float r = length(p);
float gold = 0.0;
float cyan = 0.0;
float groove = 0.0;
// Seamless outward radial ignition pulse over 3.0s
float pulseR = fract(phase) * 3.55;
float pulseEnv = sin(phase * PI);
float dPulse = (r - pulseR) * 4.2;
float pulseWave = exp(-(dPulse * dPulse)) * pulseEnv;
float breathe = 0.90 + 0.10 * sin(ang * 2.0);
// Zone 1: Focused Central Pillar Impact Pool & Inner Golden Double Ring
float coreCyan = exp(-r * r * 14.0) * (1.15 + 0.20 * sin(ang * 2.0));
float coreGold = exp(-r * r * 6.5) * (0.65 + 0.15 * sin(ang));
cyan += coreCyan;
gold += coreGold;
vec2 pInner = rot2(ang * 0.25) * p;
float rInner1 = sdRing(r, 0.44, 0.009);
float rInner2 = sdRing(r, 0.52, 0.012);
gold += lineGlow(rInner1, 0.012, 0.032) * 0.95 + lineGlow(rInner2, 0.014, 0.040) * 1.05;
groove = max(groove, max(lineMask(rInner1, 0.016), lineMask(rInner2, 0.018)));
float thIn = atan(pInner.y, pInner.x);
float spokeA = abs(fract(thIn / TAU * 16.0 + 0.5) - 0.5) * (TAU * max(r, 0.1) / 16.0);
float spokeMask = smoothstep(0.26, 0.30, r) * smoothstep(0.46, 0.43, r);
gold += lineMask(spokeA, 0.009) * spokeMask * 0.78;
// Zone 2: Inner Electric-Cyan 8-Pointed Octagram Star (+ang/4)
vec2 pStar = rot2(ang * 0.25) * p;
vec2 pStar45 = rot2(PI * 0.25) * pStar;
float octOuter = min(abs(sdBox2(pStar, vec2(0.84))), abs(sdBox2(pStar45, vec2(0.84))));
float octInner = min(abs(sdBox2(pStar, vec2(0.76))), abs(sdBox2(pStar45, vec2(0.76))));
float cyanStar = lineGlow(octOuter, 0.014, 0.048) * 1.25
+ lineGlow(octInner, 0.009, 0.026) * 0.65;
float thOct = atan(pStar.y, pStar.x);
float octSector = mod(thOct + PI / 8.0, PI / 4.0) - PI / 8.0;
vec2 pOctTip = vec2(cos(octSector), sin(octSector)) * r;
float tipDot = length(pOctTip - vec2(1.188, 0.0));
cyanStar += smoothstep(0.048, 0.012, tipDot) * 1.35 + exp(-tipDot * 18.0) * 0.45;
float rMid0 = sdRing(r, 0.72, 0.010);
gold += lineGlow(rMid0, 0.013, 0.036) * 0.95;
cyan += cyanStar * (1.0 + 0.38 * pulseWave);
groove = max(groove, lineMask(octOuter, 0.020));
// Zone 3: Mid Fiery-Gold Ring + 4 Cardinal Cyan Seal Medallions (-ang/4)
vec2 pMid = rot2(-ang * 0.25) * p;
float rBand1 = sdRing(r, 1.24, 0.011);
float rBand2 = sdRing(r, 1.33, 0.008);
float rBand3 = sdRing(r, 1.88, 0.012);
float rBand4 = sdRing(r, 1.97, 0.016);
gold += lineGlow(rBand1, 0.014, 0.042)
+ lineGlow(rBand2, 0.010, 0.026) * 0.72
+ lineGlow(rBand3, 0.014, 0.042)
+ lineGlow(rBand4, 0.018, 0.058) * 1.25;
groove = max(groove, max(lineMask(rBand1, 0.018), lineMask(rBand4, 0.022)));
float thMid = atan(pMid.y, pMid.x);
float qSector = mod(thMid + PI * 0.25, PI * 0.5) - PI * 0.25;
vec2 pMed = vec2(cos(qSector), sin(qSector)) * r - vec2(1.60, 0.0);
float dMed = length(pMed);
float medOuter = sdRing(dMed, 0.24, 0.010);
float medInner = sdRing(dMed, 0.16, 0.007);
float medCross = min(abs(pMed.x), abs(pMed.y));
float medBox = abs(sdBox2(rot2(PI * 0.25) * pMed, vec2(0.115)));
float medGlow = lineGlow(medOuter, 0.013, 0.042) * 1.25
+ lineGlow(medInner, 0.010, 0.028) * 0.90
+ lineMask(medBox, 0.009) * 0.90
+ lineMask(medCross, 0.008) * smoothstep(0.24, 0.22, dMed) * 0.75
+ smoothstep(0.042, 0.010, dMed) * 1.15;
cyan += medGlow * (1.0 + 0.45 * pulseWave);
groove = max(groove, lineMask(medOuter, 0.018));
float outsideMed = smoothstep(0.25, 0.30, dMed);
float bigOct = min(abs(sdBox2(pMid, vec2(1.38))), abs(sdBox2(rot2(PI * 0.25) * pMid, vec2(1.38))));
float bandMask = smoothstep(1.23, 1.28, r) * smoothstep(1.96, 1.90, r);
gold += lineGlow(bigOct, 0.011, 0.030) * bandMask * outsideMed * 0.95;
float runeAng = fract(thMid / TAU * 48.0);
float runeId = floor(thMid / TAU * 48.0);
float runeOn = step(0.28, hash11(runeId * 19.3 + 4.1));
float runeDash = smoothstep(0.12, 0.24, runeAng) * smoothstep(0.88, 0.76, runeAng);
float runeBand = smoothstep(0.042, 0.014, abs(r - 1.285));
gold += runeDash * runeBand * runeOn * 0.78;
// Zone 4: Outer Golden 12-Pointed Star Crown (+ang/12)
vec2 pCrown = rot2(ang / 12.0) * p;
float thCr = atan(pCrown.y, pCrown.x);
float crSeg = mod(thCr + PI / 12.0, TAU / 12.0) - PI / 12.0;
vec2 pTri = vec2(cos(crSeg), sin(crSeg)) * r - vec2(2.14, 0.0);
float dTri = sdEqTriangle(vec2(pTri.y, -pTri.x), 0.16);
float crownMask = smoothstep(1.96, 2.00, r);
gold += lineGlow(abs(dTri), 0.013, 0.044) * crownMask * 1.15;
groove = max(groove, lineMask(abs(dTri), 0.016) * crownMask);
// Zone 5: Outer Temple Boundary Circle & 6 Satellite Sub-Circles (-ang/6)
vec2 pOut = rot2(-ang / 6.0) * p;
float rOut1 = sdRing(r, 2.68, 0.009);
float rOut2 = sdRing(r, 3.05, 0.011);
float rOut3 = sdRing(r, 3.38, 0.009);
gold += lineGlow(rOut1, 0.011, 0.028) * 0.62
+ lineGlow(rOut2, 0.013, 0.036) * 0.75
+ lineGlow(rOut3, 0.011, 0.028) * 0.52;
float thOut = atan(pOut.y, pOut.x);
float satSec = mod(thOut + PI / 6.0, TAU / 6.0) - PI / 6.0;
vec2 pSat = vec2(cos(satSec), sin(satSec)) * r - vec2(3.05, 0.0);
float dSat = length(pSat);
float satR1 = sdRing(dSat, 0.38, 0.009);
float satR2 = sdRing(dSat, 0.30, 0.007);
float satTri = min(abs(sdEqTriangle(pSat, 0.20)), abs(sdEqTriangle(vec2(pSat.x, -pSat.y), 0.20)));
gold += lineGlow(satR1, 0.012, 0.032) * 0.78
+ lineGlow(satR2, 0.009, 0.024) * 0.60
+ lineMask(satTri, 0.009) * 0.65
+ smoothstep(0.032, 0.009, dSat) * 0.55;
groove = max(groove, lineMask(satR1, 0.014));
float pulseBoost = 1.0 + 0.55 * pulseWave;
gold *= breathe * pulseBoost;
cyan *= (0.94 + 0.06 * cos(ang * 2.0)) * pulseBoost;
return vec3(gold, cyan, groove);
}
// ============================================================================
// Jagged Craggy Levitating Stone Shards (10 Sharp Faceted Rocks in Orbit)
// ============================================================================
struct ShardTransform {
vec3 pos;
float radius;
float angY;
float angX;
float seed;
};
ShardTransform getShard(int i, float phase) {
float fi = float(i);
float ang = phase * TAU;
float baseTheta = fi * 1.24 + 0.42;
float orbitDir = (mod(fi, 2.0) < 0.5) ? 1.0 : -1.0;
float theta = baseTheta + ang * orbitDir;
float hBase = 0.78 + fi * 0.26;
float bob = 0.085 * sin(ang * 2.0 + fi * 1.7);
float radOrbit = 1.22 + 0.46 * sin(fi * 0.88 + 0.35) + 0.05 * cos(ang + fi);
ShardTransform st;
st.pos = vec3(cos(theta) * radOrbit, hBase + bob, sin(theta) * radOrbit);
st.radius = 0.145 + 0.065 * hash11(fi * 7.3 + 2.1);
st.angY = fi * 2.1 + ang * orbitDir;
st.angX = fi * 1.4 + ang;
st.seed = fi * 3.7 + 1.2;
return st;
}
float sdStoneShard(vec3 p, float rad, float seed) {
vec3 q = p / vec3(1.22, 0.74, 0.90);
float d = -1e5;
d = max(d, dot(q, normalize(vec3( 0.85, 0.42, 0.30))) - rad * (0.68 + 0.12 * sin(seed)));
d = max(d, dot(q, normalize(vec3(-0.78, 0.50, -0.36))) - rad * (0.64 + 0.11 * cos(seed * 1.3)));
d = max(d, dot(q, normalize(vec3( 0.24, -0.90, 0.36))) - rad * (0.58 + 0.10 * sin(seed * 2.1)));
d = max(d, dot(q, normalize(vec3(-0.32, -0.44, 0.84))) - rad * (0.66 + 0.10 * cos(seed * 1.7)));
d = max(d, dot(q, normalize(vec3( 0.44, 0.22, -0.86))) - rad * (0.62 + 0.12 * sin(seed * 0.7)));
d = max(d, dot(q, normalize(vec3(-0.62, -0.68, -0.38))) - rad * (0.60 + 0.09 * cos(seed * 2.7)));
d = max(d, dot(q, normalize(vec3( 0.18, 0.94, -0.28))) - rad * (0.56 + 0.10 * sin(seed * 1.9)));
d = max(d, dot(q, normalize(vec3( 0.72, -0.48, -0.49))) - rad * (0.65 + 0.08 * cos(seed * 3.1)));
d = max(d, dot(q, normalize(vec3(-0.88, 0.12, 0.46))) - rad * (0.63 + 0.09 * sin(seed * 2.5)));
float chip1 = abs(sin(q.x * 19.0 + seed) * cos(q.y * 17.0 - seed) + sin(q.z * 21.0)) * 0.011;
float chip2 = abs(sin((q.x + q.z) * 31.0 + seed * 2.0)) * 0.005;
return (d + chip1 - chip2) * 0.68;
}
vec2 mapSceneMat(vec3 p, float phase) {
float r = length(p.xz);
float floorH = 0.0;
if (abs(p.y) < 0.24) {
vec3 tile = stoneFloorPattern(p.xz);
floorH = (tile.x - 0.5) * 0.026 - tile.y * 0.018;
floorH += smoothstep(3.65, 3.80, r) * 0.12;
}
float dFloor = p.y - floorH;
vec2 res = vec2(dFloor, 0.0);
float r2 = dot(p.xz, p.xz);
if (p.y > 0.35 && p.y < 3.75 && r2 < 5.2) {
for (int i = 0; i < 10; i++) {
ShardTransform st = getShard(i, phase);
vec3 dPos = p - st.pos;
float bDist = length(dPos) - st.radius * 1.38;
if (bDist < res.x) {
vec3 lp = dPos;
lp.xz = rot2(st.angY) * lp.xz;
lp.yz = rot2(st.angX) * lp.yz;
float dS = sdStoneShard(lp, st.radius, st.seed);
if (dS < res.x) {
res = vec2(dS, 1.0);
}
}
}
}
return res;
}
float mapScene(vec3 p, float phase) {
return mapSceneMat(p, phase).x;
}
// Unit-sign tetrahedral normal
vec3 calcNormal(vec3 p, float phase) {
const float h = 0.0022;
const vec2 k = vec2(1.0, -1.0);
return normalize(
k.xyy * mapScene(p + k.xyy * h, phase) +
k.yyx * mapScene(p + k.yyx * h, phase) +
k.yxy * mapScene(p + k.yxy * h, phase) +
k.xxx * mapScene(p + k.xxx * h, phase)
);
}
float calcSoftShadow(vec3 ro, vec3 rd, float tMin, float tMax, float phase) {
float res = 1.0;
float t = tMin;
for (int i = 0; i < 16; i++) {
float h = mapScene(ro + rd * t, phase);
if (h < 0.002) return 0.0;
res = min(res, 7.0 * h / t);
t += clamp(h, 0.035, 0.32);
if (t > tMax) break;
}
return clamp(res, 0.0, 1.0);
}
// ============================================================================
// Organic Turbulent Volumetric Golden Ascension Pillar + Wispy Swirling Ribbon
// Zero stipple, zero tape-stripes, zero bounding-cylinder seams!
// ============================================================================
float helixRadius(float y) {
float flare = 0.48 + 0.86 * smoothstep(0.05, 1.60, y) - 0.22 * smoothstep(2.4, 4.3, y);
return flare + 0.14 * sin(y * 1.95);
}
vec2 intersectCylinderY(vec3 ro, vec3 rd, float R) {
float a = dot(rd.xz, rd.xz);
float b = dot(ro.xz, rd.xz);
float c = dot(ro.xz, ro.xz) - R * R;
float disc = b * b - a * c;
if (disc < 0.0 || a < 1e-6) return vec2(1e9, -1e9);
float s = sqrt(disc);
return vec2((-b - s) / a, (-b + s) / a);
}
// Unified smooth volumetric pass: blazing ascension pillar + atmospheric light-beam scatter
// + organic, wispy, domain-warped turbulent golden energy ribbon (48 smooth steps, zero jitter)
vec3 renderOrganicVolumetricVFX(vec3 ro, vec3 rd, float tSolid, float phase, float beamScale, float ribbonScale) {
float ang = phase * TAU;
vec3 acc = vec3(0.0);
// Wide smooth bounding cylinder R = 2.05 (all fields smoothly fade to 0.0 before R = 1.95)
vec2 cyl = intersectCylinderY(ro, rd, 2.05);
float t0 = max(cyl.x, 0.05);
float t1 = min(cyl.y, tSolid);
if (t1 <= t0) return vec3(0.0);
const int STEPS = 48;
float dt = (t1 - t0) / float(STEPS);
float pillarPulse = 1.0 + 0.06 * sin(ang) + 0.03 * sin(ang * 2.0);
float coreRad = 0.145 * pillarPulse;
for (int i = 0; i < STEPS; i++) {
float t = t0 + (float(i) + 0.5) * dt;
vec3 p = ro + rd * t;
if (p.y < 0.01 || p.y > 4.95) continue;
float r = length(p.xz);
float th = atan(p.z, p.x);
// --------------------------------------------------------------------
// 1. Blazing Ascension Pillar + Turbulent Upward Plasma + Atmospheric Scatter
// --------------------------------------------------------------------
if (r < 1.85) {
// Smooth radial fade to exact 0.0 before boundary (zero cylinder edge!)
float rWin = smoothstep(1.85, 0.45, r);
// Seamless upward-streaming turbulent plasma inside the pillar
// Period = (8, 8): theta wraps around 8, y advances by phase * 8.0
vec2 pUV = vec2(th / TAU * 8.0, p.y * 1.45 - phase * 8.0);
float warpP = fbmPeriodic(pUV * 0.75, vec2(6.0, 6.0));
float plasma = fbmPeriodic(pUV + vec2(warpP * 1.1, -warpP * 0.6), vec2(8.0, 8.0));
float baseFlare = 1.0 + 0.48 * exp(-p.y * 3.8);
float rNorm = r / (coreRad * baseFlare);
float hotCore = exp(-rNorm * rNorm * 3.6) * (0.72 + 0.42 * plasma);
float midPlume = exp(-rNorm * rNorm * 0.95) * (0.45 + 0.65 * plasma);
// Rich atmospheric light-beam scatter (soft golden-amber god-ray aura)
float beamScatter = exp(-r * 2.15) * (0.68 + 0.32 * warpP) * rWin;
// Subtle cyan-white impact mist right at the summoning circle center
float baseCyanMist = exp(-p.y * 3.6) * exp(-r * r * 5.2) * (0.7 + 0.4 * plasma);
vec3 pCol = vec3(1.00, 0.97, 0.84) * hotCore * 1.38
+ vec3(1.00, 0.68, 0.16) * midPlume * 0.76
+ vec3(0.95, 0.46, 0.08) * beamScatter * 0.24
+ vec3(0.16, 0.92, 1.00) * baseCyanMist * 0.75;
acc += pCol * dt * 1.65 * beamScale;
}
// --------------------------------------------------------------------
// 2. Organic, Wispy, Turbulent Swirling Volumetric Golden Energy Ribbon
// --------------------------------------------------------------------
if (p.y > 0.04 && p.y < 4.75) {
float rH = helixRadius(p.y);
float dr = r - rH;
if (abs(dr) < 0.46) {
float pitch = 2.40;
// Seamless 2 full helical turns per 3.0s loop
float hAng = p.y * pitch - ang * 2.0;
float dTh = mod(th - hAng + PI, TAU) - PI;
float dy = dTh / pitch;
// Smooth tilted ribbon local frame
float uLoc = dr * 0.88 - dy * 0.47; // thin cross-ribbon thickness
float vLoc = dr * 0.47 + dy * 0.88; // wide sweeping ribbon breadth
// Seamless domain-warped turbulence flowing rapidly along the spiral arc!
// Arc coord advances seamlessly by phase * 8.0 (matches period 8.0)
float arcCoord = p.y * 1.85 - phase * 8.0;
vec2 flowUV = vec2(arcCoord, vLoc * 5.2 + uLoc * 3.5);
float n1 = fbmPeriodic(flowUV * 0.75, vec2(6.0, 6.0));
float n2 = fbmPeriodic(flowUV * vec2(1.0, 2.4) + vec2(n1 * 1.45, -n1 * 1.15), vec2(8.0, 12.0));
// Organic meandering warp of the ribbon sheet (eliminates stiff geometric tape!)
float uWarp = uLoc + (n1 - 0.5) * 0.14;
float vWarp = vLoc + (n2 - 0.5) * 0.16;
// Smooth envelope tapering gracefully at floor base and upper sky
float yEnv = smoothstep(0.04, 0.42, p.y) * smoothstep(4.75, 3.85, p.y);
float drFade = smoothstep(0.46, 0.18, abs(dr));
// (a) Incandescent sinuous plasma heart (pinches & swells organically)
float coreW = 0.032 + 0.022 * n1;
float heart = exp(-(uWarp * uWarp) / 0.0028 - (vWarp * vWarp) / (coreW * coreW));
heart *= (0.55 + 0.85 * smoothstep(0.28, 0.82, n2));
// (b) Wispy turbulent golden plasma tendrils & feathery streaming wisps
float wispEnv = exp(-(uWarp * uWarp) / 0.014 - (vLoc * vLoc) / 0.044);
float wispyFilaments = smoothstep(0.32, 0.85, n2) * (0.55 + 0.45 * n1);
float wisps = wispEnv * wispyFilaments;
// (c) Soft fiery-amber volumetric glow aura enveloping the turbulent stream
float aura = exp(-(uLoc * uLoc) / 0.038 - (vLoc * vLoc) / 0.085) * (0.45 + 0.55 * n1);
// (d) Delicate secondary trailing golden wisp spiraling slightly behind
float dTh2 = mod(th - (hAng + 0.62) + PI, TAU) - PI;
float dy2 = dTh2 / pitch;
float dr2 = r - (rH + 0.13);
float nTrail = fbmPeriodic(vec2(arcCoord + 2.0, dy2 * 7.5), vec2(8.0, 8.0));
float trail = exp(-(dr2 * dr2) / 0.0045 - (dy2 * dy2) / 0.0075) * smoothstep(0.30, 0.82, nTrail);
// Traveling energy surge along the spiral
float surge = 0.80 + 0.25 * sin(p.y * 2.8 - ang * 4.0);
vec3 rCol = vec3(1.00, 0.96, 0.78) * heart * 2.10
+ vec3(1.00, 0.72, 0.18) * wisps * 1.55
+ vec3(0.98, 0.42, 0.05) * aura * 0.42
+ vec3(1.00, 0.82, 0.32) * trail * 1.15;
acc += rCol * yEnv * drFade * surge * dt * 1.95 * ribbonScale;
}
}
}
return acc;
}
// ============================================================================
// Floating Glowing Cyan Holographic Rune Diamonds (3D Planar Quads)
// ============================================================================
float sdFloatingSigil(vec2 uv, int style, float phase) {
float r = length(uv);
float g = 0.0;
if (style == 0) {
vec2 dUV = rot2(PI * 0.25) * uv;
float outerSq = abs(sdBox2(dUV, vec2(0.56)));
float innerSq = abs(sdBox2(dUV, vec2(0.46)));
float innerCirc = abs(r - 0.30);
float centerSq = abs(sdBox2(uv, vec2(0.16)));
float crossL = min(abs(uv.x), abs(uv.y));
float crossMask = smoothstep(0.58, 0.54, max(abs(dUV.x), abs(dUV.y)));
g += lineGlow(outerSq, 0.026, 0.060) * 1.25;
g += lineGlow(innerSq, 0.017, 0.036) * 0.78;
g += lineGlow(innerCirc, 0.020, 0.045) * 1.05;
g += lineMask(centerSq, 0.017) * 0.92;
g += lineMask(crossL, 0.013) * crossMask * 0.72;
g += smoothstep(0.075, 0.018, r) * 1.10;
vec2 cNode = abs(uv) - vec2(0.40, 0.0);
vec2 cNode2 = abs(uv) - vec2(0.0, 0.40);
g += smoothstep(0.060, 0.018, min(length(cNode), length(cNode2))) * 1.15;
} else {
vec2 rUV = rot2(phase * TAU * 0.25) * uv;
float c1 = abs(r - 0.56);
float c2 = abs(r - 0.44);
float c3 = abs(r - 0.20);
float sq = abs(sdBox2(rUV, vec2(0.31)));
float sq2 = abs(sdBox2(rot2(PI * 0.25) * rUV, vec2(0.31)));
g += lineGlow(c1, 0.026, 0.060) * 1.25;
g += lineGlow(c2, 0.017, 0.036) * 0.85;
g += lineGlow(c3, 0.018, 0.042) * 0.95;
g += lineMask(min(sq, sq2), 0.015) * 0.85;
g += smoothstep(0.065, 0.018, r) * 1.05;
}
return g;
}
vec3 renderFloatingRuneDiamonds(vec3 ro, vec3 rd, float tSolid, float phase, float sigilScale) {
float ang = phase * TAU;
vec3 acc = vec3(0.0);
for (int i = 0; i < 6; i++) {
float fi = float(i);
float theta = fi * (TAU / 6.0) + 0.42 + ang * ((mod(fi, 2.0) < 0.5) ? 1.0 : -1.0);
float rad = 1.16 + 0.26 * sin(fi * 1.7 + 0.5);
float yPos = 1.08 + fi * 0.34 + 0.10 * sin(ang * 2.0 + fi * 1.4);
vec3 center = vec3(cos(theta) * rad, yPos, sin(theta) * rad);
vec3 n = normalize(vec3(cos(theta), 0.15, sin(theta)));
float denom = dot(rd, n);
if (abs(denom) < 0.08) continue;
float tPlane = dot(center - ro, n) / denom;
if (tPlane <= 0.1 || tPlane >= tSolid) continue;
vec3 hit = ro + rd * tPlane;
vec3 rel = hit - center;
vec3 right = normalize(cross(vec3(0.0, 1.0, 0.0), n));
vec3 up = cross(n, right);
float size = 0.34 + 0.05 * sin(fi * 2.3);
vec2 uv = vec2(dot(rel, right), dot(rel, up)) / size;
if (max(abs(uv.x), abs(uv.y)) < 1.15) {
int style = (mod(fi, 3.0) > 1.5) ? 1 : 0;
float sig = sdFloatingSigil(uv, style, phase);
float win = smoothstep(1.12, 0.72, length(uv));
float pulse = 0.84 + 0.16 * sin(ang * 2.0 + fi * 1.5);
float facing = 0.58 + 0.42 * abs(denom);
vec3 cyanCol = mix(vec3(0.04, 0.82, 0.98), vec3(0.72, 1.00, 1.00), clamp(sig * 0.40, 0.0, 1.0));
acc += cyanCol * sig * win * pulse * facing * 1.05 * sigilScale;
}
}
return acc;
}
// ============================================================================
// Crisp Pinpoint Ascending Sparks & Fine Glowing Embers (Zero Blurry Ovals)
// ============================================================================
vec3 renderSharpSparks(vec3 ro, vec3 rd, float tSolid, vec2 uv, float phase) {
float ang = phase * TAU;
vec3 col = vec3(0.0);
// 44 crisp tiny pinpoint sparks swarming upward along the helical ribbon & pillar
for (int i = 0; i < 44; i++) {
float fi = float(i);
float life = fract(phase + hash11(fi * 7.13 + 0.5));
float env = sin(life * PI);
float y = 0.18 + life * 4.15;
// Half hug the spiraling golden ribbon, half rise closer to the central pillar
bool nearPillar = (mod(fi, 3.0) < 1.0);
float theta = fi * 2.39996 + y * (nearPillar ? 1.4 : 2.35) - ang * 2.0;
float rJitter = (hash11(fi * 3.7 + 1.1) - 0.5) * (nearPillar ? 0.55 : 0.62);
float r = nearPillar ? (0.35 + abs(rJitter)) : (helixRadius(y) + rJitter);
vec3 spPos = vec3(cos(theta) * r, y, sin(theta) * r);
vec3 toSp = spPos - ro;
float tProj = dot(toSp, rd);
if (tProj > 0.2 && tProj < tSolid) {
vec3 closest = ro + rd * tProj;
vec3 diff = closest - spPos;
// Tight, crisp pinpoint spark with subtle vertical motion stretch
diff.y *= 0.68;
float d2 = dot(diff, diff);
if (d2 < 0.008) {
float twinkle = 0.65 + 0.35 * sin(ang * 3.0 + fi * 4.1);
float core = exp(-d2 * 18500.0);
float halo = exp(-d2 * 3800.0) * 0.42;
vec3 sCol = (mod(fi, 5.0) < 1.0) ? vec3(0.10, 0.94, 1.00) : vec3(1.00, 0.68, 0.12);
col += (vec3(1.00, 0.97, 0.86) * core * 1.4 + sCol * halo) * env * twinkle * 1.65;
}
}
}
// 10 razor-thin dynamic ember streaks near outer edges (matches 10.png motion energy)
for (int i = 0; i < 10; i++) {
float fi = float(i);
float life = fract(phase + hash11(fi * 4.3 + 1.1));
float env = sin(life * PI);
float angle = hash11(fi * 9.7 + 0.3) * TAU;
vec2 dir = vec2(cos(angle), sin(angle) * 0.62 + 0.12);
vec2 pos = dir * (0.36 + life * 0.72);
vec2 d = uv - pos;
vec2 tangent = normalize(dir);
vec2 perp = vec2(-tangent.y, tangent.x);
float along = dot(d, tangent);
float across = dot(d, perp);
float streak = exp(-(along * along) / 0.00042 - (across * across) / 0.0000045);
vec3 eCol = (mod(fi, 3.0) < 1.0) ? vec3(0.12, 0.92, 1.00) : vec3(1.00, 0.60, 0.10);
col += eCol * streak * env * 0.78;
}
return col;
}
// ============================================================================
// ACES Filmic Tonemapping (Rich saturation, <1% clipping)
// ============================================================================
vec3 acesToneMap(vec3 x) {
const float a = 2.51;
const float b = 0.03;
const float c = 2.43;
const float d = 0.59;
const float e = 0.14;
return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 0.975);
}
// ============================================================================
// Main Shader Entry
// ============================================================================
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * uResolution.xy) / uResolution.y;
float phase = fract(uTime / 3.0);
float ang = phase * TAU;
// Camera Framing (uCamMode 0: Hero High-Angle, uCamMode 1: ~2.5x Macro)
vec3 ro, ta;
float fov;
if (uCamMode == 1) {
float sway = 0.06 * sin(ang);
ro = vec3(0.72 + sway, 1.56, 2.42);
ta = vec3(0.16, 0.46, 0.36);
fov = 1.92;
} else {
float sway = 0.09 * sin(ang);
ro = vec3(sway, 3.55, 5.18);
ta = vec3(0.0, 0.95, 0.0);
fov = 1.62;
}
vec3 cw = normalize(ta - ro);
vec3 cu = normalize(cross(cw, vec3(0.0, 1.0, 0.0)));
vec3 cv = cross(cu, cw);
vec3 rd = normalize(cu * uv.x + cv * uv.y + cw * fov);
// Deep Moody Dark Temple Void Backdrop with subtle atmospheric scatter
float bgGrad = clamp(uv.y * 0.7 + 0.45, 0.0, 1.0);
float mist = fbm2(uv * 3.4 + vec2(sin(ang) * 0.10, cos(ang) * 0.07));
vec3 bgCol;
if (uLightMode == 1) {
bgCol = vec3(mix(0.12, 0.18, bgGrad) + mist * 0.02);
} else if (uLightMode == 2) {
bgCol = mix(vec3(0.008, 0.010, 0.013), vec3(0.003, 0.004, 0.006), bgGrad) + mist * 0.003;
} else if (uLightMode == 3) {
float rimGlow = exp(-length(uv - vec2(0.0, 0.18)) * 2.4);
bgCol = mix(vec3(0.006, 0.009, 0.014), vec3(0.0025, 0.0035, 0.0055), bgGrad)
+ vec3(0.055, 0.075, 0.105) * rimGlow;
} else {
float mistBand = exp(-((uv.y - 0.04) * 3.0) * ((uv.y - 0.04) * 3.0));
float centralScatter = exp(-abs(uv.x) * 3.8) * smoothstep(-0.25, 0.55, uv.y);
bgCol = mix(vec3(0.0045, 0.0075, 0.0090), vec3(0.0020, 0.0030, 0.0040), bgGrad)
+ vec3(0.005, 0.014, 0.016) * mist * mistBand
+ vec3(0.028, 0.016, 0.005) * centralScatter * (0.65 + 0.35 * mist);
}
// Primary Raymarch (Stone Temple Floor + Jagged Levitating Stone Shards)
float t = 0.0;
float tMax = 18.0;
float matId = -1.0;
for (int i = 0; i < 64; i++) {
vec3 p = ro + rd * t;
vec2 h = mapSceneMat(p, phase);
if (h.x < 0.002) {
matId = h.y;
break;
}
t += h.x * 0.90;
if (t > tMax) break;
}
float tSolid = (matId >= 0.0) ? t : tMax;
vec3 col = bgCol;
// Surface Shading
if (matId >= 0.0) {
vec3 p = ro + rd * tSolid;
vec3 n = calcNormal(p, phase);
vec3 v = -rd;
float r = length(p.xz);
vec3 albedo;
float rough = 0.72;
vec3 circleEmit = vec3(0.0);
if (matId < 0.5) {
vec3 tile = stoneFloorPattern(p.xz);
float moss = smoothstep(0.62, 0.85, fbm2(p.xz * 2.2 + 4.2)) * tile.y;
float grain = fbm2(p.xz * 12.0);
albedo = mix(vec3(0.024, 0.028, 0.032), vec3(0.052, 0.056, 0.062), tile.z * 0.6 + grain * 0.4);
albedo = mix(albedo, vec3(0.008, 0.009, 0.011), tile.y * 0.82);
albedo = mix(albedo, vec3(0.024, 0.042, 0.018), moss * 0.55);
rough = mix(0.55, 0.92, tile.y);
circleEmit = evaluateSummoningCircle(p.xz, phase);
albedo *= (1.0 - circleEmit.z * 0.45);
} else {
float rockTex = fbm2(p.xz * 8.5 + p.y * 7.5);
albedo = mix(vec3(0.028, 0.030, 0.034), vec3(0.072, 0.068, 0.060), rockTex);
rough = 0.64;
}
vec3 lit = vec3(0.0);
if (uLightMode == 1) {
float grayAlb = dot(albedo, vec3(0.299, 0.587, 0.114)) * 3.4;
vec3 keyDir = normalize(vec3(0.45, 0.78, 0.42));
vec3 fillDir = normalize(vec3(-0.6, 0.45, 0.5));
float sh = calcSoftShadow(p + n * 0.015, keyDir, 0.04, 4.5, phase);
float diff1 = max(dot(n, keyDir), 0.0) * (0.30 + 0.70 * sh);
float diff2 = max(dot(n, fillDir), 0.0) * 0.28;
float fres = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 3.0);
float baseL = grayAlb * (0.30 + diff1 * 1.25 + diff2) + fres * 0.08;
float glyphL = (circleEmit.x * 0.42 + circleEmit.y * 0.34);
lit = vec3(baseL + glyphL * 0.55);
} else {
vec3 keyDir, keyCol, ambCol;
float magicBounceScale = 1.0;
if (uLightMode == 2) {
keyDir = normalize(vec3(0.92, 0.19, 0.34));
keyCol = vec3(1.55, 1.22, 0.88);
ambCol = vec3(0.012, 0.015, 0.019);
magicBounceScale = 0.45;
} else if (uLightMode == 3) {
keyDir = normalize(vec3(-0.20, 0.34, -0.92));
keyCol = vec3(0.95, 1.10, 1.32);
ambCol = vec3(0.008, 0.012, 0.016);
magicBounceScale = 0.55;
} else {
keyDir = normalize(vec3(0.30, 0.85, 0.42));
keyCol = vec3(0.14, 0.18, 0.22);
ambCol = vec3(0.009, 0.013, 0.016);
magicBounceScale = 1.0;
}
float sh = calcSoftShadow(p + n * 0.015, keyDir, 0.04, 4.5, phase);
float ndl = max(dot(n, keyDir), 0.0);
vec3 hVec = normalize(keyDir + v);
float spec = pow(max(dot(n, hVec), 1e-5), mix(42.0, 10.0, rough)) * (1.0 - rough * 0.55);
lit += albedo * (ambCol + keyCol * ndl * (0.20 + 0.80 * sh));
lit += keyCol * spec * 0.24 * sh;
if (uLightMode == 3) {
float rim = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 3.0);
float backAlign = clamp(dot(n, keyDir) * 0.5 + 0.5, 0.0, 1.0);
float rimStrength = (matId > 0.5) ? 1.15 : 0.10;
lit += vec3(0.55, 0.82, 1.05) * rim * (0.35 + 0.85 * backAlign) * rimStrength;
}
vec3 toPillar = vec3(-p.x, max(0.45 - p.y, 0.22), -p.z);
float distP = length(toPillar);
vec3 pDir = toPillar / max(distP, 0.001);
float pAtten = 1.0 / (0.45 + distP * distP * 0.65);
float pDiff = max(dot(n, pDir), 0.0);
vec3 pHalf = normalize(pDir + v);
float pSpec = pow(max(dot(n, pHalf), 1e-5), mix(34.0, 8.0, rough));
vec3 goldLight = vec3(1.00, 0.58, 0.12) * (1.45 + 0.15 * sin(ang * 2.0));
lit += albedo * goldLight * (pDiff * 1.45 + 0.18) * pAtten * magicBounceScale;
lit += goldLight * pSpec * 0.30 * pAtten * magicBounceScale;
float cyanRingDist = abs(r - 1.15);
float cyanAtten = exp(-cyanRingDist * 1.65) * exp(-abs(p.y - 0.30) * 0.85);
vec3 cyanLight = vec3(0.06, 0.86, 1.00);
lit += albedo * cyanLight * (0.45 + 0.55 * max(n.y, 0.0)) * cyanAtten * 0.72 * magicBounceScale;
if (matId > 0.5) {
float shardRim = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 2.4);
float towardPillar = clamp(dot(n, pDir) * 0.75 + 0.25, 0.0, 1.0);
float underCatch = clamp(-n.y * 0.65 + 0.20, 0.0, 1.0);
lit += vec3(1.00, 0.66, 0.16) * (shardRim * towardPillar * 0.90 + underCatch * towardPillar * 0.28) * magicBounceScale;
lit += vec3(0.10, 0.86, 1.00) * max(-n.y, 0.0) * 0.18 * magicBounceScale;
}
if (matId < 0.5) {
float macroCalm = (uCamMode == 1) ? 0.72 : 1.0;
float emitScale = ((uLightMode == 0) ? 1.0 : 0.65) * macroCalm;
vec3 goldCol = mix(vec3(1.00, 0.46, 0.04), vec3(1.00, 0.88, 0.48), clamp(circleEmit.x * 0.45, 0.0, 1.0));
vec3 cyanCol = mix(vec3(0.02, 0.72, 0.96), vec3(0.68, 1.00, 1.00), clamp(circleEmit.y * 0.45, 0.0, 1.0));
lit += goldCol * circleEmit.x * 1.18 * emitScale;
lit += cyanCol * circleEmit.y * 1.15 * emitScale;
}
}
float radialFade = (matId < 0.5) ? smoothstep(3.55, 5.85, r) : 0.0;
float distFog = 1.0 - exp(-max(tSolid - 5.2, 0.0) * 0.14);
float fog = clamp(max(radialFade * 0.92, distFog * 0.72), 0.0, 0.96);
col = mix(lit, bgCol, fog);
}
// Organic Turbulent Volumetric Pillar + Wispy Golden Spiral Ribbon + Cyan Sigils + Sparks
float macroBeamCalm = (uCamMode == 1) ? 0.58 : 1.0;
float beamScale = ((uLightMode == 1) ? 0.24 : ((uLightMode == 0) ? 1.0 : 0.62)) * macroBeamCalm;
float ribbonScale = ((uLightMode == 1) ? 0.46 : ((uLightMode == 0) ? 1.0 : 0.68)) * (uCamMode == 1 ? 0.82 : 1.0);
float sigilScale = ((uLightMode == 1) ? 0.50 : ((uLightMode == 0) ? 1.0 : 0.70));
vec3 volVFX = renderOrganicVolumetricVFX(ro, rd, tSolid, phase, beamScale, ribbonScale);
vec3 sigilsVFX = renderFloatingRuneDiamonds(ro, rd, tSolid, phase, sigilScale);
if (uLightMode == 1) {
float vL = dot(volVFX + sigilsVFX, vec3(0.299, 0.587, 0.114));
col += vec3(vL * 0.80);
} else {
col += volVFX + sigilsVFX;
if (uLightMode == 0) {
col += renderSharpSparks(ro, rd, tSolid, uv, phase);
}
}
// ACES Filmic Tonemapping, Gamma 2.2, & Strict Luminance Bounds
float exposure = (uLightMode == 1) ? 1.02 : 0.96;
col = acesToneMap(col * exposure);
col = pow(max(col, vec3(0.0)), vec3(1.0 / 2.2));
float vig = 1.0 - 0.18 * dot(uv, uv);
col *= clamp(vig, 0.76, 1.0);
col = max(col, vec3(0.024));
col = min(col, vec3(0.985));
if (uLightMode == 1) {
float g = dot(col, vec3(0.299, 0.587, 0.114));
col = vec3(g);
}
col *= (1.0 + 0.0 * uOpen);
fragColor = vec4(col, 1.0);
}
shader_type canvas_item;
// Tip: uncomment the next line for zero-overdraw additive 2D combat/spell glow:
// render_mode blend_add;
// Summoning Circle Ascension Pillar — Godot 4 (canvas_item) wrapper
// Source: https://github.com/gokayfem/glsl-studies/blob/main/vfx_animated/lib/10_summoning_circle_ascension_pillar.glsl (MIT License)
// Drive uTime from GDScript if animating helper functions: material.set_shader_parameter("uTime", Time.get_ticks_msec() * 0.001 * u_speed)
uniform vec2 uResolution = vec2(1024.0, 1024.0);
uniform float uTime = 1.2;
uniform float u_speed : hint_range(0.0, 3.0, 0.05) = 1.0;
uniform float u_tiling : hint_range(0.25, 8.0, 0.25) = 1.0;
uniform vec4 u_tint : source_color = vec4(1.0, 0.722, 0.42, 1.0);
uniform float u_tint_mix : hint_range(0.0, 1.0, 0.01) = 0.0;
uniform float uOpen : hint_range(0.0, 1.0, 0.01) = 0.0;
uniform int uLightMode : hint_range(0, 3, 1) = 0;
uniform int uCamMode : hint_range(0, 1, 1) = 0;
uniform bool u_luma_alpha_key = false;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
// ============================================================================
// Math & Procedural Utilities (including Seamless Periodic fBM)
// ============================================================================
mat2 rot2(float a) {
float c = cos(a), s = sin(a);
return mat2(c, -s, s, c);
}
float hash11(float p) {
p = fract(p * 0.1031);
p *= p + 33.33;
p *= p + p;
return fract(p);
}
float hash12(vec2 p) {
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
float vnoise2(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
float a = hash12(i);
float b = hash12(i + vec2(1.0, 0.0));
float c = hash12(i + vec2(0.0, 1.0));
float d = hash12(i + vec2(1.0, 1.0));
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
float fbm2(vec2 p) {
float v = 0.0;
float a = 0.5;
mat2 m = mat2(0.8, 0.6, -0.6, 0.8);
for (int i = 0; i < 4; i++) {
v += a * vnoise2(p);
p = m * p * 2.03 + 17.1;
a *= 0.5;
}
return v;
}
// Tileable 2D value noise with exact integer period -> bit-exact seamless 3.0s animation
float vnoisePeriodic(vec2 p, vec2 period) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
vec2 i00 = mod(i, period);
vec2 i10 = mod(i + vec2(1.0, 0.0), period);
vec2 i01 = mod(i + vec2(0.0, 1.0), period);
vec2 i11 = mod(i + vec2(1.0, 1.0), period);
float a = hash12(i00);
float b = hash12(i10);
float c = hash12(i01);
float d = hash12(i11);
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
// 4-octave tileable fBM: shifting p by phase * period is 100% seamless across all octaves
float fbmPeriodic(vec2 p, vec2 period) {
float v = 0.0;
float a = 0.52;
for (int i = 0; i < 4; i++) {
v += a * vnoisePeriodic(p, period);
p = p * 2.0 + vec2(3.7, 5.1);
period *= 2.0;
a *= 0.5;
}
return v;
}
// ============================================================================
// 2D Geometric SDF Primitives for Arcane Summoning Circle & Floating Sigils
// ============================================================================
float sdRing(float r, float rad, float halfW) {
return abs(r - rad) - halfW;
}
float sdBox2(vec2 p, vec2 b) {
vec2 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0);
}
float sdEqTriangle(vec2 p, float r) {
const float k = 1.73205080757;
p.x = abs(p.x) - r;
p.y = p.y + r / k;
if (p.x + k * p.y > 0.0) p = vec2(p.x - k * p.y, -k * p.x - p.y) * 0.5;
p.x -= clamp(p.x, -2.0 * r, 0.0);
return -length(p) * sign(p.y);
}
float lineMask(float d, float width) {
return smoothstep(width, width * 0.15, abs(d));
}
float lineGlow(float d, float width, float halo) {
float core = smoothstep(width, width * 0.12, abs(d));
float soft = exp(-abs(d) / max(halo, 0.001));
return core + soft * 0.30;
}
// ============================================================================
// Dark Ancient Stone Temple Floor Paving & Relief
// ============================================================================
vec3 stoneFloorPattern(vec2 p) {
float r = length(p);
float th = atan(p.y, p.x);
float ringIdx = floor(r * 1.45);
float ringF = fract(r * 1.45);
float segCount = max(6.0, floor(6.0 + ringIdx * 5.0));
float segShift = hash11(ringIdx * 13.7 + 1.3) * TAU;
float thS = mod(th + segShift, TAU);
float segF = fract(thS / TAU * segCount);
float segIdx = floor(thS / TAU * segCount);
float nWarp = (vnoise2(p * 3.5) - 0.5) * 0.055;
float dRing = min(ringF, 1.0 - ringF) / 1.45;
float dSeg = min(segF, 1.0 - segF) * (TAU * max(r, 0.25) / segCount);
float seamDist = min(dRing, dSeg) + nWarp * 0.28;
float crackN = abs(fbm2(p * 2.8 + vec2(3.1, 7.4)) - 0.5);
float crack = smoothstep(0.020, 0.003, crackN) * smoothstep(0.35, 1.4, r);
float mortar = smoothstep(0.028, 0.004, seamDist);
float bevel = smoothstep(0.004, 0.052, seamDist);
float id = hash12(vec2(ringIdx, segIdx));
float h = bevel * (0.80 + 0.20 * id) - crack * 0.25;
return vec3(clamp(h, 0.0, 1.0), max(mortar, crack * 0.72), id);
}
// ============================================================================
// Arcane Summoning Circle Inscribed on Floor (y = 0)
// ============================================================================
vec3 evaluateSummoningCircle(vec2 p, float phase) {
float ang = phase * TAU;
float r = length(p);
float gold = 0.0;
float cyan = 0.0;
float groove = 0.0;
// Seamless outward radial ignition pulse over 3.0s
float pulseR = fract(phase) * 3.55;
float pulseEnv = sin(phase * PI);
float dPulse = (r - pulseR) * 4.2;
float pulseWave = exp(-(dPulse * dPulse)) * pulseEnv;
float breathe = 0.90 + 0.10 * sin(ang * 2.0);
// Zone 1: Focused Central Pillar Impact Pool & Inner Golden Double Ring
float coreCyan = exp(-r * r * 14.0) * (1.15 + 0.20 * sin(ang * 2.0));
float coreGold = exp(-r * r * 6.5) * (0.65 + 0.15 * sin(ang));
cyan += coreCyan;
gold += coreGold;
vec2 pInner = rot2(ang * 0.25) * p;
float rInner1 = sdRing(r, 0.44, 0.009);
float rInner2 = sdRing(r, 0.52, 0.012);
gold += lineGlow(rInner1, 0.012, 0.032) * 0.95 + lineGlow(rInner2, 0.014, 0.040) * 1.05;
groove = max(groove, max(lineMask(rInner1, 0.016), lineMask(rInner2, 0.018)));
float thIn = atan(pInner.y, pInner.x);
float spokeA = abs(fract(thIn / TAU * 16.0 + 0.5) - 0.5) * (TAU * max(r, 0.1) / 16.0);
float spokeMask = smoothstep(0.26, 0.30, r) * smoothstep(0.46, 0.43, r);
gold += lineMask(spokeA, 0.009) * spokeMask * 0.78;
// Zone 2: Inner Electric-Cyan 8-Pointed Octagram Star (+ang/4)
vec2 pStar = rot2(ang * 0.25) * p;
vec2 pStar45 = rot2(PI * 0.25) * pStar;
float octOuter = min(abs(sdBox2(pStar, vec2(0.84))), abs(sdBox2(pStar45, vec2(0.84))));
float octInner = min(abs(sdBox2(pStar, vec2(0.76))), abs(sdBox2(pStar45, vec2(0.76))));
float cyanStar = lineGlow(octOuter, 0.014, 0.048) * 1.25
+ lineGlow(octInner, 0.009, 0.026) * 0.65;
float thOct = atan(pStar.y, pStar.x);
float octSector = mod(thOct + PI / 8.0, PI / 4.0) - PI / 8.0;
vec2 pOctTip = vec2(cos(octSector), sin(octSector)) * r;
float tipDot = length(pOctTip - vec2(1.188, 0.0));
cyanStar += smoothstep(0.048, 0.012, tipDot) * 1.35 + exp(-tipDot * 18.0) * 0.45;
float rMid0 = sdRing(r, 0.72, 0.010);
gold += lineGlow(rMid0, 0.013, 0.036) * 0.95;
cyan += cyanStar * (1.0 + 0.38 * pulseWave);
groove = max(groove, lineMask(octOuter, 0.020));
// Zone 3: Mid Fiery-Gold Ring + 4 Cardinal Cyan Seal Medallions (-ang/4)
vec2 pMid = rot2(-ang * 0.25) * p;
float rBand1 = sdRing(r, 1.24, 0.011);
float rBand2 = sdRing(r, 1.33, 0.008);
float rBand3 = sdRing(r, 1.88, 0.012);
float rBand4 = sdRing(r, 1.97, 0.016);
gold += lineGlow(rBand1, 0.014, 0.042)
+ lineGlow(rBand2, 0.010, 0.026) * 0.72
+ lineGlow(rBand3, 0.014, 0.042)
+ lineGlow(rBand4, 0.018, 0.058) * 1.25;
groove = max(groove, max(lineMask(rBand1, 0.018), lineMask(rBand4, 0.022)));
float thMid = atan(pMid.y, pMid.x);
float qSector = mod(thMid + PI * 0.25, PI * 0.5) - PI * 0.25;
vec2 pMed = vec2(cos(qSector), sin(qSector)) * r - vec2(1.60, 0.0);
float dMed = length(pMed);
float medOuter = sdRing(dMed, 0.24, 0.010);
float medInner = sdRing(dMed, 0.16, 0.007);
float medCross = min(abs(pMed.x), abs(pMed.y));
float medBox = abs(sdBox2(rot2(PI * 0.25) * pMed, vec2(0.115)));
float medGlow = lineGlow(medOuter, 0.013, 0.042) * 1.25
+ lineGlow(medInner, 0.010, 0.028) * 0.90
+ lineMask(medBox, 0.009) * 0.90
+ lineMask(medCross, 0.008) * smoothstep(0.24, 0.22, dMed) * 0.75
+ smoothstep(0.042, 0.010, dMed) * 1.15;
cyan += medGlow * (1.0 + 0.45 * pulseWave);
groove = max(groove, lineMask(medOuter, 0.018));
float outsideMed = smoothstep(0.25, 0.30, dMed);
float bigOct = min(abs(sdBox2(pMid, vec2(1.38))), abs(sdBox2(rot2(PI * 0.25) * pMid, vec2(1.38))));
float bandMask = smoothstep(1.23, 1.28, r) * smoothstep(1.96, 1.90, r);
gold += lineGlow(bigOct, 0.011, 0.030) * bandMask * outsideMed * 0.95;
float runeAng = fract(thMid / TAU * 48.0);
float runeId = floor(thMid / TAU * 48.0);
float runeOn = step(0.28, hash11(runeId * 19.3 + 4.1));
float runeDash = smoothstep(0.12, 0.24, runeAng) * smoothstep(0.88, 0.76, runeAng);
float runeBand = smoothstep(0.042, 0.014, abs(r - 1.285));
gold += runeDash * runeBand * runeOn * 0.78;
// Zone 4: Outer Golden 12-Pointed Star Crown (+ang/12)
vec2 pCrown = rot2(ang / 12.0) * p;
float thCr = atan(pCrown.y, pCrown.x);
float crSeg = mod(thCr + PI / 12.0, TAU / 12.0) - PI / 12.0;
vec2 pTri = vec2(cos(crSeg), sin(crSeg)) * r - vec2(2.14, 0.0);
float dTri = sdEqTriangle(vec2(pTri.y, -pTri.x), 0.16);
float crownMask = smoothstep(1.96, 2.00, r);
gold += lineGlow(abs(dTri), 0.013, 0.044) * crownMask * 1.15;
groove = max(groove, lineMask(abs(dTri), 0.016) * crownMask);
// Zone 5: Outer Temple Boundary Circle & 6 Satellite Sub-Circles (-ang/6)
vec2 pOut = rot2(-ang / 6.0) * p;
float rOut1 = sdRing(r, 2.68, 0.009);
float rOut2 = sdRing(r, 3.05, 0.011);
float rOut3 = sdRing(r, 3.38, 0.009);
gold += lineGlow(rOut1, 0.011, 0.028) * 0.62
+ lineGlow(rOut2, 0.013, 0.036) * 0.75
+ lineGlow(rOut3, 0.011, 0.028) * 0.52;
float thOut = atan(pOut.y, pOut.x);
float satSec = mod(thOut + PI / 6.0, TAU / 6.0) - PI / 6.0;
vec2 pSat = vec2(cos(satSec), sin(satSec)) * r - vec2(3.05, 0.0);
float dSat = length(pSat);
float satR1 = sdRing(dSat, 0.38, 0.009);
float satR2 = sdRing(dSat, 0.30, 0.007);
float satTri = min(abs(sdEqTriangle(pSat, 0.20)), abs(sdEqTriangle(vec2(pSat.x, -pSat.y), 0.20)));
gold += lineGlow(satR1, 0.012, 0.032) * 0.78
+ lineGlow(satR2, 0.009, 0.024) * 0.60
+ lineMask(satTri, 0.009) * 0.65
+ smoothstep(0.032, 0.009, dSat) * 0.55;
groove = max(groove, lineMask(satR1, 0.014));
float pulseBoost = 1.0 + 0.55 * pulseWave;
gold *= breathe * pulseBoost;
cyan *= (0.94 + 0.06 * cos(ang * 2.0)) * pulseBoost;
return vec3(gold, cyan, groove);
}
// ============================================================================
// Jagged Craggy Levitating Stone Shards (10 Sharp Faceted Rocks in Orbit)
// ============================================================================
struct ShardTransform {
vec3 pos;
float radius;
float angY;
float angX;
float seed;
};
ShardTransform getShard(int i, float phase) {
float fi = float(i);
float ang = phase * TAU;
float baseTheta = fi * 1.24 + 0.42;
float orbitDir = (mod(fi, 2.0) < 0.5) ? 1.0 : -1.0;
float theta = baseTheta + ang * orbitDir;
float hBase = 0.78 + fi * 0.26;
float bob = 0.085 * sin(ang * 2.0 + fi * 1.7);
float radOrbit = 1.22 + 0.46 * sin(fi * 0.88 + 0.35) + 0.05 * cos(ang + fi);
ShardTransform st;
st.pos = vec3(cos(theta) * radOrbit, hBase + bob, sin(theta) * radOrbit);
st.radius = 0.145 + 0.065 * hash11(fi * 7.3 + 2.1);
st.angY = fi * 2.1 + ang * orbitDir;
st.angX = fi * 1.4 + ang;
st.seed = fi * 3.7 + 1.2;
return st;
}
float sdStoneShard(vec3 p, float rad, float seed) {
vec3 q = p / vec3(1.22, 0.74, 0.90);
float d = -1e5;
d = max(d, dot(q, normalize(vec3( 0.85, 0.42, 0.30))) - rad * (0.68 + 0.12 * sin(seed)));
d = max(d, dot(q, normalize(vec3(-0.78, 0.50, -0.36))) - rad * (0.64 + 0.11 * cos(seed * 1.3)));
d = max(d, dot(q, normalize(vec3( 0.24, -0.90, 0.36))) - rad * (0.58 + 0.10 * sin(seed * 2.1)));
d = max(d, dot(q, normalize(vec3(-0.32, -0.44, 0.84))) - rad * (0.66 + 0.10 * cos(seed * 1.7)));
d = max(d, dot(q, normalize(vec3( 0.44, 0.22, -0.86))) - rad * (0.62 + 0.12 * sin(seed * 0.7)));
d = max(d, dot(q, normalize(vec3(-0.62, -0.68, -0.38))) - rad * (0.60 + 0.09 * cos(seed * 2.7)));
d = max(d, dot(q, normalize(vec3( 0.18, 0.94, -0.28))) - rad * (0.56 + 0.10 * sin(seed * 1.9)));
d = max(d, dot(q, normalize(vec3( 0.72, -0.48, -0.49))) - rad * (0.65 + 0.08 * cos(seed * 3.1)));
d = max(d, dot(q, normalize(vec3(-0.88, 0.12, 0.46))) - rad * (0.63 + 0.09 * sin(seed * 2.5)));
float chip1 = abs(sin(q.x * 19.0 + seed) * cos(q.y * 17.0 - seed) + sin(q.z * 21.0)) * 0.011;
float chip2 = abs(sin((q.x + q.z) * 31.0 + seed * 2.0)) * 0.005;
return (d + chip1 - chip2) * 0.68;
}
vec2 mapSceneMat(vec3 p, float phase) {
float r = length(p.xz);
float floorH = 0.0;
if (abs(p.y) < 0.24) {
vec3 tile = stoneFloorPattern(p.xz);
floorH = (tile.x - 0.5) * 0.026 - tile.y * 0.018;
floorH += smoothstep(3.65, 3.80, r) * 0.12;
}
float dFloor = p.y - floorH;
vec2 res = vec2(dFloor, 0.0);
float r2 = dot(p.xz, p.xz);
if (p.y > 0.35 && p.y < 3.75 && r2 < 5.2) {
for (int i = 0; i < 10; i++) {
ShardTransform st = getShard(i, phase);
vec3 dPos = p - st.pos;
float bDist = length(dPos) - st.radius * 1.38;
if (bDist < res.x) {
vec3 lp = dPos;
lp.xz = rot2(st.angY) * lp.xz;
lp.yz = rot2(st.angX) * lp.yz;
float dS = sdStoneShard(lp, st.radius, st.seed);
if (dS < res.x) {
res = vec2(dS, 1.0);
}
}
}
}
return res;
}
float mapScene(vec3 p, float phase) {
return mapSceneMat(p, phase).x;
}
// Unit-sign tetrahedral normal
vec3 calcNormal(vec3 p, float phase) {
const float h = 0.0022;
const vec2 k = vec2(1.0, -1.0);
return normalize(
k.xyy * mapScene(p + k.xyy * h, phase) +
k.yyx * mapScene(p + k.yyx * h, phase) +
k.yxy * mapScene(p + k.yxy * h, phase) +
k.xxx * mapScene(p + k.xxx * h, phase)
);
}
float calcSoftShadow(vec3 ro, vec3 rd, float tMin, float tMax, float phase) {
float res = 1.0;
float t = tMin;
for (int i = 0; i < 16; i++) {
float h = mapScene(ro + rd * t, phase);
if (h < 0.002) return 0.0;
res = min(res, 7.0 * h / t);
t += clamp(h, 0.035, 0.32);
if (t > tMax) break;
}
return clamp(res, 0.0, 1.0);
}
// ============================================================================
// Organic Turbulent Volumetric Golden Ascension Pillar + Wispy Swirling Ribbon
// Zero stipple, zero tape-stripes, zero bounding-cylinder seams!
// ============================================================================
float helixRadius(float y) {
float flare = 0.48 + 0.86 * smoothstep(0.05, 1.60, y) - 0.22 * smoothstep(2.4, 4.3, y);
return flare + 0.14 * sin(y * 1.95);
}
vec2 intersectCylinderY(vec3 ro, vec3 rd, float R) {
float a = dot(rd.xz, rd.xz);
float b = dot(ro.xz, rd.xz);
float c = dot(ro.xz, ro.xz) - R * R;
float disc = b * b - a * c;
if (disc < 0.0 || a < 1e-6) return vec2(1e9, -1e9);
float s = sqrt(disc);
return vec2((-b - s) / a, (-b + s) / a);
}
// Unified smooth volumetric pass: blazing ascension pillar + atmospheric light-beam scatter
// + organic, wispy, domain-warped turbulent golden energy ribbon (48 smooth steps, zero jitter)
vec3 renderOrganicVolumetricVFX(vec3 ro, vec3 rd, float tSolid, float phase, float beamScale, float ribbonScale) {
float ang = phase * TAU;
vec3 acc = vec3(0.0);
// Wide smooth bounding cylinder R = 2.05 (all fields smoothly fade to 0.0 before R = 1.95)
vec2 cyl = intersectCylinderY(ro, rd, 2.05);
float t0 = max(cyl.x, 0.05);
float t1 = min(cyl.y, tSolid);
if (t1 <= t0) return vec3(0.0);
const int STEPS = 48;
float dt = (t1 - t0) / float(STEPS);
float pillarPulse = 1.0 + 0.06 * sin(ang) + 0.03 * sin(ang * 2.0);
float coreRad = 0.145 * pillarPulse;
for (int i = 0; i < STEPS; i++) {
float t = t0 + (float(i) + 0.5) * dt;
vec3 p = ro + rd * t;
if (p.y < 0.01 || p.y > 4.95) continue;
float r = length(p.xz);
float th = atan(p.z, p.x);
// --------------------------------------------------------------------
// 1. Blazing Ascension Pillar + Turbulent Upward Plasma + Atmospheric Scatter
// --------------------------------------------------------------------
if (r < 1.85) {
// Smooth radial fade to exact 0.0 before boundary (zero cylinder edge!)
float rWin = smoothstep(1.85, 0.45, r);
// Seamless upward-streaming turbulent plasma inside the pillar
// Period = (8, 8): theta wraps around 8, y advances by phase * 8.0
vec2 pUV = vec2(th / TAU * 8.0, p.y * 1.45 - phase * 8.0);
float warpP = fbmPeriodic(pUV * 0.75, vec2(6.0, 6.0));
float plasma = fbmPeriodic(pUV + vec2(warpP * 1.1, -warpP * 0.6), vec2(8.0, 8.0));
float baseFlare = 1.0 + 0.48 * exp(-p.y * 3.8);
float rNorm = r / (coreRad * baseFlare);
float hotCore = exp(-rNorm * rNorm * 3.6) * (0.72 + 0.42 * plasma);
float midPlume = exp(-rNorm * rNorm * 0.95) * (0.45 + 0.65 * plasma);
// Rich atmospheric light-beam scatter (soft golden-amber god-ray aura)
float beamScatter = exp(-r * 2.15) * (0.68 + 0.32 * warpP) * rWin;
// Subtle cyan-white impact mist right at the summoning circle center
float baseCyanMist = exp(-p.y * 3.6) * exp(-r * r * 5.2) * (0.7 + 0.4 * plasma);
vec3 pCol = vec3(1.00, 0.97, 0.84) * hotCore * 1.38
+ vec3(1.00, 0.68, 0.16) * midPlume * 0.76
+ vec3(0.95, 0.46, 0.08) * beamScatter * 0.24
+ vec3(0.16, 0.92, 1.00) * baseCyanMist * 0.75;
acc += pCol * dt * 1.65 * beamScale;
}
// --------------------------------------------------------------------
// 2. Organic, Wispy, Turbulent Swirling Volumetric Golden Energy Ribbon
// --------------------------------------------------------------------
if (p.y > 0.04 && p.y < 4.75) {
float rH = helixRadius(p.y);
float dr = r - rH;
if (abs(dr) < 0.46) {
float pitch = 2.40;
// Seamless 2 full helical turns per 3.0s loop
float hAng = p.y * pitch - ang * 2.0;
float dTh = mod(th - hAng + PI, TAU) - PI;
float dy = dTh / pitch;
// Smooth tilted ribbon local frame
float uLoc = dr * 0.88 - dy * 0.47; // thin cross-ribbon thickness
float vLoc = dr * 0.47 + dy * 0.88; // wide sweeping ribbon breadth
// Seamless domain-warped turbulence flowing rapidly along the spiral arc!
// Arc coord advances seamlessly by phase * 8.0 (matches period 8.0)
float arcCoord = p.y * 1.85 - phase * 8.0;
vec2 flowUV = vec2(arcCoord, vLoc * 5.2 + uLoc * 3.5);
float n1 = fbmPeriodic(flowUV * 0.75, vec2(6.0, 6.0));
float n2 = fbmPeriodic(flowUV * vec2(1.0, 2.4) + vec2(n1 * 1.45, -n1 * 1.15), vec2(8.0, 12.0));
// Organic meandering warp of the ribbon sheet (eliminates stiff geometric tape!)
float uWarp = uLoc + (n1 - 0.5) * 0.14;
float vWarp = vLoc + (n2 - 0.5) * 0.16;
// Smooth envelope tapering gracefully at floor base and upper sky
float yEnv = smoothstep(0.04, 0.42, p.y) * smoothstep(4.75, 3.85, p.y);
float drFade = smoothstep(0.46, 0.18, abs(dr));
// (a) Incandescent sinuous plasma heart (pinches & swells organically)
float coreW = 0.032 + 0.022 * n1;
float heart = exp(-(uWarp * uWarp) / 0.0028 - (vWarp * vWarp) / (coreW * coreW));
heart *= (0.55 + 0.85 * smoothstep(0.28, 0.82, n2));
// (b) Wispy turbulent golden plasma tendrils & feathery streaming wisps
float wispEnv = exp(-(uWarp * uWarp) / 0.014 - (vLoc * vLoc) / 0.044);
float wispyFilaments = smoothstep(0.32, 0.85, n2) * (0.55 + 0.45 * n1);
float wisps = wispEnv * wispyFilaments;
// (c) Soft fiery-amber volumetric glow aura enveloping the turbulent stream
float aura = exp(-(uLoc * uLoc) / 0.038 - (vLoc * vLoc) / 0.085) * (0.45 + 0.55 * n1);
// (d) Delicate secondary trailing golden wisp spiraling slightly behind
float dTh2 = mod(th - (hAng + 0.62) + PI, TAU) - PI;
float dy2 = dTh2 / pitch;
float dr2 = r - (rH + 0.13);
float nTrail = fbmPeriodic(vec2(arcCoord + 2.0, dy2 * 7.5), vec2(8.0, 8.0));
float trail = exp(-(dr2 * dr2) / 0.0045 - (dy2 * dy2) / 0.0075) * smoothstep(0.30, 0.82, nTrail);
// Traveling energy surge along the spiral
float surge = 0.80 + 0.25 * sin(p.y * 2.8 - ang * 4.0);
vec3 rCol = vec3(1.00, 0.96, 0.78) * heart * 2.10
+ vec3(1.00, 0.72, 0.18) * wisps * 1.55
+ vec3(0.98, 0.42, 0.05) * aura * 0.42
+ vec3(1.00, 0.82, 0.32) * trail * 1.15;
acc += rCol * yEnv * drFade * surge * dt * 1.95 * ribbonScale;
}
}
}
return acc;
}
// ============================================================================
// Floating Glowing Cyan Holographic Rune Diamonds (3D Planar Quads)
// ============================================================================
float sdFloatingSigil(vec2 uv, int style, float phase) {
float r = length(uv);
float g = 0.0;
if (style == 0) {
vec2 dUV = rot2(PI * 0.25) * uv;
float outerSq = abs(sdBox2(dUV, vec2(0.56)));
float innerSq = abs(sdBox2(dUV, vec2(0.46)));
float innerCirc = abs(r - 0.30);
float centerSq = abs(sdBox2(uv, vec2(0.16)));
float crossL = min(abs(uv.x), abs(uv.y));
float crossMask = smoothstep(0.58, 0.54, max(abs(dUV.x), abs(dUV.y)));
g += lineGlow(outerSq, 0.026, 0.060) * 1.25;
g += lineGlow(innerSq, 0.017, 0.036) * 0.78;
g += lineGlow(innerCirc, 0.020, 0.045) * 1.05;
g += lineMask(centerSq, 0.017) * 0.92;
g += lineMask(crossL, 0.013) * crossMask * 0.72;
g += smoothstep(0.075, 0.018, r) * 1.10;
vec2 cNode = abs(uv) - vec2(0.40, 0.0);
vec2 cNode2 = abs(uv) - vec2(0.0, 0.40);
g += smoothstep(0.060, 0.018, min(length(cNode), length(cNode2))) * 1.15;
} else {
vec2 rUV = rot2(phase * TAU * 0.25) * uv;
float c1 = abs(r - 0.56);
float c2 = abs(r - 0.44);
float c3 = abs(r - 0.20);
float sq = abs(sdBox2(rUV, vec2(0.31)));
float sq2 = abs(sdBox2(rot2(PI * 0.25) * rUV, vec2(0.31)));
g += lineGlow(c1, 0.026, 0.060) * 1.25;
g += lineGlow(c2, 0.017, 0.036) * 0.85;
g += lineGlow(c3, 0.018, 0.042) * 0.95;
g += lineMask(min(sq, sq2), 0.015) * 0.85;
g += smoothstep(0.065, 0.018, r) * 1.05;
}
return g;
}
vec3 renderFloatingRuneDiamonds(vec3 ro, vec3 rd, float tSolid, float phase, float sigilScale) {
float ang = phase * TAU;
vec3 acc = vec3(0.0);
for (int i = 0; i < 6; i++) {
float fi = float(i);
float theta = fi * (TAU / 6.0) + 0.42 + ang * ((mod(fi, 2.0) < 0.5) ? 1.0 : -1.0);
float rad = 1.16 + 0.26 * sin(fi * 1.7 + 0.5);
float yPos = 1.08 + fi * 0.34 + 0.10 * sin(ang * 2.0 + fi * 1.4);
vec3 center = vec3(cos(theta) * rad, yPos, sin(theta) * rad);
vec3 n = normalize(vec3(cos(theta), 0.15, sin(theta)));
float denom = dot(rd, n);
if (abs(denom) < 0.08) continue;
float tPlane = dot(center - ro, n) / denom;
if (tPlane <= 0.1 || tPlane >= tSolid) continue;
vec3 hit = ro + rd * tPlane;
vec3 rel = hit - center;
vec3 right = normalize(cross(vec3(0.0, 1.0, 0.0), n));
vec3 up = cross(n, right);
float size = 0.34 + 0.05 * sin(fi * 2.3);
vec2 uv = vec2(dot(rel, right), dot(rel, up)) / size;
if (max(abs(uv.x), abs(uv.y)) < 1.15) {
int style = (mod(fi, 3.0) > 1.5) ? 1 : 0;
float sig = sdFloatingSigil(uv, style, phase);
float win = smoothstep(1.12, 0.72, length(uv));
float pulse = 0.84 + 0.16 * sin(ang * 2.0 + fi * 1.5);
float facing = 0.58 + 0.42 * abs(denom);
vec3 cyanCol = mix(vec3(0.04, 0.82, 0.98), vec3(0.72, 1.00, 1.00), clamp(sig * 0.40, 0.0, 1.0));
acc += cyanCol * sig * win * pulse * facing * 1.05 * sigilScale;
}
}
return acc;
}
// ============================================================================
// Crisp Pinpoint Ascending Sparks & Fine Glowing Embers (Zero Blurry Ovals)
// ============================================================================
vec3 renderSharpSparks(vec3 ro, vec3 rd, float tSolid, vec2 uv, float phase) {
float ang = phase * TAU;
vec3 col = vec3(0.0);
// 44 crisp tiny pinpoint sparks swarming upward along the helical ribbon & pillar
for (int i = 0; i < 44; i++) {
float fi = float(i);
float life = fract(phase + hash11(fi * 7.13 + 0.5));
float env = sin(life * PI);
float y = 0.18 + life * 4.15;
// Half hug the spiraling golden ribbon, half rise closer to the central pillar
bool nearPillar = (mod(fi, 3.0) < 1.0);
float theta = fi * 2.39996 + y * (nearPillar ? 1.4 : 2.35) - ang * 2.0;
float rJitter = (hash11(fi * 3.7 + 1.1) - 0.5) * (nearPillar ? 0.55 : 0.62);
float r = nearPillar ? (0.35 + abs(rJitter)) : (helixRadius(y) + rJitter);
vec3 spPos = vec3(cos(theta) * r, y, sin(theta) * r);
vec3 toSp = spPos - ro;
float tProj = dot(toSp, rd);
if (tProj > 0.2 && tProj < tSolid) {
vec3 closest = ro + rd * tProj;
vec3 diff = closest - spPos;
// Tight, crisp pinpoint spark with subtle vertical motion stretch
diff.y *= 0.68;
float d2 = dot(diff, diff);
if (d2 < 0.008) {
float twinkle = 0.65 + 0.35 * sin(ang * 3.0 + fi * 4.1);
float core = exp(-d2 * 18500.0);
float halo = exp(-d2 * 3800.0) * 0.42;
vec3 sCol = (mod(fi, 5.0) < 1.0) ? vec3(0.10, 0.94, 1.00) : vec3(1.00, 0.68, 0.12);
col += (vec3(1.00, 0.97, 0.86) * core * 1.4 + sCol * halo) * env * twinkle * 1.65;
}
}
}
// 10 razor-thin dynamic ember streaks near outer edges (matches 10.png motion energy)
for (int i = 0; i < 10; i++) {
float fi = float(i);
float life = fract(phase + hash11(fi * 4.3 + 1.1));
float env = sin(life * PI);
float angle = hash11(fi * 9.7 + 0.3) * TAU;
vec2 dir = vec2(cos(angle), sin(angle) * 0.62 + 0.12);
vec2 pos = dir * (0.36 + life * 0.72);
vec2 d = uv - pos;
vec2 tangent = normalize(dir);
vec2 perp = vec2(-tangent.y, tangent.x);
float along = dot(d, tangent);
float across = dot(d, perp);
float streak = exp(-(along * along) / 0.00042 - (across * across) / 0.0000045);
vec3 eCol = (mod(fi, 3.0) < 1.0) ? vec3(0.12, 0.92, 1.00) : vec3(1.00, 0.60, 0.10);
col += eCol * streak * env * 0.78;
}
return col;
}
// ============================================================================
// ACES Filmic Tonemapping (Rich saturation, <1% clipping)
// ============================================================================
vec3 acesToneMap(vec3 x) {
const float a = 2.51;
const float b = 0.03;
const float c = 2.43;
const float d = 0.59;
const float e = 0.14;
return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 0.975);
}
// ============================================================================
// Main Shader Entry
// ============================================================================
void pixelfx_study_eval(vec2 pfx_frag_xy, out vec4 fragColor) {
vec2 uv = (pfx_frag_xy - 0.5 * uResolution.xy) / uResolution.y;
float phase = fract(uTime / 3.0);
float ang = phase * TAU;
// Camera Framing (uCamMode 0: Hero High-Angle, uCamMode 1: ~2.5x Macro)
vec3 ro, ta;
float fov;
if (uCamMode == 1) {
float sway = 0.06 * sin(ang);
ro = vec3(0.72 + sway, 1.56, 2.42);
ta = vec3(0.16, 0.46, 0.36);
fov = 1.92;
} else {
float sway = 0.09 * sin(ang);
ro = vec3(sway, 3.55, 5.18);
ta = vec3(0.0, 0.95, 0.0);
fov = 1.62;
}
vec3 cw = normalize(ta - ro);
vec3 cu = normalize(cross(cw, vec3(0.0, 1.0, 0.0)));
vec3 cv = cross(cu, cw);
vec3 rd = normalize(cu * uv.x + cv * uv.y + cw * fov);
// Deep Moody Dark Temple Void Backdrop with subtle atmospheric scatter
float bgGrad = clamp(uv.y * 0.7 + 0.45, 0.0, 1.0);
float mist = fbm2(uv * 3.4 + vec2(sin(ang) * 0.10, cos(ang) * 0.07));
vec3 bgCol;
if (uLightMode == 1) {
bgCol = vec3(mix(0.12, 0.18, bgGrad) + mist * 0.02);
} else if (uLightMode == 2) {
bgCol = mix(vec3(0.008, 0.010, 0.013), vec3(0.003, 0.004, 0.006), bgGrad) + mist * 0.003;
} else if (uLightMode == 3) {
float rimGlow = exp(-length(uv - vec2(0.0, 0.18)) * 2.4);
bgCol = mix(vec3(0.006, 0.009, 0.014), vec3(0.0025, 0.0035, 0.0055), bgGrad)
+ vec3(0.055, 0.075, 0.105) * rimGlow;
} else {
float mistBand = exp(-((uv.y - 0.04) * 3.0) * ((uv.y - 0.04) * 3.0));
float centralScatter = exp(-abs(uv.x) * 3.8) * smoothstep(-0.25, 0.55, uv.y);
bgCol = mix(vec3(0.0045, 0.0075, 0.0090), vec3(0.0020, 0.0030, 0.0040), bgGrad)
+ vec3(0.005, 0.014, 0.016) * mist * mistBand
+ vec3(0.028, 0.016, 0.005) * centralScatter * (0.65 + 0.35 * mist);
}
// Primary Raymarch (Stone Temple Floor + Jagged Levitating Stone Shards)
float t = 0.0;
float tMax = 18.0;
float matId = -1.0;
for (int i = 0; i < 64; i++) {
vec3 p = ro + rd * t;
vec2 h = mapSceneMat(p, phase);
if (h.x < 0.002) {
matId = h.y;
break;
}
t += h.x * 0.90;
if (t > tMax) break;
}
float tSolid = (matId >= 0.0) ? t : tMax;
vec3 col = bgCol;
// Surface Shading
if (matId >= 0.0) {
vec3 p = ro + rd * tSolid;
vec3 n = calcNormal(p, phase);
vec3 v = -rd;
float r = length(p.xz);
vec3 albedo;
float rough = 0.72;
vec3 circleEmit = vec3(0.0);
if (matId < 0.5) {
vec3 tile = stoneFloorPattern(p.xz);
float moss = smoothstep(0.62, 0.85, fbm2(p.xz * 2.2 + 4.2)) * tile.y;
float grain = fbm2(p.xz * 12.0);
albedo = mix(vec3(0.024, 0.028, 0.032), vec3(0.052, 0.056, 0.062), tile.z * 0.6 + grain * 0.4);
albedo = mix(albedo, vec3(0.008, 0.009, 0.011), tile.y * 0.82);
albedo = mix(albedo, vec3(0.024, 0.042, 0.018), moss * 0.55);
rough = mix(0.55, 0.92, tile.y);
circleEmit = evaluateSummoningCircle(p.xz, phase);
albedo *= (1.0 - circleEmit.z * 0.45);
} else {
float rockTex = fbm2(p.xz * 8.5 + p.y * 7.5);
albedo = mix(vec3(0.028, 0.030, 0.034), vec3(0.072, 0.068, 0.060), rockTex);
rough = 0.64;
}
vec3 lit = vec3(0.0);
if (uLightMode == 1) {
float grayAlb = dot(albedo, vec3(0.299, 0.587, 0.114)) * 3.4;
vec3 keyDir = normalize(vec3(0.45, 0.78, 0.42));
vec3 fillDir = normalize(vec3(-0.6, 0.45, 0.5));
float sh = calcSoftShadow(p + n * 0.015, keyDir, 0.04, 4.5, phase);
float diff1 = max(dot(n, keyDir), 0.0) * (0.30 + 0.70 * sh);
float diff2 = max(dot(n, fillDir), 0.0) * 0.28;
float fres = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 3.0);
float baseL = grayAlb * (0.30 + diff1 * 1.25 + diff2) + fres * 0.08;
float glyphL = (circleEmit.x * 0.42 + circleEmit.y * 0.34);
lit = vec3(baseL + glyphL * 0.55);
} else {
vec3 keyDir, keyCol, ambCol;
float magicBounceScale = 1.0;
if (uLightMode == 2) {
keyDir = normalize(vec3(0.92, 0.19, 0.34));
keyCol = vec3(1.55, 1.22, 0.88);
ambCol = vec3(0.012, 0.015, 0.019);
magicBounceScale = 0.45;
} else if (uLightMode == 3) {
keyDir = normalize(vec3(-0.20, 0.34, -0.92));
keyCol = vec3(0.95, 1.10, 1.32);
ambCol = vec3(0.008, 0.012, 0.016);
magicBounceScale = 0.55;
} else {
keyDir = normalize(vec3(0.30, 0.85, 0.42));
keyCol = vec3(0.14, 0.18, 0.22);
ambCol = vec3(0.009, 0.013, 0.016);
magicBounceScale = 1.0;
}
float sh = calcSoftShadow(p + n * 0.015, keyDir, 0.04, 4.5, phase);
float ndl = max(dot(n, keyDir), 0.0);
vec3 hVec = normalize(keyDir + v);
float spec = pow(max(dot(n, hVec), 1e-5), mix(42.0, 10.0, rough)) * (1.0 - rough * 0.55);
lit += albedo * (ambCol + keyCol * ndl * (0.20 + 0.80 * sh));
lit += keyCol * spec * 0.24 * sh;
if (uLightMode == 3) {
float rim = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 3.0);
float backAlign = clamp(dot(n, keyDir) * 0.5 + 0.5, 0.0, 1.0);
float rimStrength = (matId > 0.5) ? 1.15 : 0.10;
lit += vec3(0.55, 0.82, 1.05) * rim * (0.35 + 0.85 * backAlign) * rimStrength;
}
vec3 toPillar = vec3(-p.x, max(0.45 - p.y, 0.22), -p.z);
float distP = length(toPillar);
vec3 pDir = toPillar / max(distP, 0.001);
float pAtten = 1.0 / (0.45 + distP * distP * 0.65);
float pDiff = max(dot(n, pDir), 0.0);
vec3 pHalf = normalize(pDir + v);
float pSpec = pow(max(dot(n, pHalf), 1e-5), mix(34.0, 8.0, rough));
vec3 goldLight = vec3(1.00, 0.58, 0.12) * (1.45 + 0.15 * sin(ang * 2.0));
lit += albedo * goldLight * (pDiff * 1.45 + 0.18) * pAtten * magicBounceScale;
lit += goldLight * pSpec * 0.30 * pAtten * magicBounceScale;
float cyanRingDist = abs(r - 1.15);
float cyanAtten = exp(-cyanRingDist * 1.65) * exp(-abs(p.y - 0.30) * 0.85);
vec3 cyanLight = vec3(0.06, 0.86, 1.00);
lit += albedo * cyanLight * (0.45 + 0.55 * max(n.y, 0.0)) * cyanAtten * 0.72 * magicBounceScale;
if (matId > 0.5) {
float shardRim = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 2.4);
float towardPillar = clamp(dot(n, pDir) * 0.75 + 0.25, 0.0, 1.0);
float underCatch = clamp(-n.y * 0.65 + 0.20, 0.0, 1.0);
lit += vec3(1.00, 0.66, 0.16) * (shardRim * towardPillar * 0.90 + underCatch * towardPillar * 0.28) * magicBounceScale;
lit += vec3(0.10, 0.86, 1.00) * max(-n.y, 0.0) * 0.18 * magicBounceScale;
}
if (matId < 0.5) {
float macroCalm = (uCamMode == 1) ? 0.72 : 1.0;
float emitScale = ((uLightMode == 0) ? 1.0 : 0.65) * macroCalm;
vec3 goldCol = mix(vec3(1.00, 0.46, 0.04), vec3(1.00, 0.88, 0.48), clamp(circleEmit.x * 0.45, 0.0, 1.0));
vec3 cyanCol = mix(vec3(0.02, 0.72, 0.96), vec3(0.68, 1.00, 1.00), clamp(circleEmit.y * 0.45, 0.0, 1.0));
lit += goldCol * circleEmit.x * 1.18 * emitScale;
lit += cyanCol * circleEmit.y * 1.15 * emitScale;
}
}
float radialFade = (matId < 0.5) ? smoothstep(3.55, 5.85, r) : 0.0;
float distFog = 1.0 - exp(-max(tSolid - 5.2, 0.0) * 0.14);
float fog = clamp(max(radialFade * 0.92, distFog * 0.72), 0.0, 0.96);
col = mix(lit, bgCol, fog);
}
// Organic Turbulent Volumetric Pillar + Wispy Golden Spiral Ribbon + Cyan Sigils + Sparks
float macroBeamCalm = (uCamMode == 1) ? 0.58 : 1.0;
float beamScale = ((uLightMode == 1) ? 0.24 : ((uLightMode == 0) ? 1.0 : 0.62)) * macroBeamCalm;
float ribbonScale = ((uLightMode == 1) ? 0.46 : ((uLightMode == 0) ? 1.0 : 0.68)) * (uCamMode == 1 ? 0.82 : 1.0);
float sigilScale = ((uLightMode == 1) ? 0.50 : ((uLightMode == 0) ? 1.0 : 0.70));
vec3 volVFX = renderOrganicVolumetricVFX(ro, rd, tSolid, phase, beamScale, ribbonScale);
vec3 sigilsVFX = renderFloatingRuneDiamonds(ro, rd, tSolid, phase, sigilScale);
if (uLightMode == 1) {
float vL = dot(volVFX + sigilsVFX, vec3(0.299, 0.587, 0.114));
col += vec3(vL * 0.80);
} else {
col += volVFX + sigilsVFX;
if (uLightMode == 0) {
col += renderSharpSparks(ro, rd, tSolid, uv, phase);
}
}
// ACES Filmic Tonemapping, Gamma 2.2, & Strict Luminance Bounds
float exposure = (uLightMode == 1) ? 1.02 : 0.96;
col = acesToneMap(col * exposure);
col = pow(max(col, vec3(0.0)), vec3(1.0 / 2.2));
float vig = 1.0 - 0.18 * dot(uv, uv);
col *= clamp(vig, 0.76, 1.0);
col = max(col, vec3(0.024));
col = min(col, vec3(0.985));
if (uLightMode == 1) {
float g = dot(col, vec3(0.299, 0.587, 0.114));
col = vec3(g);
}
col *= (1.0 + 0.0 * uOpen);
fragColor = vec4(col, 1.0);
}
void fragment() {
vec2 tiled_uv = fract(UV * u_tiling);
vec2 frag_xy = vec2(tiled_uv.x, 1.0 - tiled_uv.y) * uResolution;
vec4 study_col = vec4(0.0, 0.0, 0.0, 1.0);
pixelfx_study_eval(frag_xy, study_col);
vec3 tinted = clamp(mix(study_col.rgb, study_col.rgb * u_tint.rgb * 1.35, u_tint_mix), 0.0, 1.0);
float out_alpha = study_col.a * COLOR.a;
if (u_luma_alpha_key) {
float luma = dot(tinted, vec3(0.2126, 0.7152, 0.0722));
out_alpha *= smoothstep(0.035, 0.22, luma);
}
COLOR = vec4(tinted, out_alpha);
}
shader_type spatial;
render_mode unshaded, cull_disabled;
// Summoning Circle Ascension Pillar — Godot 4 (spatial) wrapper
// Source: https://github.com/gokayfem/glsl-studies/blob/main/vfx_animated/lib/10_summoning_circle_ascension_pillar.glsl (MIT License)
// Drive uTime from GDScript if animating helper functions: material.set_shader_parameter("uTime", Time.get_ticks_msec() * 0.001 * u_speed)
uniform vec2 uResolution = vec2(1024.0, 1024.0);
uniform float uTime = 1.2;
uniform float u_speed : hint_range(0.0, 3.0, 0.05) = 1.0;
uniform float u_tiling : hint_range(0.25, 8.0, 0.25) = 1.0;
uniform vec4 u_tint : source_color = vec4(1.0, 0.722, 0.42, 1.0);
uniform float u_tint_mix : hint_range(0.0, 1.0, 0.01) = 0.0;
uniform float uOpen : hint_range(0.0, 1.0, 0.01) = 0.0;
uniform int uLightMode : hint_range(0, 3, 1) = 0;
uniform int uCamMode : hint_range(0, 1, 1) = 0;
uniform bool u_luma_alpha_key = false;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
// ============================================================================
// Math & Procedural Utilities (including Seamless Periodic fBM)
// ============================================================================
mat2 rot2(float a) {
float c = cos(a), s = sin(a);
return mat2(c, -s, s, c);
}
float hash11(float p) {
p = fract(p * 0.1031);
p *= p + 33.33;
p *= p + p;
return fract(p);
}
float hash12(vec2 p) {
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
float vnoise2(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
float a = hash12(i);
float b = hash12(i + vec2(1.0, 0.0));
float c = hash12(i + vec2(0.0, 1.0));
float d = hash12(i + vec2(1.0, 1.0));
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
float fbm2(vec2 p) {
float v = 0.0;
float a = 0.5;
mat2 m = mat2(0.8, 0.6, -0.6, 0.8);
for (int i = 0; i < 4; i++) {
v += a * vnoise2(p);
p = m * p * 2.03 + 17.1;
a *= 0.5;
}
return v;
}
// Tileable 2D value noise with exact integer period -> bit-exact seamless 3.0s animation
float vnoisePeriodic(vec2 p, vec2 period) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
vec2 i00 = mod(i, period);
vec2 i10 = mod(i + vec2(1.0, 0.0), period);
vec2 i01 = mod(i + vec2(0.0, 1.0), period);
vec2 i11 = mod(i + vec2(1.0, 1.0), period);
float a = hash12(i00);
float b = hash12(i10);
float c = hash12(i01);
float d = hash12(i11);
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
// 4-octave tileable fBM: shifting p by phase * period is 100% seamless across all octaves
float fbmPeriodic(vec2 p, vec2 period) {
float v = 0.0;
float a = 0.52;
for (int i = 0; i < 4; i++) {
v += a * vnoisePeriodic(p, period);
p = p * 2.0 + vec2(3.7, 5.1);
period *= 2.0;
a *= 0.5;
}
return v;
}
// ============================================================================
// 2D Geometric SDF Primitives for Arcane Summoning Circle & Floating Sigils
// ============================================================================
float sdRing(float r, float rad, float halfW) {
return abs(r - rad) - halfW;
}
float sdBox2(vec2 p, vec2 b) {
vec2 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0);
}
float sdEqTriangle(vec2 p, float r) {
const float k = 1.73205080757;
p.x = abs(p.x) - r;
p.y = p.y + r / k;
if (p.x + k * p.y > 0.0) p = vec2(p.x - k * p.y, -k * p.x - p.y) * 0.5;
p.x -= clamp(p.x, -2.0 * r, 0.0);
return -length(p) * sign(p.y);
}
float lineMask(float d, float width) {
return smoothstep(width, width * 0.15, abs(d));
}
float lineGlow(float d, float width, float halo) {
float core = smoothstep(width, width * 0.12, abs(d));
float soft = exp(-abs(d) / max(halo, 0.001));
return core + soft * 0.30;
}
// ============================================================================
// Dark Ancient Stone Temple Floor Paving & Relief
// ============================================================================
vec3 stoneFloorPattern(vec2 p) {
float r = length(p);
float th = atan(p.y, p.x);
float ringIdx = floor(r * 1.45);
float ringF = fract(r * 1.45);
float segCount = max(6.0, floor(6.0 + ringIdx * 5.0));
float segShift = hash11(ringIdx * 13.7 + 1.3) * TAU;
float thS = mod(th + segShift, TAU);
float segF = fract(thS / TAU * segCount);
float segIdx = floor(thS / TAU * segCount);
float nWarp = (vnoise2(p * 3.5) - 0.5) * 0.055;
float dRing = min(ringF, 1.0 - ringF) / 1.45;
float dSeg = min(segF, 1.0 - segF) * (TAU * max(r, 0.25) / segCount);
float seamDist = min(dRing, dSeg) + nWarp * 0.28;
float crackN = abs(fbm2(p * 2.8 + vec2(3.1, 7.4)) - 0.5);
float crack = smoothstep(0.020, 0.003, crackN) * smoothstep(0.35, 1.4, r);
float mortar = smoothstep(0.028, 0.004, seamDist);
float bevel = smoothstep(0.004, 0.052, seamDist);
float id = hash12(vec2(ringIdx, segIdx));
float h = bevel * (0.80 + 0.20 * id) - crack * 0.25;
return vec3(clamp(h, 0.0, 1.0), max(mortar, crack * 0.72), id);
}
// ============================================================================
// Arcane Summoning Circle Inscribed on Floor (y = 0)
// ============================================================================
vec3 evaluateSummoningCircle(vec2 p, float phase) {
float ang = phase * TAU;
float r = length(p);
float gold = 0.0;
float cyan = 0.0;
float groove = 0.0;
// Seamless outward radial ignition pulse over 3.0s
float pulseR = fract(phase) * 3.55;
float pulseEnv = sin(phase * PI);
float dPulse = (r - pulseR) * 4.2;
float pulseWave = exp(-(dPulse * dPulse)) * pulseEnv;
float breathe = 0.90 + 0.10 * sin(ang * 2.0);
// Zone 1: Focused Central Pillar Impact Pool & Inner Golden Double Ring
float coreCyan = exp(-r * r * 14.0) * (1.15 + 0.20 * sin(ang * 2.0));
float coreGold = exp(-r * r * 6.5) * (0.65 + 0.15 * sin(ang));
cyan += coreCyan;
gold += coreGold;
vec2 pInner = rot2(ang * 0.25) * p;
float rInner1 = sdRing(r, 0.44, 0.009);
float rInner2 = sdRing(r, 0.52, 0.012);
gold += lineGlow(rInner1, 0.012, 0.032) * 0.95 + lineGlow(rInner2, 0.014, 0.040) * 1.05;
groove = max(groove, max(lineMask(rInner1, 0.016), lineMask(rInner2, 0.018)));
float thIn = atan(pInner.y, pInner.x);
float spokeA = abs(fract(thIn / TAU * 16.0 + 0.5) - 0.5) * (TAU * max(r, 0.1) / 16.0);
float spokeMask = smoothstep(0.26, 0.30, r) * smoothstep(0.46, 0.43, r);
gold += lineMask(spokeA, 0.009) * spokeMask * 0.78;
// Zone 2: Inner Electric-Cyan 8-Pointed Octagram Star (+ang/4)
vec2 pStar = rot2(ang * 0.25) * p;
vec2 pStar45 = rot2(PI * 0.25) * pStar;
float octOuter = min(abs(sdBox2(pStar, vec2(0.84))), abs(sdBox2(pStar45, vec2(0.84))));
float octInner = min(abs(sdBox2(pStar, vec2(0.76))), abs(sdBox2(pStar45, vec2(0.76))));
float cyanStar = lineGlow(octOuter, 0.014, 0.048) * 1.25
+ lineGlow(octInner, 0.009, 0.026) * 0.65;
float thOct = atan(pStar.y, pStar.x);
float octSector = mod(thOct + PI / 8.0, PI / 4.0) - PI / 8.0;
vec2 pOctTip = vec2(cos(octSector), sin(octSector)) * r;
float tipDot = length(pOctTip - vec2(1.188, 0.0));
cyanStar += smoothstep(0.048, 0.012, tipDot) * 1.35 + exp(-tipDot * 18.0) * 0.45;
float rMid0 = sdRing(r, 0.72, 0.010);
gold += lineGlow(rMid0, 0.013, 0.036) * 0.95;
cyan += cyanStar * (1.0 + 0.38 * pulseWave);
groove = max(groove, lineMask(octOuter, 0.020));
// Zone 3: Mid Fiery-Gold Ring + 4 Cardinal Cyan Seal Medallions (-ang/4)
vec2 pMid = rot2(-ang * 0.25) * p;
float rBand1 = sdRing(r, 1.24, 0.011);
float rBand2 = sdRing(r, 1.33, 0.008);
float rBand3 = sdRing(r, 1.88, 0.012);
float rBand4 = sdRing(r, 1.97, 0.016);
gold += lineGlow(rBand1, 0.014, 0.042)
+ lineGlow(rBand2, 0.010, 0.026) * 0.72
+ lineGlow(rBand3, 0.014, 0.042)
+ lineGlow(rBand4, 0.018, 0.058) * 1.25;
groove = max(groove, max(lineMask(rBand1, 0.018), lineMask(rBand4, 0.022)));
float thMid = atan(pMid.y, pMid.x);
float qSector = mod(thMid + PI * 0.25, PI * 0.5) - PI * 0.25;
vec2 pMed = vec2(cos(qSector), sin(qSector)) * r - vec2(1.60, 0.0);
float dMed = length(pMed);
float medOuter = sdRing(dMed, 0.24, 0.010);
float medInner = sdRing(dMed, 0.16, 0.007);
float medCross = min(abs(pMed.x), abs(pMed.y));
float medBox = abs(sdBox2(rot2(PI * 0.25) * pMed, vec2(0.115)));
float medGlow = lineGlow(medOuter, 0.013, 0.042) * 1.25
+ lineGlow(medInner, 0.010, 0.028) * 0.90
+ lineMask(medBox, 0.009) * 0.90
+ lineMask(medCross, 0.008) * smoothstep(0.24, 0.22, dMed) * 0.75
+ smoothstep(0.042, 0.010, dMed) * 1.15;
cyan += medGlow * (1.0 + 0.45 * pulseWave);
groove = max(groove, lineMask(medOuter, 0.018));
float outsideMed = smoothstep(0.25, 0.30, dMed);
float bigOct = min(abs(sdBox2(pMid, vec2(1.38))), abs(sdBox2(rot2(PI * 0.25) * pMid, vec2(1.38))));
float bandMask = smoothstep(1.23, 1.28, r) * smoothstep(1.96, 1.90, r);
gold += lineGlow(bigOct, 0.011, 0.030) * bandMask * outsideMed * 0.95;
float runeAng = fract(thMid / TAU * 48.0);
float runeId = floor(thMid / TAU * 48.0);
float runeOn = step(0.28, hash11(runeId * 19.3 + 4.1));
float runeDash = smoothstep(0.12, 0.24, runeAng) * smoothstep(0.88, 0.76, runeAng);
float runeBand = smoothstep(0.042, 0.014, abs(r - 1.285));
gold += runeDash * runeBand * runeOn * 0.78;
// Zone 4: Outer Golden 12-Pointed Star Crown (+ang/12)
vec2 pCrown = rot2(ang / 12.0) * p;
float thCr = atan(pCrown.y, pCrown.x);
float crSeg = mod(thCr + PI / 12.0, TAU / 12.0) - PI / 12.0;
vec2 pTri = vec2(cos(crSeg), sin(crSeg)) * r - vec2(2.14, 0.0);
float dTri = sdEqTriangle(vec2(pTri.y, -pTri.x), 0.16);
float crownMask = smoothstep(1.96, 2.00, r);
gold += lineGlow(abs(dTri), 0.013, 0.044) * crownMask * 1.15;
groove = max(groove, lineMask(abs(dTri), 0.016) * crownMask);
// Zone 5: Outer Temple Boundary Circle & 6 Satellite Sub-Circles (-ang/6)
vec2 pOut = rot2(-ang / 6.0) * p;
float rOut1 = sdRing(r, 2.68, 0.009);
float rOut2 = sdRing(r, 3.05, 0.011);
float rOut3 = sdRing(r, 3.38, 0.009);
gold += lineGlow(rOut1, 0.011, 0.028) * 0.62
+ lineGlow(rOut2, 0.013, 0.036) * 0.75
+ lineGlow(rOut3, 0.011, 0.028) * 0.52;
float thOut = atan(pOut.y, pOut.x);
float satSec = mod(thOut + PI / 6.0, TAU / 6.0) - PI / 6.0;
vec2 pSat = vec2(cos(satSec), sin(satSec)) * r - vec2(3.05, 0.0);
float dSat = length(pSat);
float satR1 = sdRing(dSat, 0.38, 0.009);
float satR2 = sdRing(dSat, 0.30, 0.007);
float satTri = min(abs(sdEqTriangle(pSat, 0.20)), abs(sdEqTriangle(vec2(pSat.x, -pSat.y), 0.20)));
gold += lineGlow(satR1, 0.012, 0.032) * 0.78
+ lineGlow(satR2, 0.009, 0.024) * 0.60
+ lineMask(satTri, 0.009) * 0.65
+ smoothstep(0.032, 0.009, dSat) * 0.55;
groove = max(groove, lineMask(satR1, 0.014));
float pulseBoost = 1.0 + 0.55 * pulseWave;
gold *= breathe * pulseBoost;
cyan *= (0.94 + 0.06 * cos(ang * 2.0)) * pulseBoost;
return vec3(gold, cyan, groove);
}
// ============================================================================
// Jagged Craggy Levitating Stone Shards (10 Sharp Faceted Rocks in Orbit)
// ============================================================================
struct ShardTransform {
vec3 pos;
float radius;
float angY;
float angX;
float seed;
};
ShardTransform getShard(int i, float phase) {
float fi = float(i);
float ang = phase * TAU;
float baseTheta = fi * 1.24 + 0.42;
float orbitDir = (mod(fi, 2.0) < 0.5) ? 1.0 : -1.0;
float theta = baseTheta + ang * orbitDir;
float hBase = 0.78 + fi * 0.26;
float bob = 0.085 * sin(ang * 2.0 + fi * 1.7);
float radOrbit = 1.22 + 0.46 * sin(fi * 0.88 + 0.35) + 0.05 * cos(ang + fi);
ShardTransform st;
st.pos = vec3(cos(theta) * radOrbit, hBase + bob, sin(theta) * radOrbit);
st.radius = 0.145 + 0.065 * hash11(fi * 7.3 + 2.1);
st.angY = fi * 2.1 + ang * orbitDir;
st.angX = fi * 1.4 + ang;
st.seed = fi * 3.7 + 1.2;
return st;
}
float sdStoneShard(vec3 p, float rad, float seed) {
vec3 q = p / vec3(1.22, 0.74, 0.90);
float d = -1e5;
d = max(d, dot(q, normalize(vec3( 0.85, 0.42, 0.30))) - rad * (0.68 + 0.12 * sin(seed)));
d = max(d, dot(q, normalize(vec3(-0.78, 0.50, -0.36))) - rad * (0.64 + 0.11 * cos(seed * 1.3)));
d = max(d, dot(q, normalize(vec3( 0.24, -0.90, 0.36))) - rad * (0.58 + 0.10 * sin(seed * 2.1)));
d = max(d, dot(q, normalize(vec3(-0.32, -0.44, 0.84))) - rad * (0.66 + 0.10 * cos(seed * 1.7)));
d = max(d, dot(q, normalize(vec3( 0.44, 0.22, -0.86))) - rad * (0.62 + 0.12 * sin(seed * 0.7)));
d = max(d, dot(q, normalize(vec3(-0.62, -0.68, -0.38))) - rad * (0.60 + 0.09 * cos(seed * 2.7)));
d = max(d, dot(q, normalize(vec3( 0.18, 0.94, -0.28))) - rad * (0.56 + 0.10 * sin(seed * 1.9)));
d = max(d, dot(q, normalize(vec3( 0.72, -0.48, -0.49))) - rad * (0.65 + 0.08 * cos(seed * 3.1)));
d = max(d, dot(q, normalize(vec3(-0.88, 0.12, 0.46))) - rad * (0.63 + 0.09 * sin(seed * 2.5)));
float chip1 = abs(sin(q.x * 19.0 + seed) * cos(q.y * 17.0 - seed) + sin(q.z * 21.0)) * 0.011;
float chip2 = abs(sin((q.x + q.z) * 31.0 + seed * 2.0)) * 0.005;
return (d + chip1 - chip2) * 0.68;
}
vec2 mapSceneMat(vec3 p, float phase) {
float r = length(p.xz);
float floorH = 0.0;
if (abs(p.y) < 0.24) {
vec3 tile = stoneFloorPattern(p.xz);
floorH = (tile.x - 0.5) * 0.026 - tile.y * 0.018;
floorH += smoothstep(3.65, 3.80, r) * 0.12;
}
float dFloor = p.y - floorH;
vec2 res = vec2(dFloor, 0.0);
float r2 = dot(p.xz, p.xz);
if (p.y > 0.35 && p.y < 3.75 && r2 < 5.2) {
for (int i = 0; i < 10; i++) {
ShardTransform st = getShard(i, phase);
vec3 dPos = p - st.pos;
float bDist = length(dPos) - st.radius * 1.38;
if (bDist < res.x) {
vec3 lp = dPos;
lp.xz = rot2(st.angY) * lp.xz;
lp.yz = rot2(st.angX) * lp.yz;
float dS = sdStoneShard(lp, st.radius, st.seed);
if (dS < res.x) {
res = vec2(dS, 1.0);
}
}
}
}
return res;
}
float mapScene(vec3 p, float phase) {
return mapSceneMat(p, phase).x;
}
// Unit-sign tetrahedral normal
vec3 calcNormal(vec3 p, float phase) {
const float h = 0.0022;
const vec2 k = vec2(1.0, -1.0);
return normalize(
k.xyy * mapScene(p + k.xyy * h, phase) +
k.yyx * mapScene(p + k.yyx * h, phase) +
k.yxy * mapScene(p + k.yxy * h, phase) +
k.xxx * mapScene(p + k.xxx * h, phase)
);
}
float calcSoftShadow(vec3 ro, vec3 rd, float tMin, float tMax, float phase) {
float res = 1.0;
float t = tMin;
for (int i = 0; i < 16; i++) {
float h = mapScene(ro + rd * t, phase);
if (h < 0.002) return 0.0;
res = min(res, 7.0 * h / t);
t += clamp(h, 0.035, 0.32);
if (t > tMax) break;
}
return clamp(res, 0.0, 1.0);
}
// ============================================================================
// Organic Turbulent Volumetric Golden Ascension Pillar + Wispy Swirling Ribbon
// Zero stipple, zero tape-stripes, zero bounding-cylinder seams!
// ============================================================================
float helixRadius(float y) {
float flare = 0.48 + 0.86 * smoothstep(0.05, 1.60, y) - 0.22 * smoothstep(2.4, 4.3, y);
return flare + 0.14 * sin(y * 1.95);
}
vec2 intersectCylinderY(vec3 ro, vec3 rd, float R) {
float a = dot(rd.xz, rd.xz);
float b = dot(ro.xz, rd.xz);
float c = dot(ro.xz, ro.xz) - R * R;
float disc = b * b - a * c;
if (disc < 0.0 || a < 1e-6) return vec2(1e9, -1e9);
float s = sqrt(disc);
return vec2((-b - s) / a, (-b + s) / a);
}
// Unified smooth volumetric pass: blazing ascension pillar + atmospheric light-beam scatter
// + organic, wispy, domain-warped turbulent golden energy ribbon (48 smooth steps, zero jitter)
vec3 renderOrganicVolumetricVFX(vec3 ro, vec3 rd, float tSolid, float phase, float beamScale, float ribbonScale) {
float ang = phase * TAU;
vec3 acc = vec3(0.0);
// Wide smooth bounding cylinder R = 2.05 (all fields smoothly fade to 0.0 before R = 1.95)
vec2 cyl = intersectCylinderY(ro, rd, 2.05);
float t0 = max(cyl.x, 0.05);
float t1 = min(cyl.y, tSolid);
if (t1 <= t0) return vec3(0.0);
const int STEPS = 48;
float dt = (t1 - t0) / float(STEPS);
float pillarPulse = 1.0 + 0.06 * sin(ang) + 0.03 * sin(ang * 2.0);
float coreRad = 0.145 * pillarPulse;
for (int i = 0; i < STEPS; i++) {
float t = t0 + (float(i) + 0.5) * dt;
vec3 p = ro + rd * t;
if (p.y < 0.01 || p.y > 4.95) continue;
float r = length(p.xz);
float th = atan(p.z, p.x);
// --------------------------------------------------------------------
// 1. Blazing Ascension Pillar + Turbulent Upward Plasma + Atmospheric Scatter
// --------------------------------------------------------------------
if (r < 1.85) {
// Smooth radial fade to exact 0.0 before boundary (zero cylinder edge!)
float rWin = smoothstep(1.85, 0.45, r);
// Seamless upward-streaming turbulent plasma inside the pillar
// Period = (8, 8): theta wraps around 8, y advances by phase * 8.0
vec2 pUV = vec2(th / TAU * 8.0, p.y * 1.45 - phase * 8.0);
float warpP = fbmPeriodic(pUV * 0.75, vec2(6.0, 6.0));
float plasma = fbmPeriodic(pUV + vec2(warpP * 1.1, -warpP * 0.6), vec2(8.0, 8.0));
float baseFlare = 1.0 + 0.48 * exp(-p.y * 3.8);
float rNorm = r / (coreRad * baseFlare);
float hotCore = exp(-rNorm * rNorm * 3.6) * (0.72 + 0.42 * plasma);
float midPlume = exp(-rNorm * rNorm * 0.95) * (0.45 + 0.65 * plasma);
// Rich atmospheric light-beam scatter (soft golden-amber god-ray aura)
float beamScatter = exp(-r * 2.15) * (0.68 + 0.32 * warpP) * rWin;
// Subtle cyan-white impact mist right at the summoning circle center
float baseCyanMist = exp(-p.y * 3.6) * exp(-r * r * 5.2) * (0.7 + 0.4 * plasma);
vec3 pCol = vec3(1.00, 0.97, 0.84) * hotCore * 1.38
+ vec3(1.00, 0.68, 0.16) * midPlume * 0.76
+ vec3(0.95, 0.46, 0.08) * beamScatter * 0.24
+ vec3(0.16, 0.92, 1.00) * baseCyanMist * 0.75;
acc += pCol * dt * 1.65 * beamScale;
}
// --------------------------------------------------------------------
// 2. Organic, Wispy, Turbulent Swirling Volumetric Golden Energy Ribbon
// --------------------------------------------------------------------
if (p.y > 0.04 && p.y < 4.75) {
float rH = helixRadius(p.y);
float dr = r - rH;
if (abs(dr) < 0.46) {
float pitch = 2.40;
// Seamless 2 full helical turns per 3.0s loop
float hAng = p.y * pitch - ang * 2.0;
float dTh = mod(th - hAng + PI, TAU) - PI;
float dy = dTh / pitch;
// Smooth tilted ribbon local frame
float uLoc = dr * 0.88 - dy * 0.47; // thin cross-ribbon thickness
float vLoc = dr * 0.47 + dy * 0.88; // wide sweeping ribbon breadth
// Seamless domain-warped turbulence flowing rapidly along the spiral arc!
// Arc coord advances seamlessly by phase * 8.0 (matches period 8.0)
float arcCoord = p.y * 1.85 - phase * 8.0;
vec2 flowUV = vec2(arcCoord, vLoc * 5.2 + uLoc * 3.5);
float n1 = fbmPeriodic(flowUV * 0.75, vec2(6.0, 6.0));
float n2 = fbmPeriodic(flowUV * vec2(1.0, 2.4) + vec2(n1 * 1.45, -n1 * 1.15), vec2(8.0, 12.0));
// Organic meandering warp of the ribbon sheet (eliminates stiff geometric tape!)
float uWarp = uLoc + (n1 - 0.5) * 0.14;
float vWarp = vLoc + (n2 - 0.5) * 0.16;
// Smooth envelope tapering gracefully at floor base and upper sky
float yEnv = smoothstep(0.04, 0.42, p.y) * smoothstep(4.75, 3.85, p.y);
float drFade = smoothstep(0.46, 0.18, abs(dr));
// (a) Incandescent sinuous plasma heart (pinches & swells organically)
float coreW = 0.032 + 0.022 * n1;
float heart = exp(-(uWarp * uWarp) / 0.0028 - (vWarp * vWarp) / (coreW * coreW));
heart *= (0.55 + 0.85 * smoothstep(0.28, 0.82, n2));
// (b) Wispy turbulent golden plasma tendrils & feathery streaming wisps
float wispEnv = exp(-(uWarp * uWarp) / 0.014 - (vLoc * vLoc) / 0.044);
float wispyFilaments = smoothstep(0.32, 0.85, n2) * (0.55 + 0.45 * n1);
float wisps = wispEnv * wispyFilaments;
// (c) Soft fiery-amber volumetric glow aura enveloping the turbulent stream
float aura = exp(-(uLoc * uLoc) / 0.038 - (vLoc * vLoc) / 0.085) * (0.45 + 0.55 * n1);
// (d) Delicate secondary trailing golden wisp spiraling slightly behind
float dTh2 = mod(th - (hAng + 0.62) + PI, TAU) - PI;
float dy2 = dTh2 / pitch;
float dr2 = r - (rH + 0.13);
float nTrail = fbmPeriodic(vec2(arcCoord + 2.0, dy2 * 7.5), vec2(8.0, 8.0));
float trail = exp(-(dr2 * dr2) / 0.0045 - (dy2 * dy2) / 0.0075) * smoothstep(0.30, 0.82, nTrail);
// Traveling energy surge along the spiral
float surge = 0.80 + 0.25 * sin(p.y * 2.8 - ang * 4.0);
vec3 rCol = vec3(1.00, 0.96, 0.78) * heart * 2.10
+ vec3(1.00, 0.72, 0.18) * wisps * 1.55
+ vec3(0.98, 0.42, 0.05) * aura * 0.42
+ vec3(1.00, 0.82, 0.32) * trail * 1.15;
acc += rCol * yEnv * drFade * surge * dt * 1.95 * ribbonScale;
}
}
}
return acc;
}
// ============================================================================
// Floating Glowing Cyan Holographic Rune Diamonds (3D Planar Quads)
// ============================================================================
float sdFloatingSigil(vec2 uv, int style, float phase) {
float r = length(uv);
float g = 0.0;
if (style == 0) {
vec2 dUV = rot2(PI * 0.25) * uv;
float outerSq = abs(sdBox2(dUV, vec2(0.56)));
float innerSq = abs(sdBox2(dUV, vec2(0.46)));
float innerCirc = abs(r - 0.30);
float centerSq = abs(sdBox2(uv, vec2(0.16)));
float crossL = min(abs(uv.x), abs(uv.y));
float crossMask = smoothstep(0.58, 0.54, max(abs(dUV.x), abs(dUV.y)));
g += lineGlow(outerSq, 0.026, 0.060) * 1.25;
g += lineGlow(innerSq, 0.017, 0.036) * 0.78;
g += lineGlow(innerCirc, 0.020, 0.045) * 1.05;
g += lineMask(centerSq, 0.017) * 0.92;
g += lineMask(crossL, 0.013) * crossMask * 0.72;
g += smoothstep(0.075, 0.018, r) * 1.10;
vec2 cNode = abs(uv) - vec2(0.40, 0.0);
vec2 cNode2 = abs(uv) - vec2(0.0, 0.40);
g += smoothstep(0.060, 0.018, min(length(cNode), length(cNode2))) * 1.15;
} else {
vec2 rUV = rot2(phase * TAU * 0.25) * uv;
float c1 = abs(r - 0.56);
float c2 = abs(r - 0.44);
float c3 = abs(r - 0.20);
float sq = abs(sdBox2(rUV, vec2(0.31)));
float sq2 = abs(sdBox2(rot2(PI * 0.25) * rUV, vec2(0.31)));
g += lineGlow(c1, 0.026, 0.060) * 1.25;
g += lineGlow(c2, 0.017, 0.036) * 0.85;
g += lineGlow(c3, 0.018, 0.042) * 0.95;
g += lineMask(min(sq, sq2), 0.015) * 0.85;
g += smoothstep(0.065, 0.018, r) * 1.05;
}
return g;
}
vec3 renderFloatingRuneDiamonds(vec3 ro, vec3 rd, float tSolid, float phase, float sigilScale) {
float ang = phase * TAU;
vec3 acc = vec3(0.0);
for (int i = 0; i < 6; i++) {
float fi = float(i);
float theta = fi * (TAU / 6.0) + 0.42 + ang * ((mod(fi, 2.0) < 0.5) ? 1.0 : -1.0);
float rad = 1.16 + 0.26 * sin(fi * 1.7 + 0.5);
float yPos = 1.08 + fi * 0.34 + 0.10 * sin(ang * 2.0 + fi * 1.4);
vec3 center = vec3(cos(theta) * rad, yPos, sin(theta) * rad);
vec3 n = normalize(vec3(cos(theta), 0.15, sin(theta)));
float denom = dot(rd, n);
if (abs(denom) < 0.08) continue;
float tPlane = dot(center - ro, n) / denom;
if (tPlane <= 0.1 || tPlane >= tSolid) continue;
vec3 hit = ro + rd * tPlane;
vec3 rel = hit - center;
vec3 right = normalize(cross(vec3(0.0, 1.0, 0.0), n));
vec3 up = cross(n, right);
float size = 0.34 + 0.05 * sin(fi * 2.3);
vec2 uv = vec2(dot(rel, right), dot(rel, up)) / size;
if (max(abs(uv.x), abs(uv.y)) < 1.15) {
int style = (mod(fi, 3.0) > 1.5) ? 1 : 0;
float sig = sdFloatingSigil(uv, style, phase);
float win = smoothstep(1.12, 0.72, length(uv));
float pulse = 0.84 + 0.16 * sin(ang * 2.0 + fi * 1.5);
float facing = 0.58 + 0.42 * abs(denom);
vec3 cyanCol = mix(vec3(0.04, 0.82, 0.98), vec3(0.72, 1.00, 1.00), clamp(sig * 0.40, 0.0, 1.0));
acc += cyanCol * sig * win * pulse * facing * 1.05 * sigilScale;
}
}
return acc;
}
// ============================================================================
// Crisp Pinpoint Ascending Sparks & Fine Glowing Embers (Zero Blurry Ovals)
// ============================================================================
vec3 renderSharpSparks(vec3 ro, vec3 rd, float tSolid, vec2 uv, float phase) {
float ang = phase * TAU;
vec3 col = vec3(0.0);
// 44 crisp tiny pinpoint sparks swarming upward along the helical ribbon & pillar
for (int i = 0; i < 44; i++) {
float fi = float(i);
float life = fract(phase + hash11(fi * 7.13 + 0.5));
float env = sin(life * PI);
float y = 0.18 + life * 4.15;
// Half hug the spiraling golden ribbon, half rise closer to the central pillar
bool nearPillar = (mod(fi, 3.0) < 1.0);
float theta = fi * 2.39996 + y * (nearPillar ? 1.4 : 2.35) - ang * 2.0;
float rJitter = (hash11(fi * 3.7 + 1.1) - 0.5) * (nearPillar ? 0.55 : 0.62);
float r = nearPillar ? (0.35 + abs(rJitter)) : (helixRadius(y) + rJitter);
vec3 spPos = vec3(cos(theta) * r, y, sin(theta) * r);
vec3 toSp = spPos - ro;
float tProj = dot(toSp, rd);
if (tProj > 0.2 && tProj < tSolid) {
vec3 closest = ro + rd * tProj;
vec3 diff = closest - spPos;
// Tight, crisp pinpoint spark with subtle vertical motion stretch
diff.y *= 0.68;
float d2 = dot(diff, diff);
if (d2 < 0.008) {
float twinkle = 0.65 + 0.35 * sin(ang * 3.0 + fi * 4.1);
float core = exp(-d2 * 18500.0);
float halo = exp(-d2 * 3800.0) * 0.42;
vec3 sCol = (mod(fi, 5.0) < 1.0) ? vec3(0.10, 0.94, 1.00) : vec3(1.00, 0.68, 0.12);
col += (vec3(1.00, 0.97, 0.86) * core * 1.4 + sCol * halo) * env * twinkle * 1.65;
}
}
}
// 10 razor-thin dynamic ember streaks near outer edges (matches 10.png motion energy)
for (int i = 0; i < 10; i++) {
float fi = float(i);
float life = fract(phase + hash11(fi * 4.3 + 1.1));
float env = sin(life * PI);
float angle = hash11(fi * 9.7 + 0.3) * TAU;
vec2 dir = vec2(cos(angle), sin(angle) * 0.62 + 0.12);
vec2 pos = dir * (0.36 + life * 0.72);
vec2 d = uv - pos;
vec2 tangent = normalize(dir);
vec2 perp = vec2(-tangent.y, tangent.x);
float along = dot(d, tangent);
float across = dot(d, perp);
float streak = exp(-(along * along) / 0.00042 - (across * across) / 0.0000045);
vec3 eCol = (mod(fi, 3.0) < 1.0) ? vec3(0.12, 0.92, 1.00) : vec3(1.00, 0.60, 0.10);
col += eCol * streak * env * 0.78;
}
return col;
}
// ============================================================================
// ACES Filmic Tonemapping (Rich saturation, <1% clipping)
// ============================================================================
vec3 acesToneMap(vec3 x) {
const float a = 2.51;
const float b = 0.03;
const float c = 2.43;
const float d = 0.59;
const float e = 0.14;
return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 0.975);
}
// ============================================================================
// Main Shader Entry
// ============================================================================
void pixelfx_study_eval(vec2 pfx_frag_xy, out vec4 fragColor) {
vec2 uv = (pfx_frag_xy - 0.5 * uResolution.xy) / uResolution.y;
float phase = fract(uTime / 3.0);
float ang = phase * TAU;
// Camera Framing (uCamMode 0: Hero High-Angle, uCamMode 1: ~2.5x Macro)
vec3 ro, ta;
float fov;
if (uCamMode == 1) {
float sway = 0.06 * sin(ang);
ro = vec3(0.72 + sway, 1.56, 2.42);
ta = vec3(0.16, 0.46, 0.36);
fov = 1.92;
} else {
float sway = 0.09 * sin(ang);
ro = vec3(sway, 3.55, 5.18);
ta = vec3(0.0, 0.95, 0.0);
fov = 1.62;
}
vec3 cw = normalize(ta - ro);
vec3 cu = normalize(cross(cw, vec3(0.0, 1.0, 0.0)));
vec3 cv = cross(cu, cw);
vec3 rd = normalize(cu * uv.x + cv * uv.y + cw * fov);
// Deep Moody Dark Temple Void Backdrop with subtle atmospheric scatter
float bgGrad = clamp(uv.y * 0.7 + 0.45, 0.0, 1.0);
float mist = fbm2(uv * 3.4 + vec2(sin(ang) * 0.10, cos(ang) * 0.07));
vec3 bgCol;
if (uLightMode == 1) {
bgCol = vec3(mix(0.12, 0.18, bgGrad) + mist * 0.02);
} else if (uLightMode == 2) {
bgCol = mix(vec3(0.008, 0.010, 0.013), vec3(0.003, 0.004, 0.006), bgGrad) + mist * 0.003;
} else if (uLightMode == 3) {
float rimGlow = exp(-length(uv - vec2(0.0, 0.18)) * 2.4);
bgCol = mix(vec3(0.006, 0.009, 0.014), vec3(0.0025, 0.0035, 0.0055), bgGrad)
+ vec3(0.055, 0.075, 0.105) * rimGlow;
} else {
float mistBand = exp(-((uv.y - 0.04) * 3.0) * ((uv.y - 0.04) * 3.0));
float centralScatter = exp(-abs(uv.x) * 3.8) * smoothstep(-0.25, 0.55, uv.y);
bgCol = mix(vec3(0.0045, 0.0075, 0.0090), vec3(0.0020, 0.0030, 0.0040), bgGrad)
+ vec3(0.005, 0.014, 0.016) * mist * mistBand
+ vec3(0.028, 0.016, 0.005) * centralScatter * (0.65 + 0.35 * mist);
}
// Primary Raymarch (Stone Temple Floor + Jagged Levitating Stone Shards)
float t = 0.0;
float tMax = 18.0;
float matId = -1.0;
for (int i = 0; i < 64; i++) {
vec3 p = ro + rd * t;
vec2 h = mapSceneMat(p, phase);
if (h.x < 0.002) {
matId = h.y;
break;
}
t += h.x * 0.90;
if (t > tMax) break;
}
float tSolid = (matId >= 0.0) ? t : tMax;
vec3 col = bgCol;
// Surface Shading
if (matId >= 0.0) {
vec3 p = ro + rd * tSolid;
vec3 n = calcNormal(p, phase);
vec3 v = -rd;
float r = length(p.xz);
vec3 albedo;
float rough = 0.72;
vec3 circleEmit = vec3(0.0);
if (matId < 0.5) {
vec3 tile = stoneFloorPattern(p.xz);
float moss = smoothstep(0.62, 0.85, fbm2(p.xz * 2.2 + 4.2)) * tile.y;
float grain = fbm2(p.xz * 12.0);
albedo = mix(vec3(0.024, 0.028, 0.032), vec3(0.052, 0.056, 0.062), tile.z * 0.6 + grain * 0.4);
albedo = mix(albedo, vec3(0.008, 0.009, 0.011), tile.y * 0.82);
albedo = mix(albedo, vec3(0.024, 0.042, 0.018), moss * 0.55);
rough = mix(0.55, 0.92, tile.y);
circleEmit = evaluateSummoningCircle(p.xz, phase);
albedo *= (1.0 - circleEmit.z * 0.45);
} else {
float rockTex = fbm2(p.xz * 8.5 + p.y * 7.5);
albedo = mix(vec3(0.028, 0.030, 0.034), vec3(0.072, 0.068, 0.060), rockTex);
rough = 0.64;
}
vec3 lit = vec3(0.0);
if (uLightMode == 1) {
float grayAlb = dot(albedo, vec3(0.299, 0.587, 0.114)) * 3.4;
vec3 keyDir = normalize(vec3(0.45, 0.78, 0.42));
vec3 fillDir = normalize(vec3(-0.6, 0.45, 0.5));
float sh = calcSoftShadow(p + n * 0.015, keyDir, 0.04, 4.5, phase);
float diff1 = max(dot(n, keyDir), 0.0) * (0.30 + 0.70 * sh);
float diff2 = max(dot(n, fillDir), 0.0) * 0.28;
float fres = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 3.0);
float baseL = grayAlb * (0.30 + diff1 * 1.25 + diff2) + fres * 0.08;
float glyphL = (circleEmit.x * 0.42 + circleEmit.y * 0.34);
lit = vec3(baseL + glyphL * 0.55);
} else {
vec3 keyDir, keyCol, ambCol;
float magicBounceScale = 1.0;
if (uLightMode == 2) {
keyDir = normalize(vec3(0.92, 0.19, 0.34));
keyCol = vec3(1.55, 1.22, 0.88);
ambCol = vec3(0.012, 0.015, 0.019);
magicBounceScale = 0.45;
} else if (uLightMode == 3) {
keyDir = normalize(vec3(-0.20, 0.34, -0.92));
keyCol = vec3(0.95, 1.10, 1.32);
ambCol = vec3(0.008, 0.012, 0.016);
magicBounceScale = 0.55;
} else {
keyDir = normalize(vec3(0.30, 0.85, 0.42));
keyCol = vec3(0.14, 0.18, 0.22);
ambCol = vec3(0.009, 0.013, 0.016);
magicBounceScale = 1.0;
}
float sh = calcSoftShadow(p + n * 0.015, keyDir, 0.04, 4.5, phase);
float ndl = max(dot(n, keyDir), 0.0);
vec3 hVec = normalize(keyDir + v);
float spec = pow(max(dot(n, hVec), 1e-5), mix(42.0, 10.0, rough)) * (1.0 - rough * 0.55);
lit += albedo * (ambCol + keyCol * ndl * (0.20 + 0.80 * sh));
lit += keyCol * spec * 0.24 * sh;
if (uLightMode == 3) {
float rim = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 3.0);
float backAlign = clamp(dot(n, keyDir) * 0.5 + 0.5, 0.0, 1.0);
float rimStrength = (matId > 0.5) ? 1.15 : 0.10;
lit += vec3(0.55, 0.82, 1.05) * rim * (0.35 + 0.85 * backAlign) * rimStrength;
}
vec3 toPillar = vec3(-p.x, max(0.45 - p.y, 0.22), -p.z);
float distP = length(toPillar);
vec3 pDir = toPillar / max(distP, 0.001);
float pAtten = 1.0 / (0.45 + distP * distP * 0.65);
float pDiff = max(dot(n, pDir), 0.0);
vec3 pHalf = normalize(pDir + v);
float pSpec = pow(max(dot(n, pHalf), 1e-5), mix(34.0, 8.0, rough));
vec3 goldLight = vec3(1.00, 0.58, 0.12) * (1.45 + 0.15 * sin(ang * 2.0));
lit += albedo * goldLight * (pDiff * 1.45 + 0.18) * pAtten * magicBounceScale;
lit += goldLight * pSpec * 0.30 * pAtten * magicBounceScale;
float cyanRingDist = abs(r - 1.15);
float cyanAtten = exp(-cyanRingDist * 1.65) * exp(-abs(p.y - 0.30) * 0.85);
vec3 cyanLight = vec3(0.06, 0.86, 1.00);
lit += albedo * cyanLight * (0.45 + 0.55 * max(n.y, 0.0)) * cyanAtten * 0.72 * magicBounceScale;
if (matId > 0.5) {
float shardRim = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 2.4);
float towardPillar = clamp(dot(n, pDir) * 0.75 + 0.25, 0.0, 1.0);
float underCatch = clamp(-n.y * 0.65 + 0.20, 0.0, 1.0);
lit += vec3(1.00, 0.66, 0.16) * (shardRim * towardPillar * 0.90 + underCatch * towardPillar * 0.28) * magicBounceScale;
lit += vec3(0.10, 0.86, 1.00) * max(-n.y, 0.0) * 0.18 * magicBounceScale;
}
if (matId < 0.5) {
float macroCalm = (uCamMode == 1) ? 0.72 : 1.0;
float emitScale = ((uLightMode == 0) ? 1.0 : 0.65) * macroCalm;
vec3 goldCol = mix(vec3(1.00, 0.46, 0.04), vec3(1.00, 0.88, 0.48), clamp(circleEmit.x * 0.45, 0.0, 1.0));
vec3 cyanCol = mix(vec3(0.02, 0.72, 0.96), vec3(0.68, 1.00, 1.00), clamp(circleEmit.y * 0.45, 0.0, 1.0));
lit += goldCol * circleEmit.x * 1.18 * emitScale;
lit += cyanCol * circleEmit.y * 1.15 * emitScale;
}
}
float radialFade = (matId < 0.5) ? smoothstep(3.55, 5.85, r) : 0.0;
float distFog = 1.0 - exp(-max(tSolid - 5.2, 0.0) * 0.14);
float fog = clamp(max(radialFade * 0.92, distFog * 0.72), 0.0, 0.96);
col = mix(lit, bgCol, fog);
}
// Organic Turbulent Volumetric Pillar + Wispy Golden Spiral Ribbon + Cyan Sigils + Sparks
float macroBeamCalm = (uCamMode == 1) ? 0.58 : 1.0;
float beamScale = ((uLightMode == 1) ? 0.24 : ((uLightMode == 0) ? 1.0 : 0.62)) * macroBeamCalm;
float ribbonScale = ((uLightMode == 1) ? 0.46 : ((uLightMode == 0) ? 1.0 : 0.68)) * (uCamMode == 1 ? 0.82 : 1.0);
float sigilScale = ((uLightMode == 1) ? 0.50 : ((uLightMode == 0) ? 1.0 : 0.70));
vec3 volVFX = renderOrganicVolumetricVFX(ro, rd, tSolid, phase, beamScale, ribbonScale);
vec3 sigilsVFX = renderFloatingRuneDiamonds(ro, rd, tSolid, phase, sigilScale);
if (uLightMode == 1) {
float vL = dot(volVFX + sigilsVFX, vec3(0.299, 0.587, 0.114));
col += vec3(vL * 0.80);
} else {
col += volVFX + sigilsVFX;
if (uLightMode == 0) {
col += renderSharpSparks(ro, rd, tSolid, uv, phase);
}
}
// ACES Filmic Tonemapping, Gamma 2.2, & Strict Luminance Bounds
float exposure = (uLightMode == 1) ? 1.02 : 0.96;
col = acesToneMap(col * exposure);
col = pow(max(col, vec3(0.0)), vec3(1.0 / 2.2));
float vig = 1.0 - 0.18 * dot(uv, uv);
col *= clamp(vig, 0.76, 1.0);
col = max(col, vec3(0.024));
col = min(col, vec3(0.985));
if (uLightMode == 1) {
float g = dot(col, vec3(0.299, 0.587, 0.114));
col = vec3(g);
}
col *= (1.0 + 0.0 * uOpen);
fragColor = vec4(col, 1.0);
}
void fragment() {
vec2 tiled_uv = fract(UV * u_tiling);
vec2 frag_xy = vec2(tiled_uv.x, 1.0 - tiled_uv.y) * uResolution;
vec4 study_col = vec4(0.0, 0.0, 0.0, 1.0);
pixelfx_study_eval(frag_xy, study_col);
vec3 tinted = clamp(mix(study_col.rgb, study_col.rgb * u_tint.rgb * 1.35, u_tint_mix), 0.0, 1.0);
float luma = dot(tinted, vec3(0.2126, 0.7152, 0.0722));
ALBEDO = tinted;
if (u_luma_alpha_key) {
ALPHA = smoothstep(0.035, 0.22, luma);
}
}
// Summoning Circle Ascension Pillar — Three.js WebGL2 ShaderMaterial (GLSL3)
// Upstream study: https://github.com/gokayfem/glsl-studies/blob/main/vfx_animated/lib/10_summoning_circle_ascension_pillar.glsl (MIT License)
import * as THREE from 'three';
const vertexShader = /* glsl */ `
out vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`;
const fragmentShader = /* glsl */ `
precision highp float;
precision highp int;
uniform vec2 uResolution;
uniform float uTime;
uniform float uOpen;
uniform int uLightMode;
uniform int uCamMode;
out vec4 fragColor;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
// ============================================================================
// Math & Procedural Utilities (including Seamless Periodic fBM)
// ============================================================================
mat2 rot2(float a) {
float c = cos(a), s = sin(a);
return mat2(c, -s, s, c);
}
float hash11(float p) {
p = fract(p * 0.1031);
p *= p + 33.33;
p *= p + p;
return fract(p);
}
float hash12(vec2 p) {
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
float vnoise2(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
float a = hash12(i);
float b = hash12(i + vec2(1.0, 0.0));
float c = hash12(i + vec2(0.0, 1.0));
float d = hash12(i + vec2(1.0, 1.0));
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
float fbm2(vec2 p) {
float v = 0.0;
float a = 0.5;
mat2 m = mat2(0.8, 0.6, -0.6, 0.8);
for (int i = 0; i < 4; i++) {
v += a * vnoise2(p);
p = m * p * 2.03 + 17.1;
a *= 0.5;
}
return v;
}
// Tileable 2D value noise with exact integer period -> bit-exact seamless 3.0s animation
float vnoisePeriodic(vec2 p, vec2 period) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
vec2 i00 = mod(i, period);
vec2 i10 = mod(i + vec2(1.0, 0.0), period);
vec2 i01 = mod(i + vec2(0.0, 1.0), period);
vec2 i11 = mod(i + vec2(1.0, 1.0), period);
float a = hash12(i00);
float b = hash12(i10);
float c = hash12(i01);
float d = hash12(i11);
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
// 4-octave tileable fBM: shifting p by phase * period is 100% seamless across all octaves
float fbmPeriodic(vec2 p, vec2 period) {
float v = 0.0;
float a = 0.52;
for (int i = 0; i < 4; i++) {
v += a * vnoisePeriodic(p, period);
p = p * 2.0 + vec2(3.7, 5.1);
period *= 2.0;
a *= 0.5;
}
return v;
}
// ============================================================================
// 2D Geometric SDF Primitives for Arcane Summoning Circle & Floating Sigils
// ============================================================================
float sdRing(float r, float rad, float halfW) {
return abs(r - rad) - halfW;
}
float sdBox2(vec2 p, vec2 b) {
vec2 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0);
}
float sdEqTriangle(vec2 p, float r) {
const float k = 1.73205080757;
p.x = abs(p.x) - r;
p.y = p.y + r / k;
if (p.x + k * p.y > 0.0) p = vec2(p.x - k * p.y, -k * p.x - p.y) * 0.5;
p.x -= clamp(p.x, -2.0 * r, 0.0);
return -length(p) * sign(p.y);
}
float lineMask(float d, float width) {
return smoothstep(width, width * 0.15, abs(d));
}
float lineGlow(float d, float width, float halo) {
float core = smoothstep(width, width * 0.12, abs(d));
float soft = exp(-abs(d) / max(halo, 0.001));
return core + soft * 0.30;
}
// ============================================================================
// Dark Ancient Stone Temple Floor Paving & Relief
// ============================================================================
vec3 stoneFloorPattern(vec2 p) {
float r = length(p);
float th = atan(p.y, p.x);
float ringIdx = floor(r * 1.45);
float ringF = fract(r * 1.45);
float segCount = max(6.0, floor(6.0 + ringIdx * 5.0));
float segShift = hash11(ringIdx * 13.7 + 1.3) * TAU;
float thS = mod(th + segShift, TAU);
float segF = fract(thS / TAU * segCount);
float segIdx = floor(thS / TAU * segCount);
float nWarp = (vnoise2(p * 3.5) - 0.5) * 0.055;
float dRing = min(ringF, 1.0 - ringF) / 1.45;
float dSeg = min(segF, 1.0 - segF) * (TAU * max(r, 0.25) / segCount);
float seamDist = min(dRing, dSeg) + nWarp * 0.28;
float crackN = abs(fbm2(p * 2.8 + vec2(3.1, 7.4)) - 0.5);
float crack = smoothstep(0.020, 0.003, crackN) * smoothstep(0.35, 1.4, r);
float mortar = smoothstep(0.028, 0.004, seamDist);
float bevel = smoothstep(0.004, 0.052, seamDist);
float id = hash12(vec2(ringIdx, segIdx));
float h = bevel * (0.80 + 0.20 * id) - crack * 0.25;
return vec3(clamp(h, 0.0, 1.0), max(mortar, crack * 0.72), id);
}
// ============================================================================
// Arcane Summoning Circle Inscribed on Floor (y = 0)
// ============================================================================
vec3 evaluateSummoningCircle(vec2 p, float phase) {
float ang = phase * TAU;
float r = length(p);
float gold = 0.0;
float cyan = 0.0;
float groove = 0.0;
// Seamless outward radial ignition pulse over 3.0s
float pulseR = fract(phase) * 3.55;
float pulseEnv = sin(phase * PI);
float dPulse = (r - pulseR) * 4.2;
float pulseWave = exp(-(dPulse * dPulse)) * pulseEnv;
float breathe = 0.90 + 0.10 * sin(ang * 2.0);
// Zone 1: Focused Central Pillar Impact Pool & Inner Golden Double Ring
float coreCyan = exp(-r * r * 14.0) * (1.15 + 0.20 * sin(ang * 2.0));
float coreGold = exp(-r * r * 6.5) * (0.65 + 0.15 * sin(ang));
cyan += coreCyan;
gold += coreGold;
vec2 pInner = rot2(ang * 0.25) * p;
float rInner1 = sdRing(r, 0.44, 0.009);
float rInner2 = sdRing(r, 0.52, 0.012);
gold += lineGlow(rInner1, 0.012, 0.032) * 0.95 + lineGlow(rInner2, 0.014, 0.040) * 1.05;
groove = max(groove, max(lineMask(rInner1, 0.016), lineMask(rInner2, 0.018)));
float thIn = atan(pInner.y, pInner.x);
float spokeA = abs(fract(thIn / TAU * 16.0 + 0.5) - 0.5) * (TAU * max(r, 0.1) / 16.0);
float spokeMask = smoothstep(0.26, 0.30, r) * smoothstep(0.46, 0.43, r);
gold += lineMask(spokeA, 0.009) * spokeMask * 0.78;
// Zone 2: Inner Electric-Cyan 8-Pointed Octagram Star (+ang/4)
vec2 pStar = rot2(ang * 0.25) * p;
vec2 pStar45 = rot2(PI * 0.25) * pStar;
float octOuter = min(abs(sdBox2(pStar, vec2(0.84))), abs(sdBox2(pStar45, vec2(0.84))));
float octInner = min(abs(sdBox2(pStar, vec2(0.76))), abs(sdBox2(pStar45, vec2(0.76))));
float cyanStar = lineGlow(octOuter, 0.014, 0.048) * 1.25
+ lineGlow(octInner, 0.009, 0.026) * 0.65;
float thOct = atan(pStar.y, pStar.x);
float octSector = mod(thOct + PI / 8.0, PI / 4.0) - PI / 8.0;
vec2 pOctTip = vec2(cos(octSector), sin(octSector)) * r;
float tipDot = length(pOctTip - vec2(1.188, 0.0));
cyanStar += smoothstep(0.048, 0.012, tipDot) * 1.35 + exp(-tipDot * 18.0) * 0.45;
float rMid0 = sdRing(r, 0.72, 0.010);
gold += lineGlow(rMid0, 0.013, 0.036) * 0.95;
cyan += cyanStar * (1.0 + 0.38 * pulseWave);
groove = max(groove, lineMask(octOuter, 0.020));
// Zone 3: Mid Fiery-Gold Ring + 4 Cardinal Cyan Seal Medallions (-ang/4)
vec2 pMid = rot2(-ang * 0.25) * p;
float rBand1 = sdRing(r, 1.24, 0.011);
float rBand2 = sdRing(r, 1.33, 0.008);
float rBand3 = sdRing(r, 1.88, 0.012);
float rBand4 = sdRing(r, 1.97, 0.016);
gold += lineGlow(rBand1, 0.014, 0.042)
+ lineGlow(rBand2, 0.010, 0.026) * 0.72
+ lineGlow(rBand3, 0.014, 0.042)
+ lineGlow(rBand4, 0.018, 0.058) * 1.25;
groove = max(groove, max(lineMask(rBand1, 0.018), lineMask(rBand4, 0.022)));
float thMid = atan(pMid.y, pMid.x);
float qSector = mod(thMid + PI * 0.25, PI * 0.5) - PI * 0.25;
vec2 pMed = vec2(cos(qSector), sin(qSector)) * r - vec2(1.60, 0.0);
float dMed = length(pMed);
float medOuter = sdRing(dMed, 0.24, 0.010);
float medInner = sdRing(dMed, 0.16, 0.007);
float medCross = min(abs(pMed.x), abs(pMed.y));
float medBox = abs(sdBox2(rot2(PI * 0.25) * pMed, vec2(0.115)));
float medGlow = lineGlow(medOuter, 0.013, 0.042) * 1.25
+ lineGlow(medInner, 0.010, 0.028) * 0.90
+ lineMask(medBox, 0.009) * 0.90
+ lineMask(medCross, 0.008) * smoothstep(0.24, 0.22, dMed) * 0.75
+ smoothstep(0.042, 0.010, dMed) * 1.15;
cyan += medGlow * (1.0 + 0.45 * pulseWave);
groove = max(groove, lineMask(medOuter, 0.018));
float outsideMed = smoothstep(0.25, 0.30, dMed);
float bigOct = min(abs(sdBox2(pMid, vec2(1.38))), abs(sdBox2(rot2(PI * 0.25) * pMid, vec2(1.38))));
float bandMask = smoothstep(1.23, 1.28, r) * smoothstep(1.96, 1.90, r);
gold += lineGlow(bigOct, 0.011, 0.030) * bandMask * outsideMed * 0.95;
float runeAng = fract(thMid / TAU * 48.0);
float runeId = floor(thMid / TAU * 48.0);
float runeOn = step(0.28, hash11(runeId * 19.3 + 4.1));
float runeDash = smoothstep(0.12, 0.24, runeAng) * smoothstep(0.88, 0.76, runeAng);
float runeBand = smoothstep(0.042, 0.014, abs(r - 1.285));
gold += runeDash * runeBand * runeOn * 0.78;
// Zone 4: Outer Golden 12-Pointed Star Crown (+ang/12)
vec2 pCrown = rot2(ang / 12.0) * p;
float thCr = atan(pCrown.y, pCrown.x);
float crSeg = mod(thCr + PI / 12.0, TAU / 12.0) - PI / 12.0;
vec2 pTri = vec2(cos(crSeg), sin(crSeg)) * r - vec2(2.14, 0.0);
float dTri = sdEqTriangle(vec2(pTri.y, -pTri.x), 0.16);
float crownMask = smoothstep(1.96, 2.00, r);
gold += lineGlow(abs(dTri), 0.013, 0.044) * crownMask * 1.15;
groove = max(groove, lineMask(abs(dTri), 0.016) * crownMask);
// Zone 5: Outer Temple Boundary Circle & 6 Satellite Sub-Circles (-ang/6)
vec2 pOut = rot2(-ang / 6.0) * p;
float rOut1 = sdRing(r, 2.68, 0.009);
float rOut2 = sdRing(r, 3.05, 0.011);
float rOut3 = sdRing(r, 3.38, 0.009);
gold += lineGlow(rOut1, 0.011, 0.028) * 0.62
+ lineGlow(rOut2, 0.013, 0.036) * 0.75
+ lineGlow(rOut3, 0.011, 0.028) * 0.52;
float thOut = atan(pOut.y, pOut.x);
float satSec = mod(thOut + PI / 6.0, TAU / 6.0) - PI / 6.0;
vec2 pSat = vec2(cos(satSec), sin(satSec)) * r - vec2(3.05, 0.0);
float dSat = length(pSat);
float satR1 = sdRing(dSat, 0.38, 0.009);
float satR2 = sdRing(dSat, 0.30, 0.007);
float satTri = min(abs(sdEqTriangle(pSat, 0.20)), abs(sdEqTriangle(vec2(pSat.x, -pSat.y), 0.20)));
gold += lineGlow(satR1, 0.012, 0.032) * 0.78
+ lineGlow(satR2, 0.009, 0.024) * 0.60
+ lineMask(satTri, 0.009) * 0.65
+ smoothstep(0.032, 0.009, dSat) * 0.55;
groove = max(groove, lineMask(satR1, 0.014));
float pulseBoost = 1.0 + 0.55 * pulseWave;
gold *= breathe * pulseBoost;
cyan *= (0.94 + 0.06 * cos(ang * 2.0)) * pulseBoost;
return vec3(gold, cyan, groove);
}
// ============================================================================
// Jagged Craggy Levitating Stone Shards (10 Sharp Faceted Rocks in Orbit)
// ============================================================================
struct ShardTransform {
vec3 pos;
float radius;
float angY;
float angX;
float seed;
};
ShardTransform getShard(int i, float phase) {
float fi = float(i);
float ang = phase * TAU;
float baseTheta = fi * 1.24 + 0.42;
float orbitDir = (mod(fi, 2.0) < 0.5) ? 1.0 : -1.0;
float theta = baseTheta + ang * orbitDir;
float hBase = 0.78 + fi * 0.26;
float bob = 0.085 * sin(ang * 2.0 + fi * 1.7);
float radOrbit = 1.22 + 0.46 * sin(fi * 0.88 + 0.35) + 0.05 * cos(ang + fi);
ShardTransform st;
st.pos = vec3(cos(theta) * radOrbit, hBase + bob, sin(theta) * radOrbit);
st.radius = 0.145 + 0.065 * hash11(fi * 7.3 + 2.1);
st.angY = fi * 2.1 + ang * orbitDir;
st.angX = fi * 1.4 + ang;
st.seed = fi * 3.7 + 1.2;
return st;
}
float sdStoneShard(vec3 p, float rad, float seed) {
vec3 q = p / vec3(1.22, 0.74, 0.90);
float d = -1e5;
d = max(d, dot(q, normalize(vec3( 0.85, 0.42, 0.30))) - rad * (0.68 + 0.12 * sin(seed)));
d = max(d, dot(q, normalize(vec3(-0.78, 0.50, -0.36))) - rad * (0.64 + 0.11 * cos(seed * 1.3)));
d = max(d, dot(q, normalize(vec3( 0.24, -0.90, 0.36))) - rad * (0.58 + 0.10 * sin(seed * 2.1)));
d = max(d, dot(q, normalize(vec3(-0.32, -0.44, 0.84))) - rad * (0.66 + 0.10 * cos(seed * 1.7)));
d = max(d, dot(q, normalize(vec3( 0.44, 0.22, -0.86))) - rad * (0.62 + 0.12 * sin(seed * 0.7)));
d = max(d, dot(q, normalize(vec3(-0.62, -0.68, -0.38))) - rad * (0.60 + 0.09 * cos(seed * 2.7)));
d = max(d, dot(q, normalize(vec3( 0.18, 0.94, -0.28))) - rad * (0.56 + 0.10 * sin(seed * 1.9)));
d = max(d, dot(q, normalize(vec3( 0.72, -0.48, -0.49))) - rad * (0.65 + 0.08 * cos(seed * 3.1)));
d = max(d, dot(q, normalize(vec3(-0.88, 0.12, 0.46))) - rad * (0.63 + 0.09 * sin(seed * 2.5)));
float chip1 = abs(sin(q.x * 19.0 + seed) * cos(q.y * 17.0 - seed) + sin(q.z * 21.0)) * 0.011;
float chip2 = abs(sin((q.x + q.z) * 31.0 + seed * 2.0)) * 0.005;
return (d + chip1 - chip2) * 0.68;
}
vec2 mapSceneMat(vec3 p, float phase) {
float r = length(p.xz);
float floorH = 0.0;
if (abs(p.y) < 0.24) {
vec3 tile = stoneFloorPattern(p.xz);
floorH = (tile.x - 0.5) * 0.026 - tile.y * 0.018;
floorH += smoothstep(3.65, 3.80, r) * 0.12;
}
float dFloor = p.y - floorH;
vec2 res = vec2(dFloor, 0.0);
float r2 = dot(p.xz, p.xz);
if (p.y > 0.35 && p.y < 3.75 && r2 < 5.2) {
for (int i = 0; i < 10; i++) {
ShardTransform st = getShard(i, phase);
vec3 dPos = p - st.pos;
float bDist = length(dPos) - st.radius * 1.38;
if (bDist < res.x) {
vec3 lp = dPos;
lp.xz = rot2(st.angY) * lp.xz;
lp.yz = rot2(st.angX) * lp.yz;
float dS = sdStoneShard(lp, st.radius, st.seed);
if (dS < res.x) {
res = vec2(dS, 1.0);
}
}
}
}
return res;
}
float mapScene(vec3 p, float phase) {
return mapSceneMat(p, phase).x;
}
// Unit-sign tetrahedral normal
vec3 calcNormal(vec3 p, float phase) {
const float h = 0.0022;
const vec2 k = vec2(1.0, -1.0);
return normalize(
k.xyy * mapScene(p + k.xyy * h, phase) +
k.yyx * mapScene(p + k.yyx * h, phase) +
k.yxy * mapScene(p + k.yxy * h, phase) +
k.xxx * mapScene(p + k.xxx * h, phase)
);
}
float calcSoftShadow(vec3 ro, vec3 rd, float tMin, float tMax, float phase) {
float res = 1.0;
float t = tMin;
for (int i = 0; i < 16; i++) {
float h = mapScene(ro + rd * t, phase);
if (h < 0.002) return 0.0;
res = min(res, 7.0 * h / t);
t += clamp(h, 0.035, 0.32);
if (t > tMax) break;
}
return clamp(res, 0.0, 1.0);
}
// ============================================================================
// Organic Turbulent Volumetric Golden Ascension Pillar + Wispy Swirling Ribbon
// Zero stipple, zero tape-stripes, zero bounding-cylinder seams!
// ============================================================================
float helixRadius(float y) {
float flare = 0.48 + 0.86 * smoothstep(0.05, 1.60, y) - 0.22 * smoothstep(2.4, 4.3, y);
return flare + 0.14 * sin(y * 1.95);
}
vec2 intersectCylinderY(vec3 ro, vec3 rd, float R) {
float a = dot(rd.xz, rd.xz);
float b = dot(ro.xz, rd.xz);
float c = dot(ro.xz, ro.xz) - R * R;
float disc = b * b - a * c;
if (disc < 0.0 || a < 1e-6) return vec2(1e9, -1e9);
float s = sqrt(disc);
return vec2((-b - s) / a, (-b + s) / a);
}
// Unified smooth volumetric pass: blazing ascension pillar + atmospheric light-beam scatter
// + organic, wispy, domain-warped turbulent golden energy ribbon (48 smooth steps, zero jitter)
vec3 renderOrganicVolumetricVFX(vec3 ro, vec3 rd, float tSolid, float phase, float beamScale, float ribbonScale) {
float ang = phase * TAU;
vec3 acc = vec3(0.0);
// Wide smooth bounding cylinder R = 2.05 (all fields smoothly fade to 0.0 before R = 1.95)
vec2 cyl = intersectCylinderY(ro, rd, 2.05);
float t0 = max(cyl.x, 0.05);
float t1 = min(cyl.y, tSolid);
if (t1 <= t0) return vec3(0.0);
const int STEPS = 48;
float dt = (t1 - t0) / float(STEPS);
float pillarPulse = 1.0 + 0.06 * sin(ang) + 0.03 * sin(ang * 2.0);
float coreRad = 0.145 * pillarPulse;
for (int i = 0; i < STEPS; i++) {
float t = t0 + (float(i) + 0.5) * dt;
vec3 p = ro + rd * t;
if (p.y < 0.01 || p.y > 4.95) continue;
float r = length(p.xz);
float th = atan(p.z, p.x);
// --------------------------------------------------------------------
// 1. Blazing Ascension Pillar + Turbulent Upward Plasma + Atmospheric Scatter
// --------------------------------------------------------------------
if (r < 1.85) {
// Smooth radial fade to exact 0.0 before boundary (zero cylinder edge!)
float rWin = smoothstep(1.85, 0.45, r);
// Seamless upward-streaming turbulent plasma inside the pillar
// Period = (8, 8): theta wraps around 8, y advances by phase * 8.0
vec2 pUV = vec2(th / TAU * 8.0, p.y * 1.45 - phase * 8.0);
float warpP = fbmPeriodic(pUV * 0.75, vec2(6.0, 6.0));
float plasma = fbmPeriodic(pUV + vec2(warpP * 1.1, -warpP * 0.6), vec2(8.0, 8.0));
float baseFlare = 1.0 + 0.48 * exp(-p.y * 3.8);
float rNorm = r / (coreRad * baseFlare);
float hotCore = exp(-rNorm * rNorm * 3.6) * (0.72 + 0.42 * plasma);
float midPlume = exp(-rNorm * rNorm * 0.95) * (0.45 + 0.65 * plasma);
// Rich atmospheric light-beam scatter (soft golden-amber god-ray aura)
float beamScatter = exp(-r * 2.15) * (0.68 + 0.32 * warpP) * rWin;
// Subtle cyan-white impact mist right at the summoning circle center
float baseCyanMist = exp(-p.y * 3.6) * exp(-r * r * 5.2) * (0.7 + 0.4 * plasma);
vec3 pCol = vec3(1.00, 0.97, 0.84) * hotCore * 1.38
+ vec3(1.00, 0.68, 0.16) * midPlume * 0.76
+ vec3(0.95, 0.46, 0.08) * beamScatter * 0.24
+ vec3(0.16, 0.92, 1.00) * baseCyanMist * 0.75;
acc += pCol * dt * 1.65 * beamScale;
}
// --------------------------------------------------------------------
// 2. Organic, Wispy, Turbulent Swirling Volumetric Golden Energy Ribbon
// --------------------------------------------------------------------
if (p.y > 0.04 && p.y < 4.75) {
float rH = helixRadius(p.y);
float dr = r - rH;
if (abs(dr) < 0.46) {
float pitch = 2.40;
// Seamless 2 full helical turns per 3.0s loop
float hAng = p.y * pitch - ang * 2.0;
float dTh = mod(th - hAng + PI, TAU) - PI;
float dy = dTh / pitch;
// Smooth tilted ribbon local frame
float uLoc = dr * 0.88 - dy * 0.47; // thin cross-ribbon thickness
float vLoc = dr * 0.47 + dy * 0.88; // wide sweeping ribbon breadth
// Seamless domain-warped turbulence flowing rapidly along the spiral arc!
// Arc coord advances seamlessly by phase * 8.0 (matches period 8.0)
float arcCoord = p.y * 1.85 - phase * 8.0;
vec2 flowUV = vec2(arcCoord, vLoc * 5.2 + uLoc * 3.5);
float n1 = fbmPeriodic(flowUV * 0.75, vec2(6.0, 6.0));
float n2 = fbmPeriodic(flowUV * vec2(1.0, 2.4) + vec2(n1 * 1.45, -n1 * 1.15), vec2(8.0, 12.0));
// Organic meandering warp of the ribbon sheet (eliminates stiff geometric tape!)
float uWarp = uLoc + (n1 - 0.5) * 0.14;
float vWarp = vLoc + (n2 - 0.5) * 0.16;
// Smooth envelope tapering gracefully at floor base and upper sky
float yEnv = smoothstep(0.04, 0.42, p.y) * smoothstep(4.75, 3.85, p.y);
float drFade = smoothstep(0.46, 0.18, abs(dr));
// (a) Incandescent sinuous plasma heart (pinches & swells organically)
float coreW = 0.032 + 0.022 * n1;
float heart = exp(-(uWarp * uWarp) / 0.0028 - (vWarp * vWarp) / (coreW * coreW));
heart *= (0.55 + 0.85 * smoothstep(0.28, 0.82, n2));
// (b) Wispy turbulent golden plasma tendrils & feathery streaming wisps
float wispEnv = exp(-(uWarp * uWarp) / 0.014 - (vLoc * vLoc) / 0.044);
float wispyFilaments = smoothstep(0.32, 0.85, n2) * (0.55 + 0.45 * n1);
float wisps = wispEnv * wispyFilaments;
// (c) Soft fiery-amber volumetric glow aura enveloping the turbulent stream
float aura = exp(-(uLoc * uLoc) / 0.038 - (vLoc * vLoc) / 0.085) * (0.45 + 0.55 * n1);
// (d) Delicate secondary trailing golden wisp spiraling slightly behind
float dTh2 = mod(th - (hAng + 0.62) + PI, TAU) - PI;
float dy2 = dTh2 / pitch;
float dr2 = r - (rH + 0.13);
float nTrail = fbmPeriodic(vec2(arcCoord + 2.0, dy2 * 7.5), vec2(8.0, 8.0));
float trail = exp(-(dr2 * dr2) / 0.0045 - (dy2 * dy2) / 0.0075) * smoothstep(0.30, 0.82, nTrail);
// Traveling energy surge along the spiral
float surge = 0.80 + 0.25 * sin(p.y * 2.8 - ang * 4.0);
vec3 rCol = vec3(1.00, 0.96, 0.78) * heart * 2.10
+ vec3(1.00, 0.72, 0.18) * wisps * 1.55
+ vec3(0.98, 0.42, 0.05) * aura * 0.42
+ vec3(1.00, 0.82, 0.32) * trail * 1.15;
acc += rCol * yEnv * drFade * surge * dt * 1.95 * ribbonScale;
}
}
}
return acc;
}
// ============================================================================
// Floating Glowing Cyan Holographic Rune Diamonds (3D Planar Quads)
// ============================================================================
float sdFloatingSigil(vec2 uv, int style, float phase) {
float r = length(uv);
float g = 0.0;
if (style == 0) {
vec2 dUV = rot2(PI * 0.25) * uv;
float outerSq = abs(sdBox2(dUV, vec2(0.56)));
float innerSq = abs(sdBox2(dUV, vec2(0.46)));
float innerCirc = abs(r - 0.30);
float centerSq = abs(sdBox2(uv, vec2(0.16)));
float crossL = min(abs(uv.x), abs(uv.y));
float crossMask = smoothstep(0.58, 0.54, max(abs(dUV.x), abs(dUV.y)));
g += lineGlow(outerSq, 0.026, 0.060) * 1.25;
g += lineGlow(innerSq, 0.017, 0.036) * 0.78;
g += lineGlow(innerCirc, 0.020, 0.045) * 1.05;
g += lineMask(centerSq, 0.017) * 0.92;
g += lineMask(crossL, 0.013) * crossMask * 0.72;
g += smoothstep(0.075, 0.018, r) * 1.10;
vec2 cNode = abs(uv) - vec2(0.40, 0.0);
vec2 cNode2 = abs(uv) - vec2(0.0, 0.40);
g += smoothstep(0.060, 0.018, min(length(cNode), length(cNode2))) * 1.15;
} else {
vec2 rUV = rot2(phase * TAU * 0.25) * uv;
float c1 = abs(r - 0.56);
float c2 = abs(r - 0.44);
float c3 = abs(r - 0.20);
float sq = abs(sdBox2(rUV, vec2(0.31)));
float sq2 = abs(sdBox2(rot2(PI * 0.25) * rUV, vec2(0.31)));
g += lineGlow(c1, 0.026, 0.060) * 1.25;
g += lineGlow(c2, 0.017, 0.036) * 0.85;
g += lineGlow(c3, 0.018, 0.042) * 0.95;
g += lineMask(min(sq, sq2), 0.015) * 0.85;
g += smoothstep(0.065, 0.018, r) * 1.05;
}
return g;
}
vec3 renderFloatingRuneDiamonds(vec3 ro, vec3 rd, float tSolid, float phase, float sigilScale) {
float ang = phase * TAU;
vec3 acc = vec3(0.0);
for (int i = 0; i < 6; i++) {
float fi = float(i);
float theta = fi * (TAU / 6.0) + 0.42 + ang * ((mod(fi, 2.0) < 0.5) ? 1.0 : -1.0);
float rad = 1.16 + 0.26 * sin(fi * 1.7 + 0.5);
float yPos = 1.08 + fi * 0.34 + 0.10 * sin(ang * 2.0 + fi * 1.4);
vec3 center = vec3(cos(theta) * rad, yPos, sin(theta) * rad);
vec3 n = normalize(vec3(cos(theta), 0.15, sin(theta)));
float denom = dot(rd, n);
if (abs(denom) < 0.08) continue;
float tPlane = dot(center - ro, n) / denom;
if (tPlane <= 0.1 || tPlane >= tSolid) continue;
vec3 hit = ro + rd * tPlane;
vec3 rel = hit - center;
vec3 right = normalize(cross(vec3(0.0, 1.0, 0.0), n));
vec3 up = cross(n, right);
float size = 0.34 + 0.05 * sin(fi * 2.3);
vec2 uv = vec2(dot(rel, right), dot(rel, up)) / size;
if (max(abs(uv.x), abs(uv.y)) < 1.15) {
int style = (mod(fi, 3.0) > 1.5) ? 1 : 0;
float sig = sdFloatingSigil(uv, style, phase);
float win = smoothstep(1.12, 0.72, length(uv));
float pulse = 0.84 + 0.16 * sin(ang * 2.0 + fi * 1.5);
float facing = 0.58 + 0.42 * abs(denom);
vec3 cyanCol = mix(vec3(0.04, 0.82, 0.98), vec3(0.72, 1.00, 1.00), clamp(sig * 0.40, 0.0, 1.0));
acc += cyanCol * sig * win * pulse * facing * 1.05 * sigilScale;
}
}
return acc;
}
// ============================================================================
// Crisp Pinpoint Ascending Sparks & Fine Glowing Embers (Zero Blurry Ovals)
// ============================================================================
vec3 renderSharpSparks(vec3 ro, vec3 rd, float tSolid, vec2 uv, float phase) {
float ang = phase * TAU;
vec3 col = vec3(0.0);
// 44 crisp tiny pinpoint sparks swarming upward along the helical ribbon & pillar
for (int i = 0; i < 44; i++) {
float fi = float(i);
float life = fract(phase + hash11(fi * 7.13 + 0.5));
float env = sin(life * PI);
float y = 0.18 + life * 4.15;
// Half hug the spiraling golden ribbon, half rise closer to the central pillar
bool nearPillar = (mod(fi, 3.0) < 1.0);
float theta = fi * 2.39996 + y * (nearPillar ? 1.4 : 2.35) - ang * 2.0;
float rJitter = (hash11(fi * 3.7 + 1.1) - 0.5) * (nearPillar ? 0.55 : 0.62);
float r = nearPillar ? (0.35 + abs(rJitter)) : (helixRadius(y) + rJitter);
vec3 spPos = vec3(cos(theta) * r, y, sin(theta) * r);
vec3 toSp = spPos - ro;
float tProj = dot(toSp, rd);
if (tProj > 0.2 && tProj < tSolid) {
vec3 closest = ro + rd * tProj;
vec3 diff = closest - spPos;
// Tight, crisp pinpoint spark with subtle vertical motion stretch
diff.y *= 0.68;
float d2 = dot(diff, diff);
if (d2 < 0.008) {
float twinkle = 0.65 + 0.35 * sin(ang * 3.0 + fi * 4.1);
float core = exp(-d2 * 18500.0);
float halo = exp(-d2 * 3800.0) * 0.42;
vec3 sCol = (mod(fi, 5.0) < 1.0) ? vec3(0.10, 0.94, 1.00) : vec3(1.00, 0.68, 0.12);
col += (vec3(1.00, 0.97, 0.86) * core * 1.4 + sCol * halo) * env * twinkle * 1.65;
}
}
}
// 10 razor-thin dynamic ember streaks near outer edges (matches 10.png motion energy)
for (int i = 0; i < 10; i++) {
float fi = float(i);
float life = fract(phase + hash11(fi * 4.3 + 1.1));
float env = sin(life * PI);
float angle = hash11(fi * 9.7 + 0.3) * TAU;
vec2 dir = vec2(cos(angle), sin(angle) * 0.62 + 0.12);
vec2 pos = dir * (0.36 + life * 0.72);
vec2 d = uv - pos;
vec2 tangent = normalize(dir);
vec2 perp = vec2(-tangent.y, tangent.x);
float along = dot(d, tangent);
float across = dot(d, perp);
float streak = exp(-(along * along) / 0.00042 - (across * across) / 0.0000045);
vec3 eCol = (mod(fi, 3.0) < 1.0) ? vec3(0.12, 0.92, 1.00) : vec3(1.00, 0.60, 0.10);
col += eCol * streak * env * 0.78;
}
return col;
}
// ============================================================================
// ACES Filmic Tonemapping (Rich saturation, <1% clipping)
// ============================================================================
vec3 acesToneMap(vec3 x) {
const float a = 2.51;
const float b = 0.03;
const float c = 2.43;
const float d = 0.59;
const float e = 0.14;
return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 0.975);
}
// ============================================================================
// Main Shader Entry
// ============================================================================
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * uResolution.xy) / uResolution.y;
float phase = fract(uTime / 3.0);
float ang = phase * TAU;
// Camera Framing (uCamMode 0: Hero High-Angle, uCamMode 1: ~2.5x Macro)
vec3 ro, ta;
float fov;
if (uCamMode == 1) {
float sway = 0.06 * sin(ang);
ro = vec3(0.72 + sway, 1.56, 2.42);
ta = vec3(0.16, 0.46, 0.36);
fov = 1.92;
} else {
float sway = 0.09 * sin(ang);
ro = vec3(sway, 3.55, 5.18);
ta = vec3(0.0, 0.95, 0.0);
fov = 1.62;
}
vec3 cw = normalize(ta - ro);
vec3 cu = normalize(cross(cw, vec3(0.0, 1.0, 0.0)));
vec3 cv = cross(cu, cw);
vec3 rd = normalize(cu * uv.x + cv * uv.y + cw * fov);
// Deep Moody Dark Temple Void Backdrop with subtle atmospheric scatter
float bgGrad = clamp(uv.y * 0.7 + 0.45, 0.0, 1.0);
float mist = fbm2(uv * 3.4 + vec2(sin(ang) * 0.10, cos(ang) * 0.07));
vec3 bgCol;
if (uLightMode == 1) {
bgCol = vec3(mix(0.12, 0.18, bgGrad) + mist * 0.02);
} else if (uLightMode == 2) {
bgCol = mix(vec3(0.008, 0.010, 0.013), vec3(0.003, 0.004, 0.006), bgGrad) + mist * 0.003;
} else if (uLightMode == 3) {
float rimGlow = exp(-length(uv - vec2(0.0, 0.18)) * 2.4);
bgCol = mix(vec3(0.006, 0.009, 0.014), vec3(0.0025, 0.0035, 0.0055), bgGrad)
+ vec3(0.055, 0.075, 0.105) * rimGlow;
} else {
float mistBand = exp(-((uv.y - 0.04) * 3.0) * ((uv.y - 0.04) * 3.0));
float centralScatter = exp(-abs(uv.x) * 3.8) * smoothstep(-0.25, 0.55, uv.y);
bgCol = mix(vec3(0.0045, 0.0075, 0.0090), vec3(0.0020, 0.0030, 0.0040), bgGrad)
+ vec3(0.005, 0.014, 0.016) * mist * mistBand
+ vec3(0.028, 0.016, 0.005) * centralScatter * (0.65 + 0.35 * mist);
}
// Primary Raymarch (Stone Temple Floor + Jagged Levitating Stone Shards)
float t = 0.0;
float tMax = 18.0;
float matId = -1.0;
for (int i = 0; i < 64; i++) {
vec3 p = ro + rd * t;
vec2 h = mapSceneMat(p, phase);
if (h.x < 0.002) {
matId = h.y;
break;
}
t += h.x * 0.90;
if (t > tMax) break;
}
float tSolid = (matId >= 0.0) ? t : tMax;
vec3 col = bgCol;
// Surface Shading
if (matId >= 0.0) {
vec3 p = ro + rd * tSolid;
vec3 n = calcNormal(p, phase);
vec3 v = -rd;
float r = length(p.xz);
vec3 albedo;
float rough = 0.72;
vec3 circleEmit = vec3(0.0);
if (matId < 0.5) {
vec3 tile = stoneFloorPattern(p.xz);
float moss = smoothstep(0.62, 0.85, fbm2(p.xz * 2.2 + 4.2)) * tile.y;
float grain = fbm2(p.xz * 12.0);
albedo = mix(vec3(0.024, 0.028, 0.032), vec3(0.052, 0.056, 0.062), tile.z * 0.6 + grain * 0.4);
albedo = mix(albedo, vec3(0.008, 0.009, 0.011), tile.y * 0.82);
albedo = mix(albedo, vec3(0.024, 0.042, 0.018), moss * 0.55);
rough = mix(0.55, 0.92, tile.y);
circleEmit = evaluateSummoningCircle(p.xz, phase);
albedo *= (1.0 - circleEmit.z * 0.45);
} else {
float rockTex = fbm2(p.xz * 8.5 + p.y * 7.5);
albedo = mix(vec3(0.028, 0.030, 0.034), vec3(0.072, 0.068, 0.060), rockTex);
rough = 0.64;
}
vec3 lit = vec3(0.0);
if (uLightMode == 1) {
float grayAlb = dot(albedo, vec3(0.299, 0.587, 0.114)) * 3.4;
vec3 keyDir = normalize(vec3(0.45, 0.78, 0.42));
vec3 fillDir = normalize(vec3(-0.6, 0.45, 0.5));
float sh = calcSoftShadow(p + n * 0.015, keyDir, 0.04, 4.5, phase);
float diff1 = max(dot(n, keyDir), 0.0) * (0.30 + 0.70 * sh);
float diff2 = max(dot(n, fillDir), 0.0) * 0.28;
float fres = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 3.0);
float baseL = grayAlb * (0.30 + diff1 * 1.25 + diff2) + fres * 0.08;
float glyphL = (circleEmit.x * 0.42 + circleEmit.y * 0.34);
lit = vec3(baseL + glyphL * 0.55);
} else {
vec3 keyDir, keyCol, ambCol;
float magicBounceScale = 1.0;
if (uLightMode == 2) {
keyDir = normalize(vec3(0.92, 0.19, 0.34));
keyCol = vec3(1.55, 1.22, 0.88);
ambCol = vec3(0.012, 0.015, 0.019);
magicBounceScale = 0.45;
} else if (uLightMode == 3) {
keyDir = normalize(vec3(-0.20, 0.34, -0.92));
keyCol = vec3(0.95, 1.10, 1.32);
ambCol = vec3(0.008, 0.012, 0.016);
magicBounceScale = 0.55;
} else {
keyDir = normalize(vec3(0.30, 0.85, 0.42));
keyCol = vec3(0.14, 0.18, 0.22);
ambCol = vec3(0.009, 0.013, 0.016);
magicBounceScale = 1.0;
}
float sh = calcSoftShadow(p + n * 0.015, keyDir, 0.04, 4.5, phase);
float ndl = max(dot(n, keyDir), 0.0);
vec3 hVec = normalize(keyDir + v);
float spec = pow(max(dot(n, hVec), 1e-5), mix(42.0, 10.0, rough)) * (1.0 - rough * 0.55);
lit += albedo * (ambCol + keyCol * ndl * (0.20 + 0.80 * sh));
lit += keyCol * spec * 0.24 * sh;
if (uLightMode == 3) {
float rim = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 3.0);
float backAlign = clamp(dot(n, keyDir) * 0.5 + 0.5, 0.0, 1.0);
float rimStrength = (matId > 0.5) ? 1.15 : 0.10;
lit += vec3(0.55, 0.82, 1.05) * rim * (0.35 + 0.85 * backAlign) * rimStrength;
}
vec3 toPillar = vec3(-p.x, max(0.45 - p.y, 0.22), -p.z);
float distP = length(toPillar);
vec3 pDir = toPillar / max(distP, 0.001);
float pAtten = 1.0 / (0.45 + distP * distP * 0.65);
float pDiff = max(dot(n, pDir), 0.0);
vec3 pHalf = normalize(pDir + v);
float pSpec = pow(max(dot(n, pHalf), 1e-5), mix(34.0, 8.0, rough));
vec3 goldLight = vec3(1.00, 0.58, 0.12) * (1.45 + 0.15 * sin(ang * 2.0));
lit += albedo * goldLight * (pDiff * 1.45 + 0.18) * pAtten * magicBounceScale;
lit += goldLight * pSpec * 0.30 * pAtten * magicBounceScale;
float cyanRingDist = abs(r - 1.15);
float cyanAtten = exp(-cyanRingDist * 1.65) * exp(-abs(p.y - 0.30) * 0.85);
vec3 cyanLight = vec3(0.06, 0.86, 1.00);
lit += albedo * cyanLight * (0.45 + 0.55 * max(n.y, 0.0)) * cyanAtten * 0.72 * magicBounceScale;
if (matId > 0.5) {
float shardRim = pow(max(1.0 - max(dot(n, v), 0.0), 1e-5), 2.4);
float towardPillar = clamp(dot(n, pDir) * 0.75 + 0.25, 0.0, 1.0);
float underCatch = clamp(-n.y * 0.65 + 0.20, 0.0, 1.0);
lit += vec3(1.00, 0.66, 0.16) * (shardRim * towardPillar * 0.90 + underCatch * towardPillar * 0.28) * magicBounceScale;
lit += vec3(0.10, 0.86, 1.00) * max(-n.y, 0.0) * 0.18 * magicBounceScale;
}
if (matId < 0.5) {
float macroCalm = (uCamMode == 1) ? 0.72 : 1.0;
float emitScale = ((uLightMode == 0) ? 1.0 : 0.65) * macroCalm;
vec3 goldCol = mix(vec3(1.00, 0.46, 0.04), vec3(1.00, 0.88, 0.48), clamp(circleEmit.x * 0.45, 0.0, 1.0));
vec3 cyanCol = mix(vec3(0.02, 0.72, 0.96), vec3(0.68, 1.00, 1.00), clamp(circleEmit.y * 0.45, 0.0, 1.0));
lit += goldCol * circleEmit.x * 1.18 * emitScale;
lit += cyanCol * circleEmit.y * 1.15 * emitScale;
}
}
float radialFade = (matId < 0.5) ? smoothstep(3.55, 5.85, r) : 0.0;
float distFog = 1.0 - exp(-max(tSolid - 5.2, 0.0) * 0.14);
float fog = clamp(max(radialFade * 0.92, distFog * 0.72), 0.0, 0.96);
col = mix(lit, bgCol, fog);
}
// Organic Turbulent Volumetric Pillar + Wispy Golden Spiral Ribbon + Cyan Sigils + Sparks
float macroBeamCalm = (uCamMode == 1) ? 0.58 : 1.0;
float beamScale = ((uLightMode == 1) ? 0.24 : ((uLightMode == 0) ? 1.0 : 0.62)) * macroBeamCalm;
float ribbonScale = ((uLightMode == 1) ? 0.46 : ((uLightMode == 0) ? 1.0 : 0.68)) * (uCamMode == 1 ? 0.82 : 1.0);
float sigilScale = ((uLightMode == 1) ? 0.50 : ((uLightMode == 0) ? 1.0 : 0.70));
vec3 volVFX = renderOrganicVolumetricVFX(ro, rd, tSolid, phase, beamScale, ribbonScale);
vec3 sigilsVFX = renderFloatingRuneDiamonds(ro, rd, tSolid, phase, sigilScale);
if (uLightMode == 1) {
float vL = dot(volVFX + sigilsVFX, vec3(0.299, 0.587, 0.114));
col += vec3(vL * 0.80);
} else {
col += volVFX + sigilsVFX;
if (uLightMode == 0) {
col += renderSharpSparks(ro, rd, tSolid, uv, phase);
}
}
// ACES Filmic Tonemapping, Gamma 2.2, & Strict Luminance Bounds
float exposure = (uLightMode == 1) ? 1.02 : 0.96;
col = acesToneMap(col * exposure);
col = pow(max(col, vec3(0.0)), vec3(1.0 / 2.2));
float vig = 1.0 - 0.18 * dot(uv, uv);
col *= clamp(vig, 0.76, 1.0);
col = max(col, vec3(0.024));
col = min(col, vec3(0.985));
if (uLightMode == 1) {
float g = dot(col, vec3(0.299, 0.587, 0.114));
col = vec3(g);
}
col *= (1.0 + 0.0 * uOpen);
fragColor = vec4(col, 1.0);
}
`;
export function createSummoningCircleAscensionPillarMaterial(width = 1024, height = 1024) {
const material = new THREE.ShaderMaterial({
glslVersion: THREE.GLSL3,
vertexShader,
fragmentShader,
uniforms: {
uResolution: { value: new THREE.Vector2(width, height) },
uTime: { value: 1.2 },
uOpen: { value: 0.0 },
uLightMode: { value: 0 },
uCamMode: { value: 0 },
},
});
return {
material,
update(elapsedSeconds) {
material.uniforms.uTime.value = elapsedSeconds * 1.0;
},
resize(nextW, nextH) {
material.uniforms.uResolution.value.set(nextW, nextH);
},
};
}
| Identifier | summoning-circle-ascension-pillar |
|---|---|
| Category | Game VFX Shaders · Choreographed Loop VFX |
| Upstream study | vfx_animated/lib/10_summoning_circle_ascension_pillar.glsl (commit f3d2025) |
| Animation cycle | 3.0 s seamless harmonic loop |
| Declared uniforms | uResolution, uTime, uOpen, uLightMode, uCamMode |
| Source size | 928 lines · 37.4 KB standalone GLSL ES 3.00 |
| PNG baker outputs | 512px · 1024px · 2048px RGBA8 (4-tap seamless + alpha key) |
| Companion pixel VFX | Free MIT holy sprite sheets |
| License | MIT License + CC0 / MIT Helpers |
Schlick Fresnel reflectance (1994); Beer–Lambert volumetric absorption/attenuation
David Hoskins, hash · Krzysztof Narkowicz, filmic curve · Inigo Quilez, tetrahedral SDF normal
3s LoopSweeping violet-cyan spell blade arc with glowing runes, trailing motes, and arena floor bounce.
3s LoopGeodesic hexagonal forcefield dome with Fresnel rim energy, impact ripple rings, and rune lattice.
3s LoopImploding spatial warp flash with vertical slipstream streaks and dissipating astral embers.
AnimatedConcentric inscribed magic circle erupting through fractured stone radial shockwaves.
3s LoopSwirling plasma core missile with helical ribbon wake and orbiting spark shards.
3s LoopSustained high-energy laser beam wrapped in dual helical plasma coils and impact flare.