From 2b8b23e5dd371bc3829f6351bc483bd3cb4e5d96 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 13 May 2026 03:26:49 +0100 Subject: [PATCH] Rebuild Self from orbital field grammar --- docs/epiphany-agent-sdf-visual-language.md | 33 ++-- .../Shaders/D3D12SelfBody.hlsl | 158 +++++++++--------- state/evidence.jsonl | 1 + state/memory.json | 7 +- 4 files changed, 100 insertions(+), 99 deletions(-) diff --git a/docs/epiphany-agent-sdf-visual-language.md b/docs/epiphany-agent-sdf-visual-language.md index ee60a45..da1c6d6 100644 --- a/docs/epiphany-agent-sdf-visual-language.md +++ b/docs/epiphany-agent-sdf-visual-language.md @@ -332,12 +332,13 @@ Role ids: `coordinator`, `epiphany.self` Purpose: routing, authority, checkpoint, run state, and review boundary. -Appearance: a central routing heart made of a warm command sphere inside a -fantasy orrery. Smooth torus arcs and tilted orbital rings cross around the -core like authority rails, with small gate nodes riding the active arcs. The -angelic reference is a vibe of overwhelming ordered complexity, not literal -eyes: Self should feel radiant, watchful, and decisive without becoming a -uniform glow cloud or a cluster of loose symbols. +Appearance: a central routing heart made of a warm core sphere crossed by +several smooth torus arcs. The arcs look like quiet rails orbiting a command +seed, with small gate nodes at their intersections. Self should feel central +and decisive, not busy. The orrery comparison is a motion metaphor: the routing +rails should have nested orbital order and slow phase motion rather than +static, intersecting hoops. The angelic read should come from overwhelming but +coherent symmetry and radiance, not literal symbolic anatomy. Reasoning: Self is not a worker lane. It preserves agency by routing work, rejecting bad authority claims, and deciding which organ deserves the next @@ -347,21 +348,25 @@ paths, one current routing decision. Math: - Exact sphere core with radius `1.0`. -- Four torus arcs in tilted planes, clipped by angular masks. -- Several thinner tilted orrery rings around the core. -- Smooth union between the core and small gate-node spheres. +- Four torus arc families in tilted planes, clipped or gated by a shared + orbital grammar so rails cohere instead of visibly colliding. +- Smooth union between the core and small gate-node spheres at meaningful + routing intersections. - Thin emissive routing filaments as torus-segment SDFs with sinusoidal radius modulation along the arc. - Material regions: warm ceramic core, metallic gold/orichalcum routing rails, - dimmer orrery rings, pale gate bodies, bright current target accents, and - dark review seam. Emission is an accent on rails and active gates; it must - not wash out component boundaries. + bright current target gate, and dark review seam. Emission is an accent on + rails and active gates; it must not wash out component boundaries. +- Implementation note: prefer a continuous spatial/topological grammar, such as + a log-spherical or spherical-coordinate field where shells, orbital rails, + gates, and seam bands are level sets of the same coordinate system. Do not + hand-place independent hoops when the form wants one coherent orbital space. Movement: - Slow center pulse from heartbeat phase. -- Orbital rails and rings rotate at different slow phase rates so the orrery is - a motion metaphor, not static decoration. +- Orbital rail families rotate at different slow phase rates so the orrery is a + motion metaphor, not static decoration. - `targetRole` resolves through `roleAnchor(targetRole)`. The active routing gate is the torus arc whose tangent points closest to `routeDirection`. - Selected target role lights that gate and sends a traveling pulse along the diff --git a/src/Aquarium.Epiphany/Shaders/D3D12SelfBody.hlsl b/src/Aquarium.Epiphany/Shaders/D3D12SelfBody.hlsl index 360821b..a6ce9b2 100644 --- a/src/Aquarium.Epiphany/Shaders/D3D12SelfBody.hlsl +++ b/src/Aquarium.Epiphany/Shaders/D3D12SelfBody.hlsl @@ -7,61 +7,79 @@ struct SelfParts { float core; float rail; - float halo; float gate; float seam; float distanceValue; }; -float sdTorusArc(float3 q, float majorRadius, float tubeRadius, float2 midDirection, float halfAngle) +struct SelfOrbitSpace { - float2 radial = q.xy; - float radialLength = max(length(radial), 0.0001); - float2 direction = radial / radialLength; - float angularDistance = (cos(halfAngle) - dot(direction, midDirection)) * majorRadius; - float torus = length(float2(radialLength - majorRadius, q.z)) - tubeRadius; - return max(torus, angularDistance); + float r; + float theta; + float phi; + float shell; + float scale; +}; + +float wrapPi(float value) +{ + return frac(value / (2.0 * PI) + 0.5) * (2.0 * PI) - PI; } -float3 rotateZ(float3 p, float angle) +float periodicDistance(float value, float period) { - float c = cos(angle); - float s = sin(angle); - return float3(p.x * c - p.y * s, p.x * s + p.y * c, p.z); + return abs(frac(value / period + 0.5) - 0.5) * period; } -float3 selfOrbitPlane(float3 local, float angle, float tilt) +SelfOrbitSpace selfOrbitSpace(float3 local, float phase) { - float3 p = rotateZ(local, angle); - return float3(p.x, p.z * cos(tilt) - p.y * sin(tilt), p.z * sin(tilt) + p.y * cos(tilt)); + float r = max(length(local), 0.0001); + float theta = atan2(local.y, local.x); + float phi = acos(clamp(local.z / r, -1.0, 1.0)); + float logRadius = log(r / 0.58); + float shell = logRadius * 2.35; + float polarTighten = 0.52 + 0.48 * sin(phi); + + SelfOrbitSpace space; + space.r = r; + space.theta = theta + shell * 0.72 + phase * 0.18; + space.phi = phi + 0.18 * sin(theta * 2.0 - phase * 0.35); + space.shell = shell; + space.scale = r * polarTighten; + return space; } -float3 selfOrbitPoint(float angle, float tilt, float orbitAngle, float orbitRadius) +float sdSelfCore(float3 local, float heartbeat, float timeSeconds) { - float3 q = float3(cos(orbitAngle) * orbitRadius, sin(orbitAngle) * orbitRadius, 0.0); - float3 p = float3(q.x, q.z * sin(tilt) + q.y * cos(tilt), q.z * cos(tilt) - q.y * sin(tilt)); - return rotateZ(p, -angle); + float pulse = 0.020 * sin(timeSeconds * 0.75 + heartbeat * 6.28318); + return sdSphere(local, 0.50 + pulse); } -float sdRoutingArc(float3 local, float angle, float tilt, float pressure, float phase) +float sdSelfRailFamily(SelfOrbitSpace space, float pressure, float phase) { - float3 q = selfOrbitPlane(local, angle, tilt); - float majorRadius = lerp(0.82, 0.68, pressure); - float tubeRadius = 0.025 + 0.006 * sin(phase + angle * 1.7); - return sdTorusArc(q, majorRadius, tubeRadius, float2(1.0, 0.0), 1.22); + float shellRadius = abs(space.r - lerp(0.76, 0.66, pressure)); + float equatorRail = periodicDistance(space.phi - PI * 0.50 + 0.16 * sin(space.theta * 2.0 + phase), PI * 0.50); + float meridianRail = periodicDistance(space.theta + 0.34 * sin(space.phi * 2.0 - phase * 0.7), PI * 0.50); + float spiralRail = periodicDistance(space.theta * 1.5 + space.phi * 0.85 + space.shell - phase * 0.55, PI * 0.72); + float angularRail = min(equatorRail, min(meridianRail, spiralRail)) * space.scale; + return max(shellRadius, angularRail - 0.020); } -float sdOrreryRing(float3 local, float angle, float tilt, float pressure, float radius, float tubeRadius) +float sdSelfGateFamily(SelfOrbitSpace space, float pressure, float phase) { - float3 q = selfOrbitPlane(local, angle, tilt); - return sdTorus(q, float2(lerp(radius, radius * 0.88, pressure), tubeRadius)); + float shellRadius = abs(space.r - lerp(0.76, 0.66, pressure)); + float routeA = periodicDistance(space.theta + space.phi * 0.50 - phase * 0.42, PI * 0.50); + float routeB = periodicDistance(space.theta * 1.5 - space.phi + phase * 0.25, PI); + float routeC = periodicDistance(space.phi - PI * 0.50, PI * 0.42); + float node = length(float3(shellRadius * 1.6, routeA * space.scale, min(routeB, routeC) * space.scale)) - 0.052; + return node; } -float gateNode(float3 local, float angle, float tilt, float pressure) +float sdSelfSeam(SelfOrbitSpace space, float activity) { - float majorRadius = lerp(0.82, 0.68, pressure); - float3 node = selfOrbitPoint(angle, tilt, 0.0, majorRadius); - return sdSphere(local - node, 0.075); + float seamBand = periodicDistance(space.phi - PI * 0.50, PI) * space.scale; + float shellRadius = abs(space.r - lerp(0.515, 0.49, activity)); + return max(shellRadius - 0.010, seamBand - 0.028); } SelfParts selfParts(float3 local, SdfObject sdfObject, float timeSeconds) @@ -69,41 +87,21 @@ SelfParts selfParts(float3 local, SdfObject sdfObject, float timeSeconds) float activity = saturate(sdfObject.state.x); float heartbeat = saturate(sdfObject.state.y); float pressure = saturate(sdfObject.state.z); - float phase = timeSeconds * 0.55 + heartbeat * 6.28318; - float pulse = 0.025 * sin(phase); - float core = sdSphere(local, 0.48 + pulse); + float phase = timeSeconds * 0.72 + heartbeat * 2.1; + SelfOrbitSpace space = selfOrbitSpace(local, phase); - float orbitPhase = timeSeconds * 0.18 + heartbeat * 0.90; - float arc0 = sdRoutingArc(local, 0.00 + orbitPhase * 0.32, 0.50, pressure, phase); - float arc1 = sdRoutingArc(local, 1.57 - orbitPhase * 0.24, -0.58, pressure, phase + 1.2); - float arc2 = sdRoutingArc(local, 3.14 + orbitPhase * 0.18, 0.76, pressure, phase + 2.4); - float arc3 = sdRoutingArc(local, -1.57 - orbitPhase * 0.28, -0.34, pressure, phase + 3.6); - float rail = min(min(arc0, arc1), min(arc2, arc3)); + float core = sdSelfCore(local, heartbeat, timeSeconds); + float rail = sdSelfRailFamily(space, pressure, phase); + float gate = sdSelfGateFamily(space, pressure, phase); + float seam = sdSelfSeam(space, activity); - float halo0 = sdOrreryRing(local, 0.42 + orbitPhase * 0.20, 1.15, pressure, 0.98, 0.012); - float halo1 = sdOrreryRing(local, 2.12 - orbitPhase * 0.16, -0.92, pressure, 0.92, 0.010); - float halo2 = sdOrreryRing(local, -1.18 + orbitPhase * 0.12, 0.28, pressure, 0.74, 0.009); - float halo = min(halo0, min(halo1, halo2)); - - float gate0 = gateNode(local, 0.00 + orbitPhase * 0.32, 0.50, pressure); - float gate1 = gateNode(local, 1.57 - orbitPhase * 0.24, -0.58, pressure); - float gate2 = gateNode(local, 3.14 + orbitPhase * 0.18, 0.76, pressure); - float gate3 = gateNode(local, -1.57 - orbitPhase * 0.28, -0.34, pressure); - float gate = min(min(gate0, gate1), min(gate2, gate3)); - - float seamRing = sdTorus(local.xzy, float2(0.50, 0.010)); - float seamMask = abs(local.z) - 0.10; - float seam = max(seamRing, -seamMask); - - float routed = smoothUnion(core, rail, 0.030); - routed = smoothUnion(routed, halo, 0.020); - routed = smoothUnion(routed, gate, 0.036); - float distanceValue = smoothUnion(routed, seam, lerp(0.012, 0.030, activity)); + float routed = smoothUnion(core, rail, 0.026); + routed = smoothUnion(routed, gate, 0.032); + float distanceValue = smoothUnion(routed, seam, 0.012); SelfParts parts; parts.core = core; parts.rail = rail; - parts.halo = halo; parts.gate = gate; parts.seam = seam; parts.distanceValue = distanceValue; @@ -124,30 +122,28 @@ SdfSurface sdfSurface(float3 p, int sdfIndex) float radius = max(sdfObject.centerRadius.w, 0.001); float3 local = (p - sdfObject.centerRadius.xyz) / radius; SelfParts parts = selfParts(local, sdfObject, timeSeconds); - float nonCore = min(min(parts.rail, parts.halo), min(parts.gate, parts.seam)); - float isGate = parts.gate <= min(min(parts.core, parts.rail), min(parts.halo, parts.seam)) ? 1.0 : 0.0; - float isRail = (1.0 - isGate) * (parts.rail <= min(min(parts.core, parts.halo), parts.seam) ? 1.0 : 0.0); - float isHalo = (1.0 - isGate) * (1.0 - isRail) * (parts.halo <= min(parts.core, parts.seam) ? 1.0 : 0.0); - float isSeam = (1.0 - isGate) * (1.0 - isRail) * (1.0 - isHalo) * (parts.seam <= min(parts.core, nonCore) ? 1.0 : 0.0); - float isCore = (1.0 - isGate) * (1.0 - isRail) * (1.0 - isHalo) * (1.0 - isSeam); - float glow = 0.5 + 0.5 * sin(timeSeconds * 1.4 + local.x * 2.0 - local.y * 1.5 + local.z * 2.5); - float3 coreColor = lerp(float3(0.50, 0.26, 0.15), float3(0.82, 0.48, 0.26), glow); - float3 railColor = float3(0.78, 0.45, 0.16); - float3 haloColor = float3(0.70, 0.53, 0.34); - float3 gateColor = lerp(float3(0.70, 0.62, 0.46), float3(0.92, 0.78, 0.50), saturate(sdfObject.state.x)); - float3 seamColor = float3(0.06, 0.028, 0.020); + float isGate = parts.gate <= min(min(parts.core, parts.rail), parts.seam) ? 1.0 : 0.0; + float isRail = (1.0 - isGate) * (parts.rail <= min(parts.core, parts.seam) ? 1.0 : 0.0); + float isSeam = (1.0 - isGate) * (1.0 - isRail) * (parts.seam <= parts.core ? 1.0 : 0.0); + float isCore = (1.0 - isGate) * (1.0 - isRail) * (1.0 - isSeam); + + float shimmer = 0.5 + 0.5 * sin(local.x * 2.3 - local.y * 1.7 + local.z * 2.9 + timeSeconds * 1.1); + float3 coreColor = lerp(float3(0.58, 0.31, 0.18), float3(0.88, 0.58, 0.34), shimmer); + float3 railColor = float3(0.86, 0.54, 0.20); + float3 gateColor = lerp(float3(0.78, 0.66, 0.42), float3(1.0, 0.82, 0.42), saturate(sdfObject.state.x)); + float3 seamColor = float3(0.055, 0.025, 0.018); SdfSurface surface; - surface.baseColor = coreColor * isCore + railColor * isRail + haloColor * isHalo + gateColor * isGate + seamColor * isSeam; - surface.metallic = 0.0 * isCore + 0.65 * isRail + 0.82 * isHalo + 0.0 * isGate + 0.0 * isSeam; - surface.roughness = 0.42 * isCore + 0.26 * isRail + 0.22 * isHalo + 0.18 * isGate + 0.78 * isSeam; + surface.baseColor = coreColor * isCore + railColor * isRail + gateColor * isGate + seamColor * isSeam; + surface.metallic = 0.0 * isCore + 0.72 * isRail + 0.18 * isGate + 0.0 * isSeam; + surface.roughness = 0.42 * isCore + 0.24 * isRail + 0.18 * isGate + 0.80 * isSeam; + float3 selfLight = primitiveEmissionRadiance(sdfFieldId(sdfIndex)); - surface.emission = selfLight * (isRail * 0.05 + isGate * 0.05) - + coreColor * isCore * 0.015 - + railColor * isRail * 0.16 - + haloColor * isHalo * 0.025 - + gateColor * isGate * (0.10 + sdfObject.state.y * 0.06) - + seamColor * isSeam * 0.01; + surface.emission = selfLight * (isRail * 0.045 + isGate * 0.08) + + coreColor * isCore * 0.018 + + railColor * isRail * 0.18 + + gateColor * isGate * (0.22 + sdfObject.state.y * 0.08) + + seamColor * isSeam * 0.008; return surface; } diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 0450898..c80d16b 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -83,3 +83,4 @@ {"timestamp":"2026-05-13T02:56:00+01:00","topic":"self-orrery-material-legibility","lesson":"Self needs fantasy orrery / many-eyed angelic authority, but material legibility matters more than raw glow. Add continuous tilted rings and eye/gate nodes, make rails/halos metallic, keep the core ceramic-warm, reserve strong emission for pupils and active routing accents, and update the visual spec so future passes do not flatten the components back into a glow cloud.","files":["src/Aquarium.Epiphany/Shaders/D3D12SelfBody.hlsl","docs/epiphany-agent-sdf-visual-language.md","state/memory.json","state/evidence.jsonl"],"source":"user visual correction"} {"timestamp":"2026-05-13T03:00:00+01:00","topic":"self-emission-whiteout","lesson":"A Self body can be the scene light without painting full primitive light radiance onto every visible surface. Adding primitiveEmissionRadiance uniformly to the material made the core tonemap into a white disk and hid the orrery anatomy. Scale field-owned radiance to small rail/gate/pupil accents, reduce core emission, and keep geometry readable through PBR contrast.","files":["src/Aquarium.Epiphany/Shaders/D3D12SelfBody.hlsl","state/memory.json","state/evidence.jsonl"],"source":"user screenshot showed Self white-out"} {"timestamp":"2026-05-13T03:15:00+01:00","topic":"self-angel-vibe-not-literal-eyes","lesson":"The 'biblically accurate angel' reference for Self means overwhelming ordered otherworldly complexity, not literal loose eyes. The orrery comparison is a motion metaphor for orbital rings and torus arcs. Remove detached eye/pupil bodies, animate rail and halo planes with phase offsets, and keep spec edits aligned to user intent instead of rewriting requirements around an over-literal interpretation.","files":["src/Aquarium.Epiphany/Shaders/D3D12SelfBody.hlsl","docs/epiphany-agent-sdf-visual-language.md","state/memory.json","state/evidence.jsonl"],"source":"user screenshot correction"} +{"timestamp":"2026-05-13T03:31:00+01:00","topic":"self-orbital-grammar-rebuild","lesson":"When the desired form is an orrery-like routing heart, build a spatial/topological grammar where rails, shells, seams, and gates cohere naturally. The old Self shader was deleted because it hand-placed arcs and then patched their collisions. The replacement maps local space into spherical/log-shell coordinates and defines rail/gate/seam families as level sets in that shared space, following the recursive-lotus lesson of choosing the right coordinate authority before adding geometry.","files":["src/Aquarium.Epiphany/Shaders/D3D12SelfBody.hlsl","docs/epiphany-agent-sdf-visual-language.md","state/memory.json","state/evidence.jsonl"],"source":"user pointed to pac-dev recursive_lotus.glsl and asked to delete/rebuild"} diff --git a/state/memory.json b/state/memory.json index b8548ac..a456837 100644 --- a/state/memory.json +++ b/state/memory.json @@ -63,10 +63,9 @@ "Imagination's live shader realizes the six-petal topology as three mirrored sheet-pair fields. Keep film, rim, tendril, spark, shadow, and seed distances separated through material classification so raised rims can glow without collapsing the petal sheets into one generic blob.", "Do not reintroduce Imagination's old polar-lobed seed or traced half-torus shadow. The seed is a plain luminous opal bud unless the spec asks otherwise; backlog shadow needs a visual contract before it becomes traced geometry.", "Imagination's ribbon sheets should use one continuous pair-space field for film and raised edge rims. Do not rebuild the bloom from piecewise rim capsules or straight root/tip posts when the sheet parameterization can own the silhouette directly.", - "Self's body is the routing authority object: a warm central sphere crossed by continuous clipped torus-arc rails, bright gate nodes, and a dark review seam. Keep it decisive and radiant through PBR surface regions plus emission; do not collapse it back to a raw emissive placeholder sphere.", - "Self should read as a fantasy orrery with controlled angelic authority: tilted metallic rings and rails around a warm command core, pale gate bodies, bright active-gate accents, and restrained emission that accents structure instead of flattening it into glow.", - "For Self, 'biblically accurate angel' is a vibe of overwhelming ordered complexity, not literal loose eyes. Express that through nested rotating torus arcs, orbital phase offsets, gate nodes, and material hierarchy; do not add detached symbolic anatomy unless the spec explicitly asks for it.", - "Self is allowed to be a scene light, but its visible body must not add full primitive light radiance to every surface. Scale field-owned radiance to small accents and let PBR material contrast carry the core, rails, halos, gates, and seam.", + "Self's body is the routing authority object: a warm command sphere crossed by orbital rail and gate level sets from one spherical/log-spherical coordinate grammar. Keep it decisive and radiant through PBR surface regions plus restrained emission; do not collapse it back to a raw emissive placeholder sphere or hand-placed hoop assembly.", + "For Self, the orrery comparison is motion and topology grammar. Rails, gates, and seams should emerge from a shared orbital space with phase motion, not from independent tilted hoops, loose symbols, or literal anatomical motifs.", + "Self is allowed to be a scene light, but its visible body must not add full primitive light radiance to every surface. Scale field-owned radiance to small accents and let PBR material contrast carry the core, rails, gates, and seam.", "Heavy/specialized SDF evaluators should not live inside generic packed-id helpers when those helpers are called repeatedly; avoid shader compiler path cloning.", "Lighting is diegetic. Self is the initial emitter; later other Selves should emit through an explicit body light lane, not generic field instances or ambient convenience fill.", "Keep bundled blue-noise texture assets available for future dithering/noise work even when no current pass samples them.",