Give Soul seams facet relief
This commit is contained in:
parent
563a452838
commit
00e104de71
2 changed files with 54 additions and 35 deletions
|
|
@ -6,6 +6,7 @@ static const int SDF_INDEX = 6;
|
|||
struct SoulField
|
||||
{
|
||||
float body;
|
||||
float relief;
|
||||
float riskSeam;
|
||||
float findingEdge;
|
||||
float paneGroove;
|
||||
|
|
@ -26,7 +27,7 @@ struct SoulCutField
|
|||
|
||||
SoulCutField soulCutField(float3 local, float confidence, float risk)
|
||||
{
|
||||
float breathe = 0.018 + confidence * 0.014;
|
||||
float breathe = 0.020 + confidence * 0.018;
|
||||
float3 warped = local + breathe * float3(
|
||||
sin(local.y * 3.1 + local.z * 1.7 + timeSeconds * 0.17),
|
||||
sin(local.z * 2.7 - local.x * 2.2 + timeSeconds * 0.13),
|
||||
|
|
@ -44,12 +45,12 @@ SoulCutField soulCutField(float3 local, float confidence, float risk)
|
|||
float soulBodyDistance(float3 local, float confidence, float risk)
|
||||
{
|
||||
SoulCutField cuts = soulCutField(local, confidence, risk);
|
||||
float scale = lerp(0.66, 0.74, confidence) - risk * 0.030;
|
||||
float bevel = lerp(0.075, 0.040, confidence) + risk * 0.010;
|
||||
float octa = (dot(abs(local), float3(1.0, 1.0, 1.0)) - scale) * 0.57735027;
|
||||
float grownCuts = max(max(abs(cuts.a) - scale * 0.92, abs(cuts.b) - scale * 0.88),
|
||||
max(abs(cuts.c) - scale * 0.94, abs(cuts.d) - scale * 0.90));
|
||||
return max(octa, grownCuts * 0.82) - bevel;
|
||||
float scale = lerp(0.58, 0.66, confidence) - risk * 0.026;
|
||||
float bevel = lerp(0.085, 0.040, confidence) + risk * 0.012;
|
||||
float core = dot(abs(local), float3(0.82, 0.95, 0.88)) * 0.60 - scale;
|
||||
float grownCuts = max(max(abs(cuts.a) - (scale * 0.82), abs(cuts.b) - (scale * 0.78)),
|
||||
max(abs(cuts.c) - (scale * 0.84), abs(cuts.d) - (scale * 0.80)));
|
||||
return max(core, grownCuts) - bevel;
|
||||
}
|
||||
|
||||
SoulField soulField(float3 local, SdfObject sdfObject)
|
||||
|
|
@ -61,35 +62,48 @@ SoulField soulField(float3 local, SdfObject sdfObject)
|
|||
float4 plane = float4(cuts.a, cuts.b, cuts.c, cuts.d);
|
||||
float4 planeAbs = abs(plane);
|
||||
float dominant = max(max(planeAbs.x, planeAbs.y), max(planeAbs.z, planeAbs.w));
|
||||
float smallest = min(min(planeAbs.x, planeAbs.y), min(planeAbs.z, planeAbs.w));
|
||||
float chamber = saturate(1.0 - length(cuts.warped) * 1.22);
|
||||
|
||||
float riskPlane = cuts.b - cuts.c * 0.58 + cuts.d * 0.24 + 0.018 * sin(timeSeconds * 0.51 + confidence * 2.0);
|
||||
float edgeAgreement = min(min(abs(cuts.a - cuts.b), abs(cuts.a + cuts.c)), min(abs(cuts.b + cuts.d), abs(cuts.c - cuts.d)));
|
||||
float riskWidth = lerp(0.012, 0.028, risk);
|
||||
float riskWidth = lerp(0.010, 0.036, risk);
|
||||
float riskSeam = min(abs(riskPlane), edgeAgreement * 0.62 + abs(riskPlane) * 0.42) - riskWidth;
|
||||
float branchA = abs(riskPlane + (cuts.a - cuts.d) * 0.20);
|
||||
float branchB = abs(riskPlane - (cuts.b + cuts.c) * 0.17);
|
||||
float branchC = abs(riskPlane + cuts.a * 0.11 + cuts.b * 0.08 - cuts.d * 0.19);
|
||||
float fracture = min(min(branchA, branchB), branchC) - riskWidth * 0.32;
|
||||
float branchA = abs(riskPlane + (cuts.a - cuts.d) * 0.24);
|
||||
float branchB = abs(riskPlane - (cuts.b + cuts.c) * 0.20);
|
||||
float branchC = abs(riskPlane + cuts.a * 0.12 + cuts.b * 0.09 - cuts.d * 0.21);
|
||||
float fracture = min(min(branchA, branchB), branchC) - riskWidth * 0.40;
|
||||
|
||||
float edgeMask = smoothstep(0.04, 0.30, dominant - min(min(planeAbs.x, planeAbs.y), min(planeAbs.z, planeAbs.w)));
|
||||
float findingWidth = lerp(0.010, 0.024, confidence) * edgeMask;
|
||||
float edgeMask = smoothstep(0.04, 0.30, dominant - smallest);
|
||||
float findingWidth = lerp(0.008, 0.020, confidence) * edgeMask;
|
||||
float findingEdge = edgeAgreement - findingWidth;
|
||||
float paneA = abs(cuts.a * 0.62 + cuts.b * 0.28 - cuts.c * 0.18);
|
||||
float paneB = abs(cuts.c * 0.58 - cuts.d * 0.34 + cuts.a * 0.16);
|
||||
float paneC = abs(cuts.b * 0.44 + cuts.d * 0.48);
|
||||
float paneGroove = min(min(paneA, paneB), paneC) - lerp(0.008, 0.018, confidence);
|
||||
float paneGroove = min(min(paneA, paneB), paneC) - lerp(0.006, 0.014, confidence);
|
||||
float iceGrain = sin(cuts.a * 41.0 + cuts.c * 17.0) * sin(cuts.b * 37.0 - cuts.d * 23.0);
|
||||
float surfaceBand = 1.0 - smoothstep(0.010, 0.18, abs(body));
|
||||
float equatorLift = 1.0 - smoothstep(0.08, 0.56, abs(local.y));
|
||||
float activeFacet = smoothstep(0.02, 0.16, dominant - smallest);
|
||||
float seamMask = 1.0 - smoothstep(0.0, riskWidth + 0.020, abs(riskSeam));
|
||||
float findingMask = 1.0 - smoothstep(0.0, findingWidth + 0.018, abs(findingEdge));
|
||||
float fractureMask = (1.0 - smoothstep(0.0, riskWidth + 0.016, abs(fracture))) * risk;
|
||||
float facetLift = (0.018 + confidence * 0.018 + risk * 0.018) * equatorLift * activeFacet;
|
||||
float grooveCut = (0.014 + confidence * 0.010) * findingMask
|
||||
+ (0.018 + risk * 0.024) * seamMask * risk
|
||||
+ (0.012 + risk * 0.020) * fractureMask;
|
||||
float relief = surfaceBand * (facetLift - grooveCut);
|
||||
|
||||
SoulField field;
|
||||
field.body = body;
|
||||
field.relief = relief;
|
||||
field.riskSeam = riskSeam;
|
||||
field.findingEdge = findingEdge;
|
||||
field.paneGroove = paneGroove;
|
||||
field.fracture = fracture;
|
||||
field.chamber = chamber;
|
||||
field.iceGrain = iceGrain;
|
||||
field.distanceValue = body;
|
||||
field.distanceValue = body - relief;
|
||||
return field;
|
||||
}
|
||||
|
||||
|
|
@ -111,25 +125,25 @@ SdfSurface sdfSurface(float3 p, int sdfIndex)
|
|||
float risk = saturate(sdfObject.state.z * 1.55 + (1.0 - confidence) * 0.35);
|
||||
|
||||
float riskMask = (1.0 - smoothstep(0.0, 0.030, abs(field.riskSeam))) * risk;
|
||||
float fractureMask = (1.0 - riskMask) * (1.0 - smoothstep(0.0, 0.020, abs(field.fracture))) * risk;
|
||||
float findingMask = (1.0 - riskMask) * (1.0 - fractureMask) * (1.0 - smoothstep(0.0, 0.024, abs(field.findingEdge)));
|
||||
float paneMask = (1.0 - riskMask) * (1.0 - fractureMask) * (1.0 - findingMask) * (1.0 - smoothstep(0.0, 0.022, abs(field.paneGroove)));
|
||||
float fractureMask = (1.0 - riskMask) * (1.0 - smoothstep(0.0, 0.022, abs(field.fracture))) * risk;
|
||||
float findingMask = (1.0 - riskMask) * (1.0 - fractureMask) * (1.0 - smoothstep(0.0, 0.028, abs(field.findingEdge)));
|
||||
float paneMask = (1.0 - riskMask) * (1.0 - fractureMask) * (1.0 - findingMask) * (1.0 - smoothstep(0.0, 0.020, abs(field.paneGroove)));
|
||||
float facetMask = saturate(1.0 - riskMask - fractureMask - findingMask - paneMask);
|
||||
|
||||
float frost = 0.5 + 0.5 * field.iceGrain;
|
||||
float3 facetColor = lerp(float3(0.18, 0.24, 0.34), float3(0.70, 0.84, 1.0), confidence) * lerp(0.82, 1.18, frost);
|
||||
float3 paneColor = lerp(float3(0.34, 0.58, 0.86), float3(0.86, 0.97, 1.0), confidence);
|
||||
float3 facetColor = lerp(float3(0.055, 0.075, 0.13), float3(0.46, 0.66, 0.96), confidence) * lerp(0.74, 1.16, frost);
|
||||
float3 paneColor = lerp(float3(0.16, 0.36, 0.70), float3(0.82, 0.96, 1.0), confidence);
|
||||
float3 findingColor = lerp(float3(0.10, 0.30, 0.78), float3(0.68, 0.90, 1.0), confidence);
|
||||
float3 riskColor = lerp(float3(0.30, 0.020, 0.045), float3(0.95, 0.070, 0.055), risk);
|
||||
|
||||
SdfSurface surface;
|
||||
surface.baseColor = facetColor * facetMask + paneColor * paneMask + findingColor * findingMask + riskColor * saturate(riskMask + fractureMask);
|
||||
surface.metallic = 0.0;
|
||||
surface.roughness = 0.18 * facetMask + 0.10 * paneMask + 0.075 * findingMask + 0.14 * saturate(riskMask + fractureMask);
|
||||
surface.emission = paneColor * paneMask * (0.10 + confidence * 0.16)
|
||||
+ findingColor * findingMask * (0.42 + confidence * 0.78)
|
||||
+ riskColor * riskMask * (0.24 + risk * 0.82)
|
||||
+ riskColor * fractureMask * (0.16 + risk * 0.58);
|
||||
surface.roughness = 0.055 * facetMask + 0.070 * paneMask + 0.080 * findingMask + 0.13 * saturate(riskMask + fractureMask);
|
||||
surface.emission = paneColor * paneMask * (0.12 + confidence * 0.22)
|
||||
+ findingColor * findingMask * (0.42 + confidence * 0.82)
|
||||
+ riskColor * riskMask * (0.28 + risk * 0.95)
|
||||
+ riskColor * fractureMask * (0.20 + risk * 0.74);
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
|
@ -146,11 +160,15 @@ float3 soulCrystalShade(float3 p, float3 normal, int sdfIndex, SdfSurface surfac
|
|||
float3 viewDirection = normalize(cameraPosition - p);
|
||||
float ndv = saturate(dot(normal, viewDirection));
|
||||
float3 reflected = reflect(-viewDirection, normal);
|
||||
float3 refracted = refract(-viewDirection, normal, 0.74);
|
||||
float3 refracted = refract(-viewDirection, normal, 0.69);
|
||||
float refractionValid = dot(refracted, refracted) > 0.001 ? 1.0 : 0.0;
|
||||
float3 glassDirection = normalize(lerp(reflected, refracted, refractionValid));
|
||||
float3 glassTint = lerp(float3(0.42, 0.56, 0.86), float3(0.78, 0.90, 1.0), confidence);
|
||||
float3 pseudoRefraction = studioPmremSample(glassDirection, 1.25) * glassTint * 0.88;
|
||||
float3 glassTint = lerp(float3(0.36, 0.50, 0.86), float3(0.72, 0.88, 1.0), confidence);
|
||||
float3 refractedEnv = studioPmremSample(glassDirection, 0.38);
|
||||
float3 reflectedEnv = studioPmremSample(reflected, 0.72);
|
||||
float fresnel = pow(1.0 - ndv, 4.0);
|
||||
float3 pseudoRefraction = (refractedEnv * 0.86 + pow(saturate(refractedEnv), float3(1.45, 1.45, 1.45)) * 0.46) * glassTint
|
||||
+ reflectedEnv * fresnel * 0.38;
|
||||
|
||||
float centerGlow = pow(ndv, 0.72) * saturate(1.45 - length(local) * 0.84);
|
||||
float rimGlow = pow(1.0 - ndv, 2.15);
|
||||
|
|
@ -158,14 +176,14 @@ float3 soulCrystalShade(float3 p, float3 normal, int sdfIndex, SdfSurface surfac
|
|||
float internalChamber = field.chamber * field.chamber;
|
||||
float paneCaustic = (1.0 - smoothstep(0.0, 0.020, abs(field.paneGroove)))
|
||||
* (0.55 + 0.45 * sin((cuts.a * 17.0 + cuts.b * 23.0 + cuts.c * 31.0 + cuts.d * 11.0) + timeSeconds * 0.23));
|
||||
float crackLight = (1.0 - smoothstep(0.0, 0.022, abs(field.riskSeam))) * risk
|
||||
+ (1.0 - smoothstep(0.0, 0.016, abs(field.fracture))) * risk * 0.72;
|
||||
float crackLight = (1.0 - smoothstep(0.0, 0.024, abs(field.riskSeam))) * risk
|
||||
+ (1.0 - smoothstep(0.0, 0.018, abs(field.fracture))) * risk * 0.82;
|
||||
float pulse = 0.88 + 0.12 * sin(timeSeconds * 1.7 + confidence * 2.4);
|
||||
float3 oathLight = float3(1.0, 0.96, 0.82) * pulse * (0.70 + confidence * 1.60) * (centerGlow * 0.62 + internalChamber * 1.58 + rimGlow * 0.18);
|
||||
float3 edgeLight = float3(0.40, 0.74, 1.0) * (rimGlow * 1.05 + facetFlash * 0.55 + paneCaustic * 0.58) * (0.78 + confidence * 0.90);
|
||||
float3 riskFaultLight = float3(1.0, 0.10, 0.055) * crackLight * (0.62 + pow(rimGlow, 0.65) * 0.26);
|
||||
float3 oathLight = float3(1.0, 0.95, 0.78) * pulse * (0.58 + confidence * 1.35) * (centerGlow * 0.78 + internalChamber * 1.32 + rimGlow * 0.26);
|
||||
float3 edgeLight = float3(0.42, 0.72, 1.0) * (rimGlow * 0.90 + facetFlash * 0.55 + paneCaustic * 0.60) * (0.72 + confidence * 0.9);
|
||||
float3 riskFaultLight = float3(1.0, 0.10, 0.055) * crackLight * (0.62 + pow(rimGlow, 0.65) * 0.34);
|
||||
|
||||
return shadeSdfPbr(p, normal, surface) * 0.32
|
||||
return shadeSdfPbr(p, normal, surface) * 0.38
|
||||
+ pseudoRefraction
|
||||
+ oathLight
|
||||
+ edgeLight
|
||||
|
|
|
|||
|
|
@ -86,3 +86,4 @@
|
|||
{"timestamp":"2026-05-13T17:52:00+01:00","topic":"soul-geometry-before-material-tuning","lesson":"When Soul's octahedral constraint-plane geometry reads better than a later material experiment, restore the geometry instead of preserving churn. Make risk and finding features serve the crystal silhouette, then push crystal feel with stronger local caustic/rim/inner-light shading; if it still cannot read refractive, the next coherent step is a real renderer transmission/scene-sampling contract, not more ad hoc shared material flags.","files":["src/Aquarium.Epiphany/Shaders/D3D12SoulAgent.hlsl","state/evidence.jsonl"],"source":"user visual correction after Soul crystal material pass"}
|
||||
{"timestamp":"2026-05-13T18:08:00+01:00","topic":"soul-organic-cut-plane-domain","lesson":"Soul's durable domain is not a rigid octahedron. It is a living crystal governed by an organic family of cutting planes: silhouette, panes, grooves, finding edges, risk seams, fractures, and inner light should read from the same warped plane field so the object feels grown and faceted, not decorated with axis-aligned octahedral markings.","files":["src/Aquarium.Epiphany/Shaders/D3D12SoulAgent.hlsl","state/evidence.jsonl"],"source":"user corrected the octahedral-domain interpretation using imagegen crystal reference"}
|
||||
{"timestamp":"2026-05-13T18:18:00+01:00","topic":"soul-distance-material-authority","lesson":"Soul's raymarch distance must stay owned by the crystalline body silhouette. Cutting-plane seams, pane grooves, finding edges, and risk fractures are surface-domain material/light masks unless they intentionally change the silhouette; smooth-unioning those masks into the trace distance turns cracks into slabs and is SDF Jenga.","files":["src/Aquarium.Epiphany/Shaders/D3D12SoulAgent.hlsl","state/evidence.jsonl"],"source":"user screenshot showed escaped seam planes and called out SDF Jenga risk"}
|
||||
{"timestamp":"2026-05-13T18:34:00+01:00","topic":"soul-facet-relief-not-decals","lesson":"Soul finding seams need real facet-domain relief, not flat decals. Use the organic cutting-plane field to displace the body surface: active facets lift outward along their plane normals, strongest around the equator, while finding/risk/fracture seams cut into that relief. Keep this as bounded body displacement, not smooth-unioned freestanding seam geometry.","files":["src/Aquarium.Epiphany/Shaders/D3D12SoulAgent.hlsl","state/evidence.jsonl"],"source":"user compared current Soul to reference art and identified extruded facets/fractured adjacent faces"}
|
||||
|
|
|
|||
Loading…
Reference in a new issue