Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
ce42fee
security: drop openssl from reqwest, tungstenite, hf-hub, and ort
cursoragent Oct 14, 2026
c5666e9
fix(benches): repair four packages that exit 101 under cargo bench
cursoragent Oct 14, 2026
5fe8695
ci(bench): time measurements separately from compilation
cursoragent Oct 14, 2026
cfe702f
docs: ledger the pre-existing CI failures and their disposition
cursoragent Oct 14, 2026
5529112
ci(sdk,editor): link the Windows staticlib and install libudev for ed…
cursoragent Oct 14, 2026
549578c
ci: re-request checks for the Windows link and editor libudev fix
cursoragent Oct 14, 2026
e5fb20a
ci: fix the failures that appeared once the first layer compiled
cursoragent Oct 14, 2026
e3e29ae
docs: record the benchmark targets that still exceed 600s
cursoragent Oct 14, 2026
6fb3029
fix(physics): step the world before raycast benches query it
cursoragent Oct 14, 2026
4b36da1
test(render): skip GPU tests only when no adapter exists
cursoragent Oct 14, 2026
dafdd78
fix(ci): avoid the Windows audio probe crash and the fmt command-line…
cursoragent Oct 14, 2026
84edd83
fix(audio): isolate the WASAPI open so a missing device cannot crash …
cursoragent Oct 14, 2026
1d38e47
style(render): move the GPU skip test below the probe
cursoragent Oct 15, 2026
a6ffa0b
fix(ci): lavapipe for toolchain tests and a real SDK version parse
cursoragent Oct 15, 2026
3f212ad
fix(sdk): keep the last error on the calling thread
cursoragent Oct 15, 2026
0fa0b7b
docs(sdk): record the thread-local last-error commit in the trace
cursoragent Oct 15, 2026
fdb41e6
fix(audio): give each nextest process its own fixture directory
cursoragent Oct 15, 2026
219a0c0
docs(audio): record the fixture-directory commit in the trace
cursoragent Oct 15, 2026
4fc0a88
docs: own issue 256 as the openssl ban already removed via rustls
cursoragent Oct 15, 2026
8b4b2f5
docs: note that issue 256 could not be closed from this token
cursoragent Oct 15, 2026
e208072
docs: own the deferred-failure issues on the burndown branch
cursoragent Oct 15, 2026
d2979a2
style(editor): return panel defaults directly
cursoragent Oct 15, 2026
2b1e4e3
style(editor): drop format calls that only display one value
cursoragent Oct 15, 2026
aa68832
style(editor): indent doc continuations after list markers
cursoragent Oct 15, 2026
5df7bd2
style(editor): pack oversized function arguments into structs
cursoragent Oct 15, 2026
580641a
style(editor): name the brush-stroke height snapshot type
cursoragent Oct 15, 2026
5bf8c09
style(editor): iterate the values instead of indexing them
cursoragent Oct 15, 2026
4311b7b
style(editor): pass owned strings to the file dialog
cursoragent Oct 15, 2026
0cfec84
style(editor): collapse nested conditions that share one body
cursoragent Oct 15, 2026
eb03f9d
style(editor): use or_default for empty animation and movement state
cursoragent Oct 15, 2026
423b761
style(editor): drop layout parameters that recursion never reads
cursoragent Oct 15, 2026
535ab50
style(editor): set the terrain layer count in the initializer
cursoragent Oct 15, 2026
86afa62
style(editor): shorten scatter hash scales to their f32 values
cursoragent Oct 15, 2026
0b0d1b5
style(editor): replace both name separators in one pass
cursoragent Oct 15, 2026
430bde2
style(editor): drop the hierarchy offset that was always zero
cursoragent Oct 15, 2026
db2242b
style(editor): give the entity catalog a Default impl
cursoragent Oct 15, 2026
5b63cfe
style(editor): use div_ceil for catalog grid rows
cursoragent Oct 15, 2026
dc7b3be
style(editor): test the day window with RangeInclusive
cursoragent Oct 15, 2026
54c17ec
style(editor): use unwrap_or_default when terrain generation fails
cursoragent Oct 15, 2026
9269380
style(editor): skip unreadable scatter directory entries with flatten
cursoragent Oct 15, 2026
75c207f
style(editor): use is_some_and for the physics debug flag
cursoragent Oct 15, 2026
fc5a9ac
style(editor): iterate entity values for component gizmos
cursoragent Oct 15, 2026
297bf89
style(editor): rustfmt the lint edits
cursoragent Oct 15, 2026
cfc4a31
fix(editor): keep the viewport renderer on the UI thread
cursoragent Oct 15, 2026
27fe9ba
docs(editor): record the UI-thread viewport renderer
cursoragent Oct 15, 2026
552711c
fix(editor): skip a viewport op when the renderer is already borrowed
cursoragent Oct 15, 2026
4ca1d91
style(editor): lay out behavior nodes without a self receiver
cursoragent Oct 15, 2026
aa8f2b7
style(editor): publish ImpostorAtlasSize for the bake helper
cursoragent Oct 15, 2026
b3f4386
style(editor): drop the binary's unused TranslateGizmo re-export
cursoragent Oct 15, 2026
bf563f0
style(editor): collapse the tutorial back-button condition
cursoragent Oct 15, 2026
59265e1
style(editor): take TerrainVertex by value in to_engine_vertex
cursoragent Oct 15, 2026
78ea886
style(editor): drop format calls that only display one value
cursoragent Oct 15, 2026
9c49aad
style(editor): replace both file-stem separators in one pass
cursoragent Oct 15, 2026
4d3686a
style(editor): keep the terrain chunk vec that was just collected
cursoragent Oct 15, 2026
5c54d56
style(editor): drop the unused zone index
cursoragent Oct 15, 2026
4eff66e
style(editor): pass the owned viewport error string to the log
cursoragent Oct 15, 2026
17386c3
style(editor): repeat biome fallback pixels from arrays
cursoragent Oct 15, 2026
0134554
style(editor): rustfmt the biome fallback arm
cursoragent Oct 15, 2026
1686043
docs: record the editor clippy burndown as fixed
cursoragent Oct 15, 2026
38bd69d
test(editor): lock CascadeIndex in the shading-mode contract
cursoragent Oct 15, 2026
728b6fa
docs: record the 3df64936 check tally
cursoragent Oct 15, 2026
5faa822
fix(audio): write fixture paths with forward slashes
cursoragent Oct 15, 2026
a47e35b
docs(audio): record the fixture-path commit in the trace
cursoragent Oct 15, 2026
29c6e2b
ci: keep lavapipe and the audio probe on the tiered pipeline
cursoragent Oct 15, 2026
4ed410e
ci: fail cargo deny on advisories, licenses, and unknown git
cursoragent Oct 15, 2026
44e8e05
docs: record the rebase onto current main and the deny gate
cursoragent Oct 15, 2026
fc44dda
docs: record the advisory bumps and the rustls PEM parser
cursoragent Oct 15, 2026
f874fd2
ci: install libudev before the sanitizer jobs
cursoragent Oct 15, 2026
1dd81a4
fix(manifest): drop license keys that repeat license.workspace
cursoragent Oct 16, 2026
1d14445
fix(audio): write the shared fixtures into the directory tests read
cursoragent Oct 16, 2026
fa79b48
fix(fluids): keep lavapipe SPH positions finite at the floor
cursoragent Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(fluids): keep lavapipe SPH positions finite at the floor
Cohesion used kernel_w, which peaks at r = 0, so stacked particles took
a multi-meter correction and the next integrate overflowed to NaN.
The weight now falls to zero at contact. Wall clamps no longer fold the
whole position correction into velocity, and zero vectors are not normalized.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
  • Loading branch information
cursoragent and lazyxeon committed Oct 16, 2026
commit fa79b48736a33c04b6bfe1f7bad85f6cfee4889e
76 changes: 54 additions & 22 deletions astraweave-fluids/shaders/fluid.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ fn kernel_w(r: f32, h: f32) -> f32 {
}
}

// `normalize(0)` is a NaN on lavapipe. Coincident particles and a flat SDF
// gradient both produce a zero vector; the force must be zero, not NaN.
fn safe_normalize(v: vec3<f32>) -> vec3<f32> {
let len2 = dot(v, v);
if (len2 <= 1e-12) {
return vec3<f32>(0.0);
}
return v * inverseSqrt(len2);
}

fn kernel_grad_w(r: f32, diff: vec3<f32>, h: f32) -> vec3<f32> {
let q = r / h;
if (q >= 1.0 || r <= 0.0001) { return vec3<f32>(0.0); }
Expand Down Expand Up @@ -269,14 +279,14 @@ fn compute_delta_pos(@builtin(global_invocation_id) global_id: vec3<u32>) {
if (obj.half_extents.w < 0.5) { // Box
dist = sd_box(p_local, obj.half_extents.xyz);
// Gradient approximation for box
local_normal = normalize(sign(p_local) * max(abs(p_local) - obj.half_extents.xyz, vec3<f32>(0.001)));
local_normal = safe_normalize(sign(p_local) * max(abs(p_local) - obj.half_extents.xyz, vec3<f32>(0.001)));
} else { // Sphere
dist = length(p_local) - obj.half_extents.x;
local_normal = normalize(p_local);
local_normal = safe_normalize(p_local);
}

if (dist < 0.1) {
let world_normal = normalize((obj.transform * vec4<f32>(local_normal, 0.0)).xyz);
let world_normal = safe_normalize((obj.transform * vec4<f32>(local_normal, 0.0)).xyz);
delta_p += world_normal * (0.1 - dist) * 0.5; // Soft collision resolve
}
}
Expand All @@ -302,18 +312,17 @@ fn compute_delta_pos(@builtin(global_invocation_id) global_id: vec3<u32>) {
if (r < h) {
let lambda_j = particles[current].lambda;

// Tensile instability correction (scorr)
// Tensile instability correction (scorr)
let scorr = -0.001 * pow(kernel_w(r, h) / kernel_w(0.1 * h, h), 4.0);

// --- Akinci et al. 2013 Surface Tension ---
// Cohesion force: f_cohesion = -gamma * m^2 * C(r) * (x_i - x_j)/|x_i - x_j|
let cohesion_weight = kernel_w(r, h); // Simplified C(r)
let cohesion = -params.surface_tension * cohesion_weight * normalize(diff);

// Curvature force: f_curvature = -gamma * m * (n_i - n_j)
// (n is surface normal, simplified here as gradient of color field)
// For simplicity in this kernel, we'll combine them into a versatile term


// Akinci cohesion is 0 at r = 0. Using kernel_w alone
// peaks there, so once lavapipe stacks particles the
// force is several meters per iteration and the next
// integrate turns that into a NaN velocity.
let cohesion_weight = kernel_w(r, h) * (r / h);
let cohesion = -params.surface_tension * cohesion_weight * safe_normalize(diff);

delta_p += (lambda_i + lambda_j + scorr) * kernel_grad_w(r, diff, h) + cohesion;
}
}
Expand Down Expand Up @@ -354,7 +363,7 @@ fn integrate(@builtin(global_invocation_id) global_id: vec3<u32>) {
let nz = textureSampleLevel(sdf_texture, default_sampler, voxel_pos + vec3<f32>(0.0, 0.0, eps), 0.0).r -
textureSampleLevel(sdf_texture, default_sampler, voxel_pos - vec3<f32>(0.0, 0.0, eps), 0.0).r;

let normal = normalize(vec3<f32>(nx, ny, nz));
let normal = safe_normalize(vec3<f32>(nx, ny, nz));

// Push out of surface
pred_pos += normal * (particle_radius - sdf_dist);
Expand All @@ -365,18 +374,41 @@ fn integrate(@builtin(global_invocation_id) global_id: vec3<u32>) {
// if (normal_vel < 0.0) { pred_pos -= normal * normal_vel * params.dt * 0.5; }
}

// Velocity from the unconstrained prediction. Clamping the position
// first folds the whole correction into (pos_clamped - old) / dt, which
// is tens of m/s on the floor and then feeds the next step until a
// component overflows to NaN. Lavapipe reaches that overflow; a desktop
// GPU often stops just short of it.
var vel = (pred_pos - old_pos) / params.dt;

// Boundary Handling (Secondary fallback)
let bounds_x = 29.5;
let bounds_z = 29.5;
let bounds_y = 59.5;
if (pred_pos.y < 0.0) { pred_pos.y = 0.0; }
if (pred_pos.y > bounds_y) { pred_pos.y = bounds_y; }
if (pred_pos.x < -bounds_x) { pred_pos.x = -bounds_x; }
if (pred_pos.x > bounds_x) { pred_pos.x = bounds_x; }
if (pred_pos.z < -bounds_z) { pred_pos.z = -bounds_z; }
if (pred_pos.z > bounds_z) { pred_pos.z = bounds_z; }

var vel = (pred_pos - old_pos) / params.dt;
if (pred_pos.y < 0.0) {
pred_pos.y = 0.0;
vel.y = max(vel.y, 0.0);
}
if (pred_pos.y > bounds_y) {
pred_pos.y = bounds_y;
vel.y = min(vel.y, 0.0);
}
if (pred_pos.x < -bounds_x) {
pred_pos.x = -bounds_x;
vel.x = max(vel.x, 0.0);
}
if (pred_pos.x > bounds_x) {
pred_pos.x = bounds_x;
vel.x = min(vel.x, 0.0);
}
if (pred_pos.z < -bounds_z) {
pred_pos.z = -bounds_z;
vel.z = max(vel.z, 0.0);
}
if (pred_pos.z > bounds_z) {
pred_pos.z = bounds_z;
vel.z = min(vel.z, 0.0);
}

// --- Vorticity Confinement ---
// Calculate local curl and apply force to preserve energy
Expand Down
3 changes: 2 additions & 1 deletion docs/architecture/fluids.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lifecycle_status: dormant
integration_status: example_only
summary: "Post-W.1: SPH/voxel/simd_ops removed (−58.8K LoC). Now the deprecated PBD remnant + retained F.4 GPU-particle accent substrate; only examples consume. Water rendering successor lives in water.md. fluids.md §0.5,§0.6"
owns: [astraweave-fluids]
doc_version: "2.0"
doc_version: "2.1"
last_verified_commit: 7c29b8182
---

Expand Down Expand Up @@ -933,6 +933,7 @@ Per README:

| Version | Date | Change |
|---|---|---|
| 2.1 | 2026-10-16 | **Lavapipe SPH NaN.** `delta_pos` cohesion weight is `kernel_w * (r/h)` so it is 0 at coincident particles (`normalize(0)` was NaN). `safe_normalize` covers the SDF gradient and object normals. `integrate` takes velocity from the pre-clamp prediction and zeroes the into-wall component. `gpu_containment_invariant_120_frames` and `gpu_settling_envelope_300_frames` stay finite on lavapipe. |
| 2.0 | 2026-10-14 | **WS-STAB caustics.** CPU `hash_2d` is an integer mix of IEEE bits. Depth falloff uses `det_powf` (add/mul/div and `f32` constants only). `test_sample_multi_point_golden` locks `to_bits` `(1050907696, 1041034631, 1050301147)`. The WGSL hash no longer calls `sin`. |
| 1.0–1.2 | 2026-05-12 | Initial trace + verification + deep-investigation passes |
| 1.3 | 2026-06-11 | **F.1 revision** (§0): F.0 audit corrections (phantom `ResearchFluidSystem`, 9th orphan shader, ping-pong-defect invariants) + F.1 code deltas (FluidSystem repair, 5 SDF fixes, UnifiedSolver deletion, DFSPH/IISPH variant removal, `experimental` feature, serde unconditional, validation honesty, first GPU tests + baselines) + determinism carve-out policy. §8 invariants 21–23 rewritten; §11 closures. Body sections older than §0 should be read through the §0 corrections; a full re-verification pass is queued post-campaign. |
Expand Down
Loading