diff --git a/src/Aquarium.Engine/Render/Shaders/D3D12CursorBody.hlsl b/src/Aquarium.Engine/Render/Shaders/D3D12CursorBody.hlsl index 4a037fb..7f097f5 100644 --- a/src/Aquarium.Engine/Render/Shaders/D3D12CursorBody.hlsl +++ b/src/Aquarium.Engine/Render/Shaders/D3D12CursorBody.hlsl @@ -77,7 +77,7 @@ float3 cursorEmissionRadiance(float3 p, float3 normal) float petal = 0.55 + 0.45 * cos(atan2(local.y, local.x) * 3.0 - timeSeconds * 1.8); float throat = exp(-dot(local.xy, local.xy) * 7.0) * smoothstep(0.30, -0.18, local.z); float stamen = smoothstep(0.018, -0.035, sdHibiscusStamen(local)); - float calyxCore = sdQuadraticTube(local, float3(0.0, 0.0, -1.0), float3(0.06, -0.04, -0.72), float3(0.0, 0.0, -0.49), 0.018, 0.115); + float calyxCore = sdQuadraticTube(local, float3(0.0, 0.0, -1.0), float3(0.06, -0.04, -0.62), float3(0.0, 0.0, -0.18), 0.018, 0.130); float calyxSepals = min(sdHibiscusSepal(local, 1.57), min(sdHibiscusSepal(local, 3.66), sdHibiscusSepal(local, 5.75))); float calyx = smoothstep(0.08, -0.02, min(calyxCore, calyxSepals)); float rim = pow(1.0 - saturate(dot(normal, normalize(cameraPosition - p))), 2.0); diff --git a/src/Aquarium.Engine/Render/Shaders/D3D12SdfMath.hlsli b/src/Aquarium.Engine/Render/Shaders/D3D12SdfMath.hlsli index 1e2b564..c9f1f10 100644 --- a/src/Aquarium.Engine/Render/Shaders/D3D12SdfMath.hlsli +++ b/src/Aquarium.Engine/Render/Shaders/D3D12SdfMath.hlsli @@ -110,61 +110,64 @@ float sdTeardropRevolution(float3 local, float contactZ, float tipZ, float radiu return max(radialDistance, max(topDistance, bottomDistance)); } +float2 hibiscusPetalCenter(float u) +{ + float radial = 0.92 * u * u * (1.0 - 0.10 * u); + float height = -0.10 + 0.82 * u; + return float2(radial, height); +} + +float sdHibiscusPetalRibbon(float3 q, float phase) +{ + float u = saturate((q.z + 0.10) / 0.82); + float2 center = hibiscusPetalCenter(u); + float widthGrowth = smoothstep(0.08, 1.0, u); + float width = lerp(0.030, 0.42, widthGrowth); + float thickness = lerp(0.010, 0.046, widthGrowth); + float fold = 0.055 * q.y * q.y / max(width * width, 0.001); + float radialDistance = abs(q.x - center.x - fold) - thickness; + float verticalDistance = max(-0.10 - q.z, q.z - 0.72); + float sideDistance = abs(q.y) - width; + return max(max(radialDistance, verticalDistance), sideDistance); +} + float sdHibiscusCursorPetal(float3 local, float angle, float timeSeconds) { float2 radial = float2(cos(angle), sin(angle)); float2 tangent = float2(-radial.y, radial.x); float phase = timeSeconds * 0.95 + angle * 1.7; - float3 center = float3(radial * 0.36, 0.09 + 0.030 * sin(phase)); + float3 center = float3(radial * 0.20, 0.07 + 0.030 * sin(phase)); float3 p = local - center; float3 q = float3(dot(p.xy, radial), dot(p.xy, tangent), p.z); - float lengthT = saturate((q.x + 0.34) / 1.38); - float edgeT = saturate(abs(q.y) / max(lerp(0.22, 0.08, lengthT), 0.001)); - float lift = 0.31 * lengthT * lengthT + 0.060 * edgeT * edgeT; - float curl = 0.075 * sin(q.x * 2.4 + phase) * smoothstep(0.08, 0.95, lengthT); - float rib = 0.014 * sin(q.y * 36.0 + q.x * 8.0 + phase) * smoothstep(0.05, 0.90, lengthT); - float surfaceZ = -0.075 + lift + curl; - float thickness = lerp(0.040, 0.009, lengthT) * lerp(1.0, 0.42, edgeT); - float sheet = abs(q.z - surfaceZ - rib) - thickness; - float footprint = sdTaperedCapsule2(float2(q.x, q.y), float2(-0.34, 0.0), float2(1.04, 0.0), 0.23, 0.07); - float notch = sdSphere(float3(q.x + 0.40, q.y, q.z), 0.11); - return max(max(sheet, footprint), -notch); + return sdHibiscusPetalRibbon(q, phase); } float sdHibiscusSepal(float3 local, float angle) { float2 radial = float2(cos(angle), sin(angle)); - float3 a = float3(0.0, 0.0, -0.56); - float3 b = float3(radial * 0.22, -0.39); - return sdTaperedCapsuleSegment(local, a, b, 0.046, 0.020); + float3 a = float3(0.0, 0.0, -0.46); + float3 b = float3(radial * 0.26, -0.22); + return sdTaperedCapsuleSegment(local, a, b, 0.058, 0.022); } float sdHibiscusStamen(float3 local) { float column = sdQuadraticTube(local, float3(0.0, 0.0, 0.02), float3(-0.12, 0.08, 0.43), float3(0.13, 0.04, 0.86), 0.048, 0.032); - float filament0 = sdQuadraticTube(local, float3(-0.02, 0.03, 0.36), float3(-0.12, 0.09, 0.46), float3(-0.18, 0.07, 0.56), 0.014, 0.008); - float filament1 = sdQuadraticTube(local, float3(0.02, 0.04, 0.48), float3(0.15, 0.13, 0.58), float3(0.24, 0.12, 0.70), 0.014, 0.008); - float filament2 = sdQuadraticTube(local, float3(0.04, 0.02, 0.61), float3(0.15, -0.09, 0.70), float3(0.09, -0.19, 0.80), 0.012, 0.007); - float filament3 = sdQuadraticTube(local, float3(0.08, 0.04, 0.72), float3(0.20, 0.03, 0.84), float3(0.28, 0.00, 0.93), 0.011, 0.007); - float bead0 = sdSphere(local - float3(0.14, 0.04, 0.92), 0.064); - float bead1 = sdSphere(local - float3(0.24, 0.12, 0.70), 0.044); - float bead2 = sdSphere(local - float3(-0.19, 0.07, 0.56), 0.042); - float bead3 = sdSphere(local - float3(0.09, -0.19, 0.80), 0.039); - float bead4 = sdSphere(local - float3(0.28, 0.00, 0.93), 0.036); - float sideFilaments = min(min(filament0, filament1), min(filament2, filament3)); - float beads = min(min(bead0, bead1), min(min(bead2, bead3), bead4)); - return min(column, min(sideFilaments, beads)); + float bead1 = sdSphere(local - float3(0.18, 0.12, 0.72), 0.046); + float bead2 = sdSphere(local - float3(-0.12, 0.04, 0.62), 0.044); + float beads = min(bead0, min(bead1, bead2)); + return min(column, beads); } float sdHibiscusCursor(float3 local, float timeSeconds) { float sway = 0.10 * sin(timeSeconds * 0.85); - float petal0 = sdHibiscusCursorPetal(local, 1.54 + sway, timeSeconds); - float petal1 = sdHibiscusCursorPetal(local, 2.78 + sway * 0.7, timeSeconds); - float petal2 = sdHibiscusCursorPetal(local, 4.02 + sway * 0.5, timeSeconds); - float petal3 = sdHibiscusCursorPetal(local, 5.26 + sway * 0.4, timeSeconds); - float petal4 = sdHibiscusCursorPetal(local, 0.34 + sway * 0.6, timeSeconds); + float petal0 = sdHibiscusCursorPetal(local, 1.45 + sway, timeSeconds); + float petal1 = sdHibiscusCursorPetal(local, 2.62 + sway * 0.7, timeSeconds); + float petal2 = sdHibiscusCursorPetal(local, 3.88 + sway * 0.5, timeSeconds); + float petal3 = sdHibiscusCursorPetal(local, 5.12 + sway * 0.4, timeSeconds); + float petal4 = sdHibiscusCursorPetal(local, 0.22 + sway * 0.6, timeSeconds); float petals = min(min(petal0, petal1), min(min(petal2, petal3), petal4)); float throatSphere = sdSphere(local - float3(0.0, 0.0, -0.05), 0.24); @@ -172,13 +175,13 @@ float sdHibiscusCursor(float3 local, float timeSeconds) float throat = max(throatSphere, throatTop); float stamen = sdHibiscusStamen(local); - float calyxCore = sdQuadraticTube(local, float3(0.0, 0.0, -1.0), float3(0.06, -0.04, -0.72), float3(0.0, 0.0, -0.49), 0.014, 0.105); + float calyxCore = sdQuadraticTube(local, float3(0.0, 0.0, -1.0), float3(0.06, -0.04, -0.62), float3(0.0, 0.0, -0.18), 0.014, 0.120); float sepals = min(sdHibiscusSepal(local, 1.57), min(sdHibiscusSepal(local, 3.66), sdHibiscusSepal(local, 5.75))); float calyx = smoothUnion(calyxCore, sepals, 0.035); float blossom = smoothUnion(petals, throat, 0.10); blossom = smoothUnion(blossom, stamen, 0.065); - return smoothUnion(blossom, calyx, 0.070); + return smoothUnion(blossom, calyx, 0.120); } #endif diff --git a/state/evidence.jsonl b/state/evidence.jsonl index f198254..db555d5 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -39,3 +39,5 @@ {"timestamp":"2026-05-11T23:47:00+01:00","topic":"pseudo-distance-near-miss-hits","lesson":"The cursor stamen and angled petals disappeared because the body proxy marcher accepted abs(distance) < epsilon as a hit on a pseudo-distance composite. Rays that passed near a petal sheet could terminate before reaching the actual stamen or petal intersection. The proxy marcher now requires distance <= 0 entry, refines positive-to-negative brackets, and uses a larger step budget to survive capped steps across the proxy volume.","files":["src/Aquarium.Engine/Render/Shaders/D3D12BodyProxy.hlsli","state/memory.json"],"source":"user visual artifact review"} {"timestamp":"2026-05-11T23:52:00+01:00","topic":"cursor-hibiscus-organ-primitives","lesson":"The cursor hibiscus shape should be built from organ-appropriate SDF primitives instead of ellipsoid paste. Petals now use upward-curving tapered sheets with lens footprints and tapered thickness, the staminal column uses a curved tapered tube, and the green contact anatomy uses a connected tapered stem plus calyx bulb so the stem visibly reaches the flower.","files":["src/Aquarium.Engine/Render/Shaders/D3D12SdfMath.hlsli","src/Aquarium.Engine/Render/Shaders/D3D12CursorBody.hlsl","state/memory.json"],"source":"user visual artifact review"} {"timestamp":"2026-05-11T23:59:00+01:00","topic":"cursor-hibiscus-reference-target","lesson":"The closer cursor objective is the pale pink five-petal hibiscus reference: broad translucent cupped petals, a folded central throat, a curved staminal column with side pollen filaments, and a green tapered calyx/stem ending at the XY contact point. The SDF now uses five tapered sheet petals, a simplified three-segment quadratic tube helper to keep shader compile time sane, side filament tubes, pollen bead spheres, and a curved tapered calyx core with sepals.","files":["src/Aquarium.Engine/Render/Shaders/D3D12SdfMath.hlsli","src/Aquarium.Engine/Render/Shaders/D3D12CursorBody.hlsl","state/memory.json"],"source":"user reference images"} +{"timestamp":"2026-05-12T00:12:00+01:00","topic":"cursor-petal-single-formula","lesson":"The hibiscus cursor petal should not be assembled from piecewise vertical panels and horizontal blades. Model each petal from one longitudinal coordinate: radial displacement grows quadratically so the root starts vertical, height follows a smooth cubic center curve, width and thickness grow from thin root to broad distal blade, and decorative ruffles stay out until the core SDF is stable and cheap.","files":["src/Aquarium.Engine/Render/Shaders/D3D12SdfMath.hlsli","state/memory.json"],"source":"user visual/math review"} +{"timestamp":"2026-05-12T00:17:00+01:00","topic":"cursor-hibiscus-reset","lesson":"When the hibiscus cursor starts turning into SDF Jenga, reset the function around anatomical parameters instead of stapling on fixes. The current reset keeps five petals as one cheap graph-style ribbon formula each: u comes from height, radial displacement is quadratic so roots start vertical, width and thickness grow with u, and decorative trig/filament swarms are cut until the core form is stable and fast.","files":["src/Aquarium.Engine/Render/Shaders/D3D12SdfMath.hlsli","state/memory.json"],"source":"user architecture correction"} diff --git a/state/memory.json b/state/memory.json index 774a0da..f123e43 100644 --- a/state/memory.json +++ b/state/memory.json @@ -45,6 +45,7 @@ "For pseudo-distance body composites, do not accept abs(distance) below epsilon as a surface hit. A ray that merely passes near a petal sheet can terminate before the real front intersection behind it. Body proxy tracing should enter solids by distance <= 0 and refine the positive-to-negative bracket.", "Cursor hibiscus anatomy should use expressive primitives that match the organ: curved tapered sheet petals with lens footprints, curved tapered tubes for the staminal column, spheres for pollen beads, and a connected tapered stem plus calyx bulb. Do not default to ellipsoids when a lens, slab, tube, cone, sphere intersection, torus, superquadric, or profile revolution better describes the form.", "The cursor hibiscus visual target is the pale pink five-petal hibiscus reference: broad translucent upward-cupped petals, folded pink throat, curved staminal column with side pollen filaments, and a green tapered calyx/stem connection ending at the XY contact point.", + "Cursor hibiscus petals should be modeled from one cheap longitudinal parameter: radial displacement grows quadratically from the vertical root, width and thickness grow toward the distal blade, and the first stable pass should avoid decorative ruffle/vein math. Do not build separate vertical panels plus horizontal blades; that creates rectangular fences and pulled-apart petal anatomy.", "Imagination should read as distinct petals first, not as a fully merged blob. Keep the central seed small, make petal lobes narrow and visibly separated, and accept intentional negative space when it makes the role shape legible.", "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.",