2026-10-13 20:49:22 +02:00
|
|
|
// Evaluates the shader flow functions for a buffer of positions and gradients, so that
|
|
|
|
|
// Aetheria.EditorTools.FlowFieldParityVerify can compare them with FlowField (ServerShared). Reads the same global
|
|
|
|
|
// _Flow* uniforms the nebula and stardust read, set by VolumeSampling.LowerFlow.
|
|
|
|
|
#pragma kernel Evaluate
|
2026-10-13 21:50:27 +02:00
|
|
|
// A compute shader declares the global keywords itself (as Stardust.compute does); the flow() it calls is keyword-gated.
|
|
|
|
|
#pragma multi_compile __ FLOW_GLOBAL
|
|
|
|
|
#pragma multi_compile __ FLOW_SLOPE
|
2026-10-13 20:49:22 +02:00
|
|
|
|
|
|
|
|
#include "Assets/Shaders/Volumetric.cginc"
|
|
|
|
|
|
|
|
|
|
StructuredBuffer<float3> positions;
|
|
|
|
|
StructuredBuffer<float2> gradients;
|
|
|
|
|
RWStructuredBuffer<float3> globalOut;
|
|
|
|
|
RWStructuredBuffer<float3> slopeOut;
|
Flow: register the flow keywords, one zone-time value for Zone.Flow and the scroll, presenter phases from zone time, folded scroll, tighter parity
- VolumeSampling registers FLOW_GLOBAL / FLOW_SLOPE with GlobalKeyword.Create (the constructor only looks up).
- FlowField.Scroll folds each Tri3D octave's phase modulo 1 in double (float2, [0,1)); Zone.Flow evaluates at Zone.FlowScroll.
- FlowField.Cycle: the nebula's flow cycle and Stardust's particle lifetime phase come from zone time (_FlowCycle, phase uniform), not _Time.y / Time.time.
- FlowFieldParityVerify reaches the keyword-gated flow(), fails on logged errors, tolerance 3e-4; mutants updated.
Not built or run when committed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 21:43:41 +02:00
|
|
|
RWStructuredBuffer<float3> gatedOut; // flow(): the keyword-gated function the nebula and stardust call
|
2026-10-13 23:25:45 +02:00
|
|
|
RWStructuredBuffer<float> noiseOut; // triNoise3d: the nebula noise the flow advects
|
2026-10-13 20:49:22 +02:00
|
|
|
uint count;
|
|
|
|
|
|
|
|
|
|
[numthreads(64, 1, 1)]
|
|
|
|
|
void Evaluate(uint3 id : SV_DispatchThreadID)
|
|
|
|
|
{
|
|
|
|
|
if (id.x >= count) return;
|
|
|
|
|
globalOut[id.x] = globalFlow(positions[id.x]);
|
|
|
|
|
slopeOut[id.x] = slopeFlow(gradients[id.x]);
|
Flow: register the flow keywords, one zone-time value for Zone.Flow and the scroll, presenter phases from zone time, folded scroll, tighter parity
- VolumeSampling registers FLOW_GLOBAL / FLOW_SLOPE with GlobalKeyword.Create (the constructor only looks up).
- FlowField.Scroll folds each Tri3D octave's phase modulo 1 in double (float2, [0,1)); Zone.Flow evaluates at Zone.FlowScroll.
- FlowField.Cycle: the nebula's flow cycle and Stardust's particle lifetime phase come from zone time (_FlowCycle, phase uniform), not _Time.y / Time.time.
- FlowFieldParityVerify reaches the keyword-gated flow(), fails on logged errors, tolerance 3e-4; mutants updated.
Not built or run when committed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 21:43:41 +02:00
|
|
|
gatedOut[id.x] = flow(positions[id.x]);
|
2026-10-13 23:25:45 +02:00
|
|
|
noiseOut[id.x] = triNoise3d(positions[id.x] / 512);
|
2026-10-13 20:49:22 +02:00
|
|
|
}
|