authoravatarclover caruso<git@paperclover.net>2026-12-01 15:46:09-08:00
committeravatarclover caruso<git@paperclover.net>2026-12-01 15:49:39-08:00
logf80b0ebc6787471689dc60d888ce6ebb3bcf5b8f
treea2af7f0a847455910433499600f1f26db0ac3b64
parent4d054f69bca32d2db45fd0b038b40afd6834054b
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Wave 26 integration: restore particles/ submodules and update accuracy ledger + compatibility.md


5 files changed, 1141 insertions(+), 2465 deletions(-)

compatibility.md+15-15
...@@ -11,7 +11,7 @@ Fission currently supports **125** tool types across 2D/3D compositing, all with...@@ -11,7 +11,7 @@ Fission currently supports **125** tool types across 2D/3D compositing, all with
11| **Supported Tools** | **125** |11| **Supported Tools** | **125** |
12| **Modifiers & Animation** | **8** |12| **Modifiers & Animation** | **8** |
13| **Accuracy across [paper clover](https://paperclover.net)'s compositions** | **99.5%** |13| **Accuracy across [paper clover](https://paperclover.net)'s compositions** | **99.5%** |
14| **Supported Tool Accuracy** | **99.5%** |14| **Supported Tool Accuracy** | **99.7%** |
15| **Supported Tools with 100% Accuracy** | **46** |15| **Supported Tools with 100% Accuracy** | **46** |
16| **Coverage of Fusion's Built-in Tools** | **28.0%** |16| **Coverage of Fusion's Built-in Tools** | **28.0%** |
17| **Coverage of All Fuses on Reactor** | **0.5%** |17| **Coverage of All Fuses on Reactor** | **0.5%** |
...@@ -22,10 +22,10 @@ Fission currently supports **125** tool types across 2D/3D compositing, all with...@@ -22,10 +22,10 @@ Fission currently supports **125** tool types across 2D/3D compositing, all with
22| --- | --- | --- |22| --- | --- | --- |
23| `Background` | ✅ 100.0% | — |23| `Background` | ✅ 100.0% | — |
24| `FastNoise` | ✅ 100.0% | — |24| `FastNoise` | ✅ 100.0% | — |
25| `Plasma` | 98.1% | — |25| `Plasma` | 99.9% | — |
26| `TextPlus` | 99.4% | — |26| `TextPlus` | 99.4% | — |
27| `Loader` | ✅ 100.0% | — |27| `Loader` | ✅ 100.0% | — |
28| `DaySky` | 98.9% | — |28| `DaySky` | 99.9% | — |
29| `Fuse.CheckerPieceGenerator` | ✅ 100.0% | — |29| `Fuse.CheckerPieceGenerator` | ✅ 100.0% | — |
3030
31## Compositing & Blending31## Compositing & Blending
...@@ -77,7 +77,7 @@ Fission currently supports **125** tool types across 2D/3D compositing, all with...@@ -77,7 +77,7 @@ Fission currently supports **125** tool types across 2D/3D compositing, all with
77| `Fuse.XGlow` | 99.2%–99.8% | Octave-capped in `Fast` mode. |77| `Fuse.XGlow` | 99.2%–99.8% | Octave-capped in `Fast` mode. |
78| `ErodeDilate` | ✅ 100.0% | — |78| `ErodeDilate` | ✅ 100.0% | — |
79| `RemoveNoise` | ✅ 100.0% | — |79| `RemoveNoise` | ✅ 100.0% | — |
80| `FilmGrain` | 96.2% | Stochastic per-frame PRNG seed differs from Fusion. |80| `FilmGrain` | 96.3% | Stochastic per-frame PRNG seed differs from Fusion. |
81| `Fuse.Outline` | 99.5%–99.9% | — |81| `Fuse.Outline` | 99.5%–99.9% | — |
82| `Fuse.XfChroma` | 99.5%–99.9% | — |82| `Fuse.XfChroma` | 99.5%–99.9% | — |
83| `Fuse.AlphaWeightedNoise` | Visual* | Stochastic per-pixel PRNG seed differs from Lua `math.random`. |83| `Fuse.AlphaWeightedNoise` | Visual* | Stochastic per-pixel PRNG seed differs from Lua `math.random`. |
...@@ -133,15 +133,15 @@ Fission currently supports **125** tool types across 2D/3D compositing, all with...@@ -133,15 +133,15 @@ Fission currently supports **125** tool types across 2D/3D compositing, all with
133133
134| Tool | Accuracy | Notes |134| Tool | Accuracy | Notes |
135| --- | --- | --- |135| --- | --- | --- |
136| `pRender` | 98.4% | 2D mode only (no 3D particle renderer); stochastic PRNG seed differs. |136| `pRender` | 99.7% | 2D mode only (no 3D particle renderer); stochastic PRNG seed differs. |
137| `pEmitter` | 98.2% | Stochastic PRNG seed differs; cold starts >600 frames window-simulate. |137| `pEmitter` | 99.8% | Stochastic PRNG seed differs; cold starts >600 frames window-simulate. |
138| `pPointForce` | 98.5% | — |138| `pPointForce` | 99.8% | — |
139| `pDirectionalForce` | 98.5% | — |139| `pDirectionalForce` | 99.8% | — |
140| `pTurbulence` | 98.6% | — |140| `pTurbulence` | 99.8% | — |
141| `pDrag` | 98.6% | — |141| `pDrag` | 99.8% | — |
142| `pKill` | 99.1% | — |142| `pKill` | 99.1% | — |
143| `pMerge` | 99.7% | — |143| `pMerge` | 99.7% | — |
144| `pBounce` | 98.6% | — |144| `pBounce` | 99.8% | — |
145145
146## 3D Pipeline146## 3D Pipeline
147147
...@@ -155,16 +155,16 @@ Each 3D tool's accuracy is measured by rendering it inside a lit `Merge3D` + `Ca...@@ -155,16 +155,16 @@ Each 3D tool's accuracy is measured by rendering it inside a lit `Merge3D` + `Ca
155| `Transform3D` | 99.4% | — |155| `Transform3D` | 99.4% | — |
156| `ImagePlane3D` | 99.2% | — |156| `ImagePlane3D` | 99.2% | — |
157| `Shape3D` | 99.9% | — |157| `Shape3D` | 99.9% | — |
158| `Cube3D` | 98.6% | — |158| `Cube3D` | 99.9% | — |
159| `SurfaceFBXMesh` | Visual* | Static mesh only (no skeletal skinning/morph animation). |159| `SurfaceFBXMesh` | Visual* | Static mesh only (no skeletal skinning/morph animation). |
160| `Text3D` | 97.9% | Bevels not implemented. |160| `Text3D` | 98.5% | Bevels not implemented. |
161| `LightAmbient` | ✅ 100.0% | — |161| `LightAmbient` | ✅ 100.0% | — |
162| `LightDirectional` | 99.9% | Up to 4 directional lights per scene; shadow maps pending (`#46`). |162| `LightDirectional` | 99.9% | Up to 4 directional lights per scene; shadow maps pending (`#46`). |
163| `LightPoint` | 99.9% | — |163| `LightPoint` | 99.9% | — |
164| `LightSpot` | 99.6% | Spot shadow maps pending (`#46`). |164| `LightSpot` | 99.6% | Spot shadow maps pending (`#46`). |
165| `MtlBlinn` | 99.2% | — |165| `MtlBlinn` | 99.6% | — |
166| `MtlCookTorrance` | 98.9% | — |166| `MtlCookTorrance` | 98.9% | — |
167| `MtlPhong` | 98.9% | — |167| `MtlPhong` | 99.4% | — |
168| `Texture2DOperator` | 99.3% | — |168| `Texture2DOperator` | 99.3% | — |
169| `TextureTransformOperator` | 99.6% | — |169| `TextureTransformOperator` | 99.6% | — |
170| `BumpMap` | 99.2% | — |170| `BumpMap` | 99.2% | — |
crates/engine/src/particles.rs+2-1879
...@@ -4,6 +4,8 @@...@@ -4,6 +4,8 @@
4//! `pDrag` / `pFriction`, `pKill`, `pBounce`, `pMerge`, and `pRender` (2D mode).4//! `pDrag` / `pFriction`, `pKill`, `pBounce`, `pMerge`, and `pRender` (2D mode).
55
6mod plan;6mod plan;
7mod raster;
8mod sim;
7#[cfg(test)]9#[cfg(test)]
8mod tests;10mod tests;
911
...@@ -309,1885 +311,6 @@ pub fn render_particles_2d(...@@ -309,1885 +311,6 @@ pub fn render_particles_2d(
309}311}
310312
311/// Per-frame particle emission, regions, forces, collisions, and simulation stepping.313/// Per-frame particle emission, regions, forces, collisions, and simulation stepping.
312mod sim {
313 use std::collections::HashSet;
314
315 use model::{Comp, ExprEngine, Node};
316
317 use super::plan::ParticlePlan;
318 use super::{
319 MAX_PARTICLES, POINT_FORCE_SCALE, Particle, SimState, SplitMix64, TURBULENCE_SCALE,
320 VELOCITY_SCALE,
321 };
322
323 /// Advances the particle simulation by a single integer frame `frame`.
324 pub(super) fn step_simulation(
325 state: &mut SimState,
326 comp: &Comp,
327 plan: &ParticlePlan,
328 frame: i64,
329 expr: &ExprEngine,
330 ) {
331 let t = frame as f64;
332
333 // 1. Apply forces & kills to existing live particles, then integrate motion and age.
334 if !state.particles.is_empty() {
335 for (mod_id, scope) in &plan.modifiers {
336 let Some(node) = comp.nodes.get(mod_id.0) else {
337 continue;
338 };
339 apply_modifier(&mut state.particles, comp, node, scope, t, expr);
340 }
341
342 for p in &mut state.particles {
343 if !p.alive {
344 continue;
345 }
346 p.pos[0] += p.vel[0];
347 p.pos[1] += p.vel[1];
348 p.pos[2] += p.vel[2];
349 p.rot_z += p.spin_z;
350 p.age += 1.0;
351 if p.age >= p.lifespan {
352 p.alive = false;
353 }
354 }
355 state.particles.retain(|p| p.alive);
356 }
357
358 // 2. Emit new particles for `frame` (born with `age = 0.0` at their spawn region).
359 let first_new = state.particles.len();
360 for &(emitter_id, emitter_hash) in &plan.emitters {
361 if state.particles.len() >= MAX_PARTICLES {
362 break;
363 }
364 let Some(node) = comp.nodes.get(emitter_id.0) else {
365 continue;
366 };
367 emit_particles(state, comp, node, emitter_hash, frame, t, expr);
368 }
369
370 // A newborn is damped by friction and then integrated once on its birth frame; other forces
371 // only start acting next frame.
372 for (mod_id, scope) in &plan.modifiers {
373 let Some(node) = comp.nodes.get(mod_id.0) else {
374 continue;
375 };
376 if matches!(node.kind.as_str(), "pDrag" | "pFriction") {
377 apply_modifier(&mut state.particles[first_new..], comp, node, scope, t, expr);
378 }
379 }
380 for p in &mut state.particles[first_new..] {
381 for axis in 0..3 {
382 p.pos[axis] += p.vel[axis];
383 }
384 p.rot_z += p.spin_z;
385 }
386 }
387
388 fn emit_particles(
389 state: &mut SimState,
390 comp: &Comp,
391 node: &Node,
392 emitter_hash: u64,
393 frame: i64,
394 t: f64,
395 expr: &ExprEngine,
396 ) {
397 let seed = comp.eval_number(node, "RandomSeed", t, 0.0, expr).round() as i64;
398 let mut rng = SplitMix64::from_parts(seed, frame, &node.name);
399
400 let number = comp.eval_number(node, "Number", t, 10.0, expr).max(0.0);
401 let number_var = comp
402 .eval_number(node, "NumberVariance", t, 0.0, expr)
403 .max(0.0);
404
405 let rate = (number + rng.signed() * number_var).max(0.0);
406 let accum = state.emit_accum.entry(emitter_hash).or_insert(0.0);
407 *accum += rate;
408 let mut emit_count = accum.floor() as usize;
409 *accum -= emit_count as f64;
410
411 if emit_count == 0 {
412 return;
413 }
414 let remaining_cap = MAX_PARTICLES.saturating_sub(state.particles.len());
415 if emit_count > remaining_cap {
416 emit_count = remaining_cap;
417 }
418
419 let lifespan_base = comp.eval_number(node, "Lifespan", t, 100.0, expr).max(1.0);
420 let lifespan_var = comp
421 .eval_number(node, "LifespanVariance", t, 0.0, expr)
422 .max(0.0);
423 let pos_var = comp
424 .eval_number(node, "PositionVariance", t, 0.0, expr)
425 .max(0.0);
426
427 let vel_base = comp.eval_number(node, "Velocity", t, 0.0, expr);
428 let vel_var = comp
429 .eval_number(node, "VelocityVariance", t, 0.0, expr)
430 .max(0.0);
431 let angle_base = comp.eval_number(node, "Angle", t, 0.0, expr);
432 let angle_var = comp
433 .eval_number(node, "AngleVariance", t, 0.0, expr)
434 .max(0.0);
435 let angle_z_base = comp.eval_number(node, "AngleZ", t, 0.0, expr);
436 let angle_z_var = comp
437 .eval_number(node, "AngleZVariance", t, 0.0, expr)
438 .max(0.0);
439
440 let rot_z_base = comp.eval_number(node, "RotationZ", t, 0.0, expr);
441 let rot_z_var = comp
442 .eval_number(node, "RotationZVariance", t, 0.0, expr)
443 .max(0.0);
444 let spin_z_base = comp.eval_number(node, "SpinZ", t, 0.0, expr);
445 let spin_z_var = comp
446 .eval_number(node, "SpinZVariance", t, 0.0, expr)
447 .max(0.0);
448
449 let base_r = comp.eval_number(node, "ParticleStyle.Red", t, 1.0, expr);
450 let base_g = comp.eval_number(node, "ParticleStyle.Green", t, 1.0, expr);
451 let base_b = comp.eval_number(node, "ParticleStyle.Blue", t, 1.0, expr);
452 let base_a = comp.eval_number(node, "ParticleStyle.Alpha", t, 1.0, expr);
453
454 let red_lo_off = comp.eval_number(node, "ParticleStyle.RedLow", t, 0.0, expr);
455 let red_hi_off = comp.eval_number(node, "ParticleStyle.RedHigh", t, 0.0, expr);
456 let green_lo_off = comp.eval_number(node, "ParticleStyle.GreenLow", t, 0.0, expr);
457 let green_hi_off = comp.eval_number(node, "ParticleStyle.GreenHigh", t, 0.0, expr);
458 let blue_lo_off = comp.eval_number(node, "ParticleStyle.BlueLow", t, 0.0, expr);
459 let blue_hi_off = comp.eval_number(node, "ParticleStyle.BlueHigh", t, 0.0, expr);
460 let alpha_lo_off = comp.eval_number(node, "ParticleStyle.AlphaLow", t, 0.0, expr);
461 let alpha_hi_off = comp.eval_number(node, "ParticleStyle.AlphaHigh", t, 0.0, expr);
462
463 let color_var = comp.eval_number(node, "ParticleStyle.ColorVariance", t, 0.0, expr) > 0.5
464 || red_lo_off.abs() > 1e-9
465 || red_hi_off.abs() > 1e-9
466 || green_lo_off.abs() > 1e-9
467 || green_hi_off.abs() > 1e-9
468 || blue_lo_off.abs() > 1e-9
469 || blue_hi_off.abs() > 1e-9
470 || alpha_lo_off.abs() > 1e-9
471 || alpha_hi_off.abs() > 1e-9;
472
473 let r_lo = (base_r + red_lo_off).clamp(0.0, 1.0);
474 let r_hi = (base_r + red_hi_off).clamp(0.0, 1.0);
475 let g_lo = (base_g + green_lo_off).clamp(0.0, 1.0);
476 let g_hi = (base_g + green_hi_off).clamp(0.0, 1.0);
477 let b_lo = (base_b + blue_lo_off).clamp(0.0, 1.0);
478 let b_hi = (base_b + blue_hi_off).clamp(0.0, 1.0);
479 let a_lo = (base_a + alpha_lo_off).clamp(0.0, 1.0);
480 let a_hi = (base_a + alpha_hi_off).clamp(0.0, 1.0);
481
482 // Fusion's ParticleStyle.Size defaults to 0.1 across all styles.
483 let size_base = comp
484 .eval_number(node, "ParticleStyle.Size", t, 0.1, expr)
485 .max(0.0);
486 let size_var = comp
487 .eval_number(node, "ParticleStyle.SizeVariance", t, 0.0, expr)
488 .max(0.0);
489
490 let region = RegionSpec::from_node(comp, node, t, expr);
491 state.particles.reserve(emit_count);
492
493 for _ in 0..emit_count {
494 let mut pos = region.sample(&mut rng);
495 if pos_var > 0.0 {
496 pos[0] += rng.signed() * pos_var;
497 pos[1] += rng.signed() * pos_var;
498 pos[2] += rng.signed() * pos_var;
499 }
500
501 let speed = (vel_base + rng.signed() * vel_var) * VELOCITY_SCALE;
502 let ang = (angle_base + rng.signed() * angle_var).to_radians();
503 let ang_z = (angle_z_base + rng.signed() * angle_z_var).to_radians();
504 let cos_z = ang_z.cos();
505 let vel = [
506 speed * ang.cos() * cos_z,
507 speed * ang.sin() * cos_z,
508 speed * ang_z.sin(),
509 ];
510
511 let rot_z = rot_z_base + rng.signed() * rot_z_var;
512 let spin_z = spin_z_base + rng.signed() * spin_z_var;
513 let lifespan = (lifespan_base + rng.signed() * lifespan_var).max(1.0);
514 let size = (size_base + rng.signed() * size_var).max(0.0);
515
516 let color = if color_var {
517 [
518 rng.range(r_lo, r_hi) as f32,
519 rng.range(g_lo, g_hi) as f32,
520 rng.range(b_lo, b_hi) as f32,
521 rng.range(a_lo, a_hi) as f32,
522 ]
523 } else {
524 [
525 base_r.clamp(0.0, 1.0) as f32,
526 base_g.clamp(0.0, 1.0) as f32,
527 base_b.clamp(0.0, 1.0) as f32,
528 base_a.clamp(0.0, 1.0) as f32,
529 ]
530 };
531
532 state.particles.push(Particle {
533 emitter_hash,
534 pos,
535 vel,
536 rot_z,
537 spin_z,
538 age: 0.0,
539 lifespan,
540 size,
541 color,
542 alive: true,
543 });
544 }
545 }
546
547 #[derive(Clone, Copy)]
548 pub(super) enum RegionSpec {
549 Point {
550 center: [f64; 3],
551 },
552 Rect {
553 center: [f64; 3],
554 width: f64,
555 height: f64,
556 },
557 Sphere {
558 center: [f64; 3],
559 radius: f64,
560 },
561 Cube {
562 center: [f64; 3],
563 width: f64,
564 height: f64,
565 depth: f64,
566 },
567 Line {
568 start: [f64; 3],
569 end: [f64; 3],
570 },
571 All,
572 }
573
574 impl RegionSpec {
575 pub(super) fn from_node(comp: &Comp, node: &Node, t: f64, expr: &ExprEngine) -> Self {
576 let region_name = node.static_str("Region").unwrap_or("SphereRgn");
577 match region_name {
578 "RectRgn" => Self::Rect {
579 center: [
580 comp.eval_number(node, "RectRgn.Translate.X", t, 0.0, expr),
581 comp.eval_number(node, "RectRgn.Translate.Y", t, 0.0, expr),
582 comp.eval_number(node, "RectRgn.Translate.Z", t, 0.0, expr),
583 ],
584 width: comp.eval_number(node, "RectRgn.Width", t, 0.1, expr).abs(),
585 height: comp.eval_number(node, "RectRgn.Height", t, 0.1, expr).abs(),
586 },
587 "SphereRgn" => Self::Sphere {
588 center: [
589 comp.eval_number(node, "SphereRgn.Translate.X", t, 0.0, expr),
590 comp.eval_number(node, "SphereRgn.Translate.Y", t, 0.0, expr),
591 comp.eval_number(node, "SphereRgn.Translate.Z", t, 0.0, expr),
592 ],
593 radius: comp.eval_number(node, "SphereRgn.Size", t, 0.1, expr).abs() * 0.5,
594 },
595 "CubeRgn" => Self::Cube {
596 center: [
597 comp.eval_number(node, "CubeRgn.Translate.X", t, 0.0, expr),
598 comp.eval_number(node, "CubeRgn.Translate.Y", t, 0.0, expr),
599 comp.eval_number(node, "CubeRgn.Translate.Z", t, 0.0, expr),
600 ],
601 width: comp.eval_number(node, "CubeRgn.Width", t, 0.1, expr).abs(),
602 height: comp.eval_number(node, "CubeRgn.Height", t, 0.1, expr).abs(),
603 depth: comp.eval_number(node, "CubeRgn.Depth", t, 0.1, expr).abs(),
604 },
605 "LineRgn" => {
606 let tx = comp.eval_number(node, "LineRgn.Translate.X", t, 0.0, expr);
607 let ty = comp.eval_number(node, "LineRgn.Translate.Y", t, 0.0, expr);
608 let tz = comp.eval_number(node, "LineRgn.Translate.Z", t, 0.0, expr);
609 Self::Line {
610 start: [
611 tx + comp.eval_number(node, "LineRgn.Start.X", t, -0.5, expr),
612 ty + comp.eval_number(node, "LineRgn.Start.Y", t, 0.0, expr),
613 tz + comp.eval_number(node, "LineRgn.Start.Z", t, 0.0, expr),
614 ],
615 end: [
616 tx + comp.eval_number(node, "LineRgn.End.X", t, 0.5, expr),
617 ty + comp.eval_number(node, "LineRgn.End.Y", t, 0.0, expr),
618 tz + comp.eval_number(node, "LineRgn.End.Z", t, 0.0, expr),
619 ],
620 }
621 }
622 "AllRgn" | "All" => Self::All,
623 _ => Self::Point {
624 center: [
625 comp.eval_number(node, "Point.Translate.X", t, 0.0, expr),
626 comp.eval_number(node, "Point.Translate.Y", t, 0.0, expr),
627 comp.eval_number(node, "Point.Translate.Z", t, 0.0, expr),
628 ],
629 },
630 }
631 }
632
633 fn sample(&self, rng: &mut SplitMix64) -> [f64; 3] {
634 match *self {
635 Self::Point { center } => center,
636 Self::Rect {
637 center,
638 width,
639 height,
640 } => [
641 center[0] + (rng.next_f64() - 0.5) * width,
642 center[1] + (rng.next_f64() - 0.5) * height,
643 center[2],
644 ],
645 Self::Sphere { center, radius } => {
646 let u = rng.next_f64();
647 let v = rng.next_f64();
648 let w = rng.next_f64();
649 let theta = u * std::f64::consts::TAU;
650 let cos_phi = 2.0 * v - 1.0;
651 let sin_phi = (1.0 - cos_phi * cos_phi).max(0.0).sqrt();
652 let r = radius * w.cbrt();
653 [
654 center[0] + r * sin_phi * theta.cos(),
655 center[1] + r * sin_phi * theta.sin(),
656 center[2] + r * cos_phi,
657 ]
658 }
659 Self::Cube {
660 center,
661 width,
662 height,
663 depth,
664 } => [
665 center[0] + (rng.next_f64() - 0.5) * width,
666 center[1] + (rng.next_f64() - 0.5) * height,
667 center[2] + (rng.next_f64() - 0.5) * depth,
668 ],
669 Self::Line { start, end } => {
670 let u = rng.next_f64();
671 [
672 start[0] + (end[0] - start[0]) * u,
673 start[1] + (end[1] - start[1]) * u,
674 start[2] + (end[2] - start[2]) * u,
675 ]
676 }
677 Self::All => [0.0, 0.0, 0.0],
678 }
679 }
680
681 fn contains(&self, p: [f64; 3]) -> bool {
682 match *self {
683 Self::All => true,
684 Self::Point { center } => {
685 let dx = p[0] - center[0];
686 let dy = p[1] - center[1];
687 let dz = p[2] - center[2];
688 dx * dx + dy * dy + dz * dz <= 1e-4
689 }
690 Self::Rect {
691 center,
692 width,
693 height,
694 } => {
695 (p[0] - center[0]).abs() <= width * 0.5
696 && (p[1] - center[1]).abs() <= height * 0.5
697 }
698 Self::Sphere { center, radius } => {
699 let dx = p[0] - center[0];
700 let dy = p[1] - center[1];
701 let dz = p[2] - center[2];
702 dx * dx + dy * dy + dz * dz <= radius * radius
703 }
704 Self::Cube {
705 center,
706 width,
707 height,
708 depth,
709 } => {
710 (p[0] - center[0]).abs() <= width * 0.5
711 && (p[1] - center[1]).abs() <= height * 0.5
712 && (p[2] - center[2]).abs() <= depth * 0.5
713 }
714 Self::Line { start, end } => {
715 let vx = end[0] - start[0];
716 let vy = end[1] - start[1];
717 let vz = end[2] - start[2];
718 let len_sq = vx * vx + vy * vy + vz * vz;
719 let u = if len_sq > 1e-9 {
720 (((p[0] - start[0]) * vx + (p[1] - start[1]) * vy + (p[2] - start[2]) * vz)
721 / len_sq)
722 .clamp(0.0, 1.0)
723 } else {
724 0.0
725 };
726 let cx = start[0] + vx * u;
727 let cy = start[1] + vy * u;
728 let cz = start[2] + vz * u;
729 let dx = p[0] - cx;
730 let dy = p[1] - cy;
731 let dz = p[2] - cz;
732 dx * dx + dy * dy + dz * dz <= 1e-3
733 }
734 }
735 }
736
737 /// Parses a `pBounce` region (supports `LineRgn`, `RectRgn`, `CubeRgn`, `SphereRgn`,
738 /// `MeshRegion`, and `Transform3DOp.Translate` fallback).
739 fn from_bounce_node(comp: &Comp, node: &Node, t: f64, expr: &ExprEngine) -> Self {
740 let tx = comp.eval_number(node, "Transform3DOp.Translate.X", t, 0.0, expr);
741 let ty = comp.eval_number(node, "Transform3DOp.Translate.Y", t, 0.0, expr);
742 let tz = comp.eval_number(node, "Transform3DOp.Translate.Z", t, 0.0, expr);
743 match node.static_str("Region") {
744 Some("RectRgn") => Self::Rect {
745 center: [
746 comp.eval_number(node, "RectRgn.Translate.X", t, tx, expr),
747 comp.eval_number(node, "RectRgn.Translate.Y", t, ty, expr),
748 comp.eval_number(node, "RectRgn.Translate.Z", t, tz, expr),
749 ],
750 width: comp.eval_number(node, "RectRgn.Width", t, 0.1, expr).abs(),
751 height: comp.eval_number(node, "RectRgn.Height", t, 0.1, expr).abs(),
752 },
753 Some("SphereRgn") => Self::Sphere {
754 center: [
755 comp.eval_number(node, "SphereRgn.Translate.X", t, tx, expr),
756 comp.eval_number(node, "SphereRgn.Translate.Y", t, ty, expr),
757 comp.eval_number(node, "SphereRgn.Translate.Z", t, tz, expr),
758 ],
759 radius: comp.eval_number(node, "SphereRgn.Size", t, 0.5, expr).abs() * 0.5,
760 },
761 Some("CubeRgn") => Self::Cube {
762 center: [
763 comp.eval_number(node, "CubeRgn.Translate.X", t, tx, expr),
764 comp.eval_number(node, "CubeRgn.Translate.Y", t, ty, expr),
765 comp.eval_number(node, "CubeRgn.Translate.Z", t, tz, expr),
766 ],
767 width: comp.eval_number(node, "CubeRgn.Width", t, 0.1, expr).abs(),
768 height: comp.eval_number(node, "CubeRgn.Height", t, 0.1, expr).abs(),
769 depth: comp.eval_number(node, "CubeRgn.Depth", t, 0.1, expr).abs(),
770 },
771 Some("LineRgn") => {
772 let lx = comp.eval_number(node, "LineRgn.Translate.X", t, tx, expr);
773 let ly = comp.eval_number(node, "LineRgn.Translate.Y", t, ty, expr);
774 let lz = comp.eval_number(node, "LineRgn.Translate.Z", t, tz, expr);
775 Self::Line {
776 start: [
777 lx + comp.eval_number(node, "LineRgn.Start.X", t, -0.5, expr),
778 ly + comp.eval_number(node, "LineRgn.Start.Y", t, 0.0, expr),
779 lz + comp.eval_number(node, "LineRgn.Start.Z", t, 0.0, expr),
780 ],
781 end: [
782 lx + comp.eval_number(node, "LineRgn.End.X", t, 0.5, expr),
783 ly + comp.eval_number(node, "LineRgn.End.Y", t, 0.0, expr),
784 lz + comp.eval_number(node, "LineRgn.End.Z", t, 0.0, expr),
785 ],
786 }
787 }
788 Some("MeshRegion") | None => Self::Point { center: [tx, ty, tz] },
789 _ => Self::from_node(comp, node, t, expr),
790 }
791 }
792
793 /// Checks whether a particle stepping `pos -> pos + vel` collides with this bounce region.
794 /// Returns `(contact_pos, outward_unit_normal)` when a reflection should occur.
795 fn bounce_collision(&self, pos: [f64; 3], vel: [f64; 3]) -> Option<([f64; 3], [f64; 3])> {
796 let next = [pos[0] + vel[0], pos[1] + vel[1], pos[2] + vel[2]];
797 match *self {
798 Self::Line { start, end } => {
799 let sx = end[0] - start[0];
800 let sy = end[1] - start[1];
801 let len_sq = sx * sx + sy * sy;
802 let len = len_sq.sqrt();
803 if len < 1e-9 {
804 return None;
805 }
806 let mut n = [-sy / len, sx / len, 0.0];
807 let d0 = (pos[0] - start[0]) * n[0] + (pos[1] - start[1]) * n[1];
808 let d1 = (next[0] - start[0]) * n[0] + (next[1] - start[1]) * n[1];
809 let crosses = (d0 * d1 <= 0.0 && (d0.abs() > 1e-12 || d1.abs() > 1e-12))
810 || d1.abs() <= 1e-4;
811 if !crosses {
812 return None;
813 }
814 let alpha = if (d0 - d1).abs() > 1e-12 {
815 (d0 / (d0 - d1)).clamp(0.0, 1.0)
816 } else {
817 1.0
818 };
819 let hit = [
820 pos[0] + vel[0] * alpha,
821 pos[1] + vel[1] * alpha,
822 pos[2] + vel[2] * alpha,
823 ];
824 let u = ((hit[0] - start[0]) * sx + (hit[1] - start[1]) * sy) / len_sq;
825 if !(-1e-4..=1.0 + 1e-4).contains(&u) {
826 return None;
827 }
828 let vn = vel[0] * n[0] + vel[1] * n[1];
829 if vn > 0.0 {
830 n[0] = -n[0];
831 n[1] = -n[1];
832 }
833 if vel[0] * n[0] + vel[1] * n[1] >= -1e-12 {
834 return None;
835 }
836 Some(([hit[0] + n[0] * 1e-5, hit[1] + n[1] * 1e-5, hit[2]], n))
837 }
838 Self::Sphere { center, radius } => {
839 if radius < 1e-6 {
840 return None;
841 }
842 let dp = [pos[0] - center[0], pos[1] - center[1], pos[2] - center[2]];
843 let dn = [next[0] - center[0], next[1] - center[1], next[2] - center[2]];
844 let r_pos = (dp[0] * dp[0] + dp[1] * dp[1] + dp[2] * dp[2]).sqrt();
845 let r_next = (dn[0] * dn[0] + dn[1] * dn[1] + dn[2] * dn[2]).sqrt();
846 if r_pos > radius && r_next > radius {
847 return None;
848 }
849 let ref_v = if r_pos > 1e-9 {
850 dp
851 } else if r_next > 1e-9 {
852 dn
853 } else {
854 [0.0, 1.0, 0.0]
855 };
856 let r_len = (ref_v[0] * ref_v[0] + ref_v[1] * ref_v[1] + ref_v[2] * ref_v[2])
857 .sqrt()
858 .max(1e-9);
859 let mut n = [ref_v[0] / r_len, ref_v[1] / r_len, ref_v[2] / r_len];
860 if r_pos < radius && r_next >= radius {
861 n = [-n[0], -n[1], -n[2]];
862 let pushed = [
863 center[0] - n[0] * (radius - 1e-5).max(0.0),
864 center[1] - n[1] * (radius - 1e-5).max(0.0),
865 center[2] - n[2] * (radius - 1e-5).max(0.0),
866 ];
867 return Some((pushed, n));
868 }
869 let pushed = [
870 center[0] + n[0] * (radius + 1e-5),
871 center[1] + n[1] * (radius + 1e-5),
872 center[2] + n[2] * (radius + 1e-5),
873 ];
874 Some((pushed, n))
875 }
876 Self::Rect {
877 center,
878 width,
879 height,
880 } => {
881 let hx = width * 0.5;
882 let hy = height * 0.5;
883 if hy < 1e-6 {
884 let line = Self::Line {
885 start: [center[0] - hx, center[1], center[2]],
886 end: [center[0] + hx, center[1], center[2]],
887 };
888 return line.bounce_collision(pos, vel);
889 }
890 if hx < 1e-6 {
891 let line = Self::Line {
892 start: [center[0], center[1] - hy, center[2]],
893 end: [center[0], center[1] + hy, center[2]],
894 };
895 return line.bounce_collision(pos, vel);
896 }
897 bounce_aabb(pos, vel, center, [hx, hy, 1e6], false)
898 }
899 Self::Cube {
900 center,
901 width,
902 height,
903 depth,
904 } => bounce_aabb(pos, vel, center, [width * 0.5, height * 0.5, depth * 0.5], true),
905 Self::Point { center } => {
906 let cy = center[1];
907 let d0 = pos[1] - cy;
908 let d1 = next[1] - cy;
909 if d0 * d1 <= 0.0 || d1.abs() <= 1e-5 {
910 let ny = if vel[1] < 0.0 {
911 1.0
912 } else if vel[1] > 0.0 {
913 -1.0
914 } else {
915 return None;
916 };
917 let alpha = if (d0 - d1).abs() > 1e-12 {
918 (d0 / (d0 - d1)).clamp(0.0, 1.0)
919 } else {
920 1.0
921 };
922 let hit = [
923 pos[0] + vel[0] * alpha,
924 cy + ny * 1e-5,
925 pos[2] + vel[2] * alpha,
926 ];
927 return Some((hit, [0.0, ny, 0.0]));
928 }
929 None
930 }
931 Self::All => None,
932 }
933 }
934 }
935
936 /// Slab-method segment-vs-AABB bounce helper (2D when `check_z == false`, 3D when `check_z == true`).
937 fn bounce_aabb(
938 pos: [f64; 3],
939 vel: [f64; 3],
940 center: [f64; 3],
941 half: [f64; 3],
942 check_z: bool,
943 ) -> Option<([f64; 3], [f64; 3])> {
944 let axes = if check_z { 3 } else { 2 };
945 let mut inside_pos = true;
946 for a in 0..axes {
947 if (pos[a] - center[a]).abs() > half[a] {
948 inside_pos = false;
949 break;
950 }
951 }
952
953 if inside_pos {
954 let mut best_axis = 0usize;
955 let mut best_pen = f64::INFINITY;
956 let mut best_sign = 1.0f64;
957 for a in 0..axes {
958 let delta = pos[a] - center[a];
959 let pen = half[a] - delta.abs();
960 if pen < best_pen {
961 best_pen = pen;
962 best_axis = a;
963 best_sign = if delta >= 0.0 { 1.0 } else { -1.0 };
964 }
965 }
966 let mut n = [0.0; 3];
967 n[best_axis] = best_sign;
968 let mut pushed = pos;
969 pushed[best_axis] = center[best_axis] + best_sign * (half[best_axis] + 1e-5);
970 return Some((pushed, n));
971 }
972
973 let mut t_min = 0.0_f64;
974 let mut t_max = 1.0_f64;
975 let mut hit_axis = 0usize;
976 let mut hit_sign = 1.0_f64;
977
978 for a in 0..axes {
979 let min_b = center[a] - half[a];
980 let max_b = center[a] + half[a];
981 if vel[a].abs() < 1e-12 {
982 if pos[a] < min_b || pos[a] > max_b {
983 return None;
984 }
985 } else {
986 let inv = 1.0 / vel[a];
987 let mut t1 = (min_b - pos[a]) * inv;
988 let mut t2 = (max_b - pos[a]) * inv;
989 let mut s = -1.0;
990 if t1 > t2 {
991 std::mem::swap(&mut t1, &mut t2);
992 s = 1.0;
993 }
994 if t1 > t_min {
995 t_min = t1;
996 hit_axis = a;
997 hit_sign = s;
998 }
999 t_max = t_max.min(t2);
1000 if t_min > t_max {
1001 return None;
1002 }
1003 }
1004 }
1005
1006 let mut n = [0.0; 3];
1007 n[hit_axis] = hit_sign;
1008 let hit = [
1009 pos[0] + vel[0] * t_min + n[0] * 1e-5,
1010 pos[1] + vel[1] * t_min + n[1] * 1e-5,
1011 pos[2] + vel[2] * t_min + n[2] * 1e-5,
1012 ];
1013 Some((hit, n))
1014 }
1015
1016 fn apply_modifier(
1017 particles: &mut [Particle],
1018 comp: &Comp,
1019 node: &Node,
1020 scope: &HashSet<u64>,
1021 t: f64,
1022 expr: &ExprEngine,
1023 ) {
1024 match node.kind.as_str() {
1025 "pPointForce" => {
1026 let strength = comp.eval_number(node, "Strength", t, 0.1, expr);
1027 if strength.abs() < 1e-12 {
1028 return;
1029 }
1030 let power = comp.eval_number(node, "Power", t, 2.0, expr);
1031 let tx = comp.eval_number(node, "Translate.X", t, 0.0, expr);
1032 let ty = comp.eval_number(node, "Translate.Y", t, 0.0, expr);
1033 let tz = comp.eval_number(node, "Translate.Z", t, 0.0, expr);
1034
1035 for p in particles.iter_mut() {
1036 if !p.alive || !scope.contains(&p.emitter_hash) {
1037 continue;
1038 }
1039 let dx = tx - p.pos[0];
1040 let dy = ty - p.pos[1];
1041 let dz = tz - p.pos[2];
1042 let dist = (dx * dx + dy * dy + dz * dz).sqrt();
1043 if dist < 1e-7 {
1044 continue;
1045 }
1046 let falloff = dist.max(0.005).powf(power);
1047 let mag = (strength * POINT_FORCE_SCALE / falloff).clamp(-0.25, 0.25);
1048 let inv_d = 1.0 / dist;
1049 p.vel[0] += dx * inv_d * mag;
1050 p.vel[1] += dy * inv_d * mag;
1051 p.vel[2] += dz * inv_d * mag;
1052 }
1053 }
1054 "pDirectionalForce" => {
1055 let strength = comp.eval_number(node, "Strength", t, 0.1, expr);
1056 if strength.abs() < 1e-12 {
1057 return;
1058 }
1059 let dir = comp
1060 .eval_number(node, "Direction", t, -90.0, expr)
1061 .to_radians();
1062 let dir_z = comp
1063 .eval_number(node, "DirectionZ", t, 0.0, expr)
1064 .to_radians();
1065 let mag = strength * VELOCITY_SCALE * VELOCITY_SCALE;
1066 let ax = mag * dir.cos() * dir_z.cos();
1067 let ay = mag * dir.sin() * dir_z.cos();
1068 let az = mag * dir_z.sin();
1069
1070 for p in particles.iter_mut() {
1071 if !p.alive || !scope.contains(&p.emitter_hash) {
1072 continue;
1073 }
1074 p.vel[0] += ax;
1075 p.vel[1] += ay;
1076 p.vel[2] += az;
1077 }
1078 }
1079 "pDrag" | "pFriction" => {
1080 let vel_fric = if node.kind == "pFriction" || !node.inputs.contains_key("Drag") {
1081 comp.eval_number(node, "VelocityFriction", t, 0.05, expr)
1082 } else {
1083 comp.eval_number(node, "Drag", t, 0.05, expr)
1084 };
1085 let damp = (1.0 - vel_fric).clamp(0.0, 1.0);
1086 let spin_damp = if node.kind == "pFriction" || node.inputs.contains_key("SpinFriction") {
1087 (1.0 - comp.eval_number(node, "SpinFriction", t, 0.05, expr)).clamp(0.0, 1.0)
1088 } else {
1089 1.0
1090 };
1091 for p in particles.iter_mut() {
1092 if !p.alive || !scope.contains(&p.emitter_hash) {
1093 continue;
1094 }
1095 p.vel[0] *= damp;
1096 p.vel[1] *= damp;
1097 p.vel[2] *= damp;
1098 p.spin_z *= spin_damp;
1099 }
1100 }
1101 "pTurbulence" => {
1102 let sx = comp.eval_number(node, "XStrength", t, 0.1, expr);
1103 let sy = comp.eval_number(node, "YStrength", t, 0.1, expr);
1104 let sz = comp.eval_number(node, "ZStrength", t, 0.1, expr);
1105 if sx.abs() < 1e-12 && sy.abs() < 1e-12 && sz.abs() < 1e-12 {
1106 return;
1107 }
1108 let density = comp.eval_number(node, "Density", t, 10.0, expr).max(0.01);
1109 let seed = comp.eval_number(node, "RandomSeed", t, 0.0, expr).round() as u64;
1110 let time_shift = t * 0.03;
1111
1112 for p in particles.iter_mut() {
1113 if !p.alive || !scope.contains(&p.emitter_hash) {
1114 continue;
1115 }
1116 let qx = p.pos[0] * density + time_shift;
1117 let qy = p.pos[1] * density - time_shift * 0.7;
1118 let qz = p.pos[2] * density;
1119 let nx = value_noise_3d(qx, qy, qz, seed);
1120 let ny =
1121 value_noise_3d(qx + 31.7, qy + 17.3, qz + 47.1, seed ^ 0x517C_C1B7_2722_0A95);
1122 let nz =
1123 value_noise_3d(qx - 19.4, qy + 53.9, qz - 11.2, seed ^ 0x9E37_79B9_7F4A_7C15);
1124 p.vel[0] += nx * sx * TURBULENCE_SCALE;
1125 p.vel[1] += ny * sy * TURBULENCE_SCALE;
1126 p.vel[2] += nz * sz * TURBULENCE_SCALE;
1127 }
1128 }
1129 "pKill" => {
1130 let region = if node.static_str("Region").is_some() {
1131 RegionSpec::from_node(comp, node, t, expr)
1132 } else {
1133 RegionSpec::All
1134 };
1135 let kill_outside = matches!(
1136 node.static_str("RegionMode"),
1137 Some("Outside") | Some("Leaving")
1138 );
1139 for p in particles.iter_mut() {
1140 if !p.alive || !scope.contains(&p.emitter_hash) {
1141 continue;
1142 }
1143 let inside = region.contains(p.pos);
1144 if (!kill_outside && inside) || (kill_outside && !inside) {
1145 p.alive = false;
1146 }
1147 }
1148 }
1149 "pBounce" => {
1150 let region = RegionSpec::from_bounce_node(comp, node, t, expr);
1151 let elasticity = comp.eval_number(node, "Elasticity", t, 1.0, expr).clamp(0.0, 2.0);
1152 let variance = comp.eval_number(node, "Variance", t, 0.0, expr).max(0.0);
1153 let friction = comp.eval_number(node, "Friction", t, 0.0, expr).clamp(0.0, 1.0);
1154 let roughness = comp.eval_number(node, "Roughness", t, 0.0, expr).max(0.0);
1155 let spin = comp.eval_number(node, "Spin", t, 0.0, expr);
1156 let seed = comp.eval_number(node, "RandomSeed", t, 0.0, expr).round() as i64;
1157 let mut rng = SplitMix64::from_parts(seed, t.round() as i64, &node.name);
1158
1159 for p in particles.iter_mut() {
1160 if !p.alive || !scope.contains(&p.emitter_hash) {
1161 continue;
1162 }
1163 let Some((pushed_pos, n)) = region.bounce_collision(p.pos, p.vel) else {
1164 continue;
1165 };
1166 let vn = p.vel[0] * n[0] + p.vel[1] * n[1] + p.vel[2] * n[2];
1167 if vn < 0.0 {
1168 let e = (elasticity * (1.0 + rng.signed() * variance)).clamp(0.0, 2.0);
1169 let t_damp = (1.0 - friction).clamp(0.0, 1.0);
1170 let vnx = vn * n[0];
1171 let vny = vn * n[1];
1172 let vnz = vn * n[2];
1173 let vtx = p.vel[0] - vnx;
1174 let vty = p.vel[1] - vny;
1175 let vtz = p.vel[2] - vnz;
1176 p.vel[0] = vtx * t_damp - vnx * e;
1177 p.vel[1] = vty * t_damp - vny * e;
1178 p.vel[2] = vtz * t_damp - vnz * e;
1179 if roughness > 1e-6 {
1180 let scatter = roughness * 0.01 * vn.abs();
1181 p.vel[0] += rng.signed() * scatter;
1182 p.vel[1] += rng.signed() * scatter;
1183 p.vel[2] += rng.signed() * scatter;
1184 }
1185 if spin.abs() > 1e-9 {
1186 p.spin_z += spin * (1.0 + 0.5 * rng.signed());
1187 }
1188 p.pos = pushed_pos;
1189 }
1190 }
1191 }
1192 _ => {}
1193 }
1194 }
1195
1196 /// Smooth deterministic 3D value noise in `[-1.0, 1.0]`.
1197 fn value_noise_3d(x: f64, y: f64, z: f64, seed: u64) -> f64 {
1198 let xi = x.floor() as i64;
1199 let yi = y.floor() as i64;
1200 let zi = z.floor() as i64;
1201 let xf = x - xi as f64;
1202 let yf = y - yi as f64;
1203 let zf = z - zi as f64;
1204
1205 let u = xf * xf * (3.0 - 2.0 * xf);
1206 let v = yf * yf * (3.0 - 2.0 * yf);
1207 let w = zf * zf * (3.0 - 2.0 * zf);
1208
1209 let n000 = lattice_hash(xi, yi, zi, seed);
1210 let n100 = lattice_hash(xi + 1, yi, zi, seed);
1211 let n010 = lattice_hash(xi, yi + 1, zi, seed);
1212 let n110 = lattice_hash(xi + 1, yi + 1, zi, seed);
1213 let n001 = lattice_hash(xi, yi, zi + 1, seed);
1214 let n101 = lattice_hash(xi + 1, yi, zi + 1, seed);
1215 let n011 = lattice_hash(xi, yi + 1, zi + 1, seed);
1216 let n111 = lattice_hash(xi + 1, yi + 1, zi + 1, seed);
1217
1218 let nx00 = n000 + (n100 - n000) * u;
1219 let nx10 = n010 + (n110 - n010) * u;
1220 let nx01 = n001 + (n101 - n001) * u;
1221 let nx11 = n011 + (n111 - n011) * u;
1222
1223 let nxy0 = nx00 + (nx10 - nx00) * v;
1224 let nxy1 = nx01 + (nx11 - nx01) * v;
1225
1226 nxy0 + (nxy1 - nxy0) * w
1227 }
1228
1229 #[inline]
1230 fn lattice_hash(x: i64, y: i64, z: i64, seed: u64) -> f64 {
1231 let mut h = seed
1232 ^ (x as u64).wrapping_mul(0x9E37_79B9_7F4A_7C15)
1233 ^ (y as u64).wrapping_mul(0xBF58_476D_1CE4_E5B9)
1234 ^ (z as u64).wrapping_mul(0x94D0_49BB_1331_11EB);
1235 h = (h ^ (h >> 30)).wrapping_mul(0xBF58_476D_1CE4_E5B9);
1236 h = (h ^ (h >> 27)).wrapping_mul(0x94D0_49BB_1331_11EB);
1237 h ^= h >> 31;
1238 let unit = (h >> 11) as f64 * (1.0 / ((1u64 << 53) as f64));
1239 unit * 2.0 - 1.0
1240 }
1241}
1242
1243/// Optimized 2D particle rasterization (points, separable Gaussian blobs, NGons, and bitmap sprites).
1244mod raster {
1245 use std::collections::HashMap;
1246
1247 use model::{Comp, ExprEngine, Gradient, Node, NodeId};
1248
1249 use super::{
1250 BLOB_SIGMA_PER_SIZE, CAMERA_DISTANCE, Particle, ParticleStyleKind, SpriteImage,
1251 };
1252
1253 const INV_255: f32 = 1.0 / 255.0;
1254
1255 pub(super) struct DrawCmd {
1256 min_x: usize,
1257 max_x: usize,
1258 min_y: usize,
1259 max_y: usize,
1260 color: [f32; 4],
1261 shape: DrawShape,
1262 }
1263
1264 enum DrawShape {
1265 Point,
1266 Blob {
1267 cx: f64,
1268 cy: f64,
1269 inv_two_sigma_sq: f64,
1270 },
1271 NGon {
1272 cx: f64,
1273 cy: f64,
1274 inv_two_sigma_sq: f64,
1275 inv_half_period: f64,
1276 spike_period: f64,
1277 phase: f64,
1278 sharpness: f64,
1279 },
1280 Bitmap {
1281 emitter_idx: usize,
1282 cx: f64,
1283 cy: f64,
1284 draw_w: f64,
1285 draw_h: f64,
1286 rot_z_deg: f64,
1287 },
1288 }
1289
1290 struct EmitterRenderProps<'a> {
1291 emitter_hash: u64,
1292 style: ParticleStyleKind,
1293 /// Owned 1x1 tiny-background sprite, if applicable.
1294 tiny_sprite: Option<([f64; 2], SpriteImage)>,
1295 /// External sprite reference + nominal dimensions when not a tiny background.
1296 ext_sprite: Option<(&'a SpriteImage, [f64; 2])>,
1297 ngon_sides: f64,
1298 size_over_life: Option<&'a model::BezierSpline>,
1299 fade_in: f64,
1300 fade_out: f64,
1301 color_over_life: Option<Gradient>,
1302 }
1303
1304 impl<'a> EmitterRenderProps<'a> {
1305 #[inline]
1306 fn resolved_sprite(&self) -> Option<(&SpriteImage, [f64; 2])> {
1307 match &self.tiny_sprite {
1308 Some((nominal, sprite)) => Some((sprite, *nominal)),
1309 None => self.ext_sprite,
1310 }
1311 }
1312 }
1313
1314 fn collect_emitter_render_props<'a>(
1315 comp: &'a Comp,
1316 emitter_nodes: &HashMap<u64, NodeId>,
1317 time: f64,
1318 expr: &ExprEngine,
1319 sprites: &'a HashMap<NodeId, SpriteImage>,
1320 ) -> Vec<EmitterRenderProps<'a>> {
1321 let mut list = Vec::with_capacity(emitter_nodes.len());
1322 for (&emitter_hash, &emitter_id) in emitter_nodes {
1323 let Some(node) = comp.nodes.get(emitter_id.0) else {
1324 continue;
1325 };
1326 let style = match node.static_str("Style") {
1327 Some("ParticleStyleBitmap") => ParticleStyleKind::Bitmap,
1328 Some("ParticleStyleBlob") => ParticleStyleKind::Blob,
1329 Some("ParticleStyleNGon") => ParticleStyleKind::NGon,
1330 Some("ParticleStyleBrush") => ParticleStyleKind::Brush,
1331 _ => ParticleStyleKind::Point,
1332 };
1333 let size_over_life = node
1334 .inputs
1335 .get("ParticleStyle.SizeOverLife")
1336 .and_then(|b| b.source_op.as_deref())
1337 .and_then(|src| comp.splines.get(src));
1338 let fade_in = comp
1339 .eval_number(node, "ParticleStyle.FadeIn", time, 0.0, expr)
1340 .clamp(0.0, 1.0);
1341 let fade_out = comp
1342 .eval_number(node, "ParticleStyle.FadeOut", time, 1.0, expr)
1343 .clamp(0.0, 1.0);
1344 let color_over_life_on =
1345 comp.eval_number(node, "ParticleStyle.ColorOverLifeControls", time, 0.0, expr)
1346 > 0.5;
1347 let color_over_life = if color_over_life_on {
1348 comp.eval_gradient(node, "ParticleStyle.ColorOverLife", time)
1349 } else {
1350 None
1351 };
1352 let tiny_sprite = tiny_background_sprite(comp, node, time, expr);
1353 let ext_sprite = if tiny_sprite.is_none() && style == ParticleStyleKind::Bitmap {
1354 sprites
1355 .get(&emitter_id)
1356 .filter(|s| {
1357 s.size[0] > 0
1358 && s.size[1] > 0
1359 && s.rgba.len()
1360 >= (s.size[0] as usize)
1361 .saturating_mul(s.size[1] as usize)
1362 .saturating_mul(4)
1363 })
1364 .map(|s| (s, [s.size[0] as f64, s.size[1] as f64]))
1365 } else {
1366 None
1367 };
1368 list.push(EmitterRenderProps {
1369 emitter_hash,
1370 style,
1371 tiny_sprite,
1372 ext_sprite,
1373 ngon_sides: comp
1374 .eval_number(node, "ParticleStyleNGon.NGonSides", time, 5.0, expr)
1375 .round()
1376 .max(3.0),
1377 size_over_life,
1378 fade_in,
1379 fade_out,
1380 color_over_life,
1381 });
1382 }
1383 list
1384 }
1385
1386 /// Solid sprite for a `Background` tool narrower than 16 px.
1387 fn tiny_background_sprite(
1388 comp: &Comp,
1389 emitter: &Node,
1390 t: f64,
1391 expr: &ExprEngine,
1392 ) -> Option<([f64; 2], SpriteImage)> {
1393 let src = emitter
1394 .connected_node("ParticleStyleBitmap.DropToolsHere")
1395 .and_then(|name| comp.find_node(name))
1396 .map(|id| &comp.nodes[id.0])
1397 .filter(|n| n.kind == "Background")?;
1398 let w = comp.eval_number(src, "Width", t, 0.0, expr);
1399 let h = comp.eval_number(src, "Height", t, 0.0, expr);
1400 if !(w >= 1.0 && h >= 1.0 && (w < 16.0 || h < 16.0)) {
1401 return None;
1402 }
1403 let channel =
1404 |name: &str, default: f64| comp.eval_number(src, name, t, default, expr).clamp(0.0, 1.0);
1405 let a = channel("TopLeftAlpha", 1.0);
1406 let px = |c: f64| (c * a * 255.0 + 0.5) as u8;
1407 let rgba = vec![
1408 px(channel("TopLeftRed", 0.0)),
1409 px(channel("TopLeftGreen", 0.0)),
1410 px(channel("TopLeftBlue", 0.0)),
1411 (a * 255.0 + 0.5) as u8,
1412 ];
1413 Some(([w, h], SpriteImage { size: [1, 1], rgba }))
1414 }
1415
1416 /// Clamps a floating-point `[lo, hi]` interval to `[0, limit - 1]`, returning `None` if empty.
1417 #[inline]
1418 fn clip_bounds(lo: f64, hi: f64, limit: usize) -> Option<(usize, usize)> {
1419 if limit == 0 || !lo.is_finite() || !hi.is_finite() {
1420 return None;
1421 }
1422 let max_i = (limit - 1) as isize;
1423 let a = lo.floor() as isize;
1424 let b = hi.ceil() as isize;
1425 if b < 0 || a > max_i {
1426 return None;
1427 }
1428 let min_u = a.max(0) as usize;
1429 let max_u = b.min(max_i) as usize;
1430 (min_u <= max_u).then_some((min_u, max_u))
1431 }
1432
1433 #[allow(clippy::too_many_arguments)]
1434 pub(super) fn rasterize_particles(
1435 out: &mut [u8],
1436 scratch_accum: &mut Vec<f32>,
1437 scratch_cmds: &mut Vec<DrawCmd>,
1438 dims: [u32; 2],
1439 px_scale: f64,
1440 comp: &Comp,
1441 emitter_nodes: &HashMap<u64, NodeId>,
1442 particles: &[Particle],
1443 time: f64,
1444 expr: &ExprEngine,
1445 sprites: &HashMap<NodeId, SpriteImage>,
1446 ) {
1447 if particles.is_empty() {
1448 return;
1449 }
1450
1451 let w = dims[0] as usize;
1452 let h = dims[1] as usize;
1453 if w == 0 || h == 0 {
1454 return;
1455 }
1456 let w_f = w as f64;
1457 let h_f = h as f64;
1458
1459 let props_list = collect_emitter_render_props(comp, emitter_nodes, time, expr, sprites);
1460 if props_list.is_empty() {
1461 return;
1462 }
1463
1464 scratch_cmds.clear();
1465 if scratch_cmds.capacity() < particles.len() {
1466 scratch_cmds.reserve(particles.len() - scratch_cmds.capacity());
1467 }
1468
1469 let mut dirty_y0 = h;
1470 let mut dirty_y1 = 0usize;
1471 let mut last_hash = u64::MAX;
1472 let mut last_idx = usize::MAX;
1473
1474 for p in particles {
1475 if !p.alive {
1476 continue;
1477 }
1478 let props_idx = if p.emitter_hash == last_hash && last_idx < props_list.len() {
1479 last_idx
1480 } else {
1481 let Some(idx) = props_list.iter().position(|pr| pr.emitter_hash == p.emitter_hash)
1482 else {
1483 continue;
1484 };
1485 last_hash = p.emitter_hash;
1486 last_idx = idx;
1487 idx
1488 };
1489 let props = &props_list[props_idx];
1490
1491 let life_frac = (p.age / p.lifespan.max(1.0)).clamp(0.0, 1.0);
1492 let size_mult = props
1493 .size_over_life
1494 .map(|sp| (2.0 * sp.eval(life_frac)).max(0.0))
1495 .unwrap_or(1.0);
1496 let depth_scale = CAMERA_DISTANCE / (CAMERA_DISTANCE + p.pos[2]);
1497 if !(depth_scale > 0.0) {
1498 continue;
1499 }
1500 let size_world = p.size * size_mult * depth_scale;
1501 if size_world <= 1e-6 {
1502 continue;
1503 }
1504
1505 let mut fade = 1.0f64;
1506 if props.fade_in > 1e-6 && life_frac < props.fade_in {
1507 fade *= life_frac / props.fade_in;
1508 }
1509 if props.fade_out < 1.0 - 1e-6 && life_frac > props.fade_out {
1510 fade *= ((1.0 - life_frac) / (1.0 - props.fade_out)).max(0.0);
1511 }
1512
1513 let mut cr = p.color[0];
1514 let mut cg = p.color[1];
1515 let mut cb = p.color[2];
1516 let mut ca = p.color[3] * fade as f32;
1517 if let Some(grad) = &props.color_over_life {
1518 let g = grad.sample(life_frac);
1519 cr *= g[0];
1520 cg *= g[1];
1521 cb *= g[2];
1522 ca *= g[3];
1523 }
1524 ca = ca.clamp(0.0, 1.0);
1525 if ca <= 1e-4 {
1526 continue;
1527 }
1528
1529 let cx = (p.pos[0] * depth_scale + 0.5) * w_f;
1530 let cy = h_f * 0.5 - p.pos[1] * depth_scale * w_f;
1531
1532 if props.style == ParticleStyleKind::Bitmap {
1533 if let Some((_, nominal)) = props.resolved_sprite() {
1534 let draw_w = size_world * nominal[0] * px_scale;
1535 let draw_h = size_world * nominal[1] * px_scale;
1536 if draw_w < 0.5 || draw_h < 0.5 {
1537 continue;
1538 }
1539 let hw = draw_w * 0.5;
1540 let hh = draw_h * 0.5;
1541 let (rx, ry) = if p.rot_z.abs() <= 1e-6 {
1542 (hw + 1.0, hh + 1.0)
1543 } else {
1544 let theta = p.rot_z.to_radians();
1545 let ca_t = theta.cos().abs();
1546 let sa_t = theta.sin().abs();
1547 (hw * ca_t + hh * sa_t + 1.0, hw * sa_t + hh * ca_t + 1.0)
1548 };
1549 let Some((min_x, max_x)) = clip_bounds(cx - rx, cx + rx, w) else {
1550 continue;
1551 };
1552 let Some((min_y, max_y)) = clip_bounds(cy - ry, cy + ry, h) else {
1553 continue;
1554 };
1555 dirty_y0 = dirty_y0.min(min_y);
1556 dirty_y1 = dirty_y1.max(max_y + 1);
1557 scratch_cmds.push(DrawCmd {
1558 min_x,
1559 max_x,
1560 min_y,
1561 max_y,
1562 color: [cr, cg, cb, ca],
1563 shape: DrawShape::Bitmap {
1564 emitter_idx: props_idx,
1565 cx,
1566 cy,
1567 draw_w,
1568 draw_h,
1569 rot_z_deg: p.rot_z,
1570 },
1571 });
1572 continue;
1573 }
1574 }
1575
1576 match props.style {
1577 ParticleStyleKind::Point => {
1578 let ix = cx.floor() as isize;
1579 let iy = cy.floor() as isize;
1580 if ix < 0 || iy < 0 || ix >= w as isize || iy >= h as isize {
1581 continue;
1582 }
1583 let ux = ix as usize;
1584 let uy = iy as usize;
1585 dirty_y0 = dirty_y0.min(uy);
1586 dirty_y1 = dirty_y1.max(uy + 1);
1587 scratch_cmds.push(DrawCmd {
1588 min_x: ux,
1589 max_x: ux,
1590 min_y: uy,
1591 max_y: uy,
1592 color: [cr, cg, cb, ca],
1593 shape: DrawShape::Point,
1594 });
1595 }
1596 ParticleStyleKind::Blob | ParticleStyleKind::Bitmap => {
1597 let sigma = BLOB_SIGMA_PER_SIZE * size_world * px_scale;
1598 if sigma <= 1e-6 {
1599 continue;
1600 }
1601 let inv_two_sigma_sq = 0.5 / (sigma * sigma);
1602 let bound = (4.0 * sigma).min((((ca as f64) * 1.0e5).ln().max(0.0) / inv_two_sigma_sq).sqrt());
1603 let Some((min_x, max_x)) = clip_bounds(cx - bound, cx + bound, w) else {
1604 continue;
1605 };
1606 let Some((min_y, max_y)) = clip_bounds(cy - bound, cy + bound, h) else {
1607 continue;
1608 };
1609 dirty_y0 = dirty_y0.min(min_y);
1610 dirty_y1 = dirty_y1.max(max_y + 1);
1611 scratch_cmds.push(DrawCmd {
1612 min_x,
1613 max_x,
1614 min_y,
1615 max_y,
1616 color: [cr, cg, cb, ca],
1617 shape: DrawShape::Blob {
1618 cx,
1619 cy,
1620 inv_two_sigma_sq,
1621 },
1622 });
1623 }
1624 ParticleStyleKind::NGon => {
1625 let sigma = BLOB_SIGMA_PER_SIZE * size_world * px_scale;
1626 if sigma <= 1e-6 {
1627 continue;
1628 }
1629 let inv_two_sigma_sq = 0.5 / (sigma * sigma);
1630 let bound = (4.0 * sigma).min((((ca as f64) * 1.0e5).ln().max(0.0) / inv_two_sigma_sq).sqrt());
1631 let Some((min_x, max_x)) = clip_bounds(cx - bound, cx + bound, w) else {
1632 continue;
1633 };
1634 let Some((min_y, max_y)) = clip_bounds(cy - bound, cy + bound, h) else {
1635 continue;
1636 };
1637 let sides = props.ngon_sides;
1638 let spike_period = std::f64::consts::TAU / sides;
1639 let phase = std::f64::consts::FRAC_PI_2 + p.rot_z.to_radians();
1640 let sharpness = 4.5 * (3.0 / sides).powf(2.8);
1641 dirty_y0 = dirty_y0.min(min_y);
1642 dirty_y1 = dirty_y1.max(max_y + 1);
1643 scratch_cmds.push(DrawCmd {
1644 min_x,
1645 max_x,
1646 min_y,
1647 max_y,
1648 color: [cr, cg, cb, ca],
1649 shape: DrawShape::NGon {
1650 cx,
1651 cy,
1652 inv_two_sigma_sq,
1653 inv_half_period: 2.0 / spike_period,
1654 spike_period,
1655 phase,
1656 sharpness,
1657 },
1658 });
1659 }
1660 ParticleStyleKind::Brush => {}
1661 }
1662 }
1663
1664 if scratch_cmds.is_empty() || dirty_y0 >= dirty_y1 {
1665 return;
1666 }
1667
1668 let needed_floats = w * h * 4;
1669 if scratch_accum.len() < needed_floats {
1670 scratch_accum.resize(needed_floats, 0.0);
1671 }
1672
1673 rasterize_bands(
1674 out,
1675 &mut scratch_accum[..needed_floats],
1676 w,
1677 dirty_y0,
1678 dirty_y1,
1679 scratch_cmds,
1680 &props_list,
1681 );
1682 }
1683
1684 fn rasterize_bands(
1685 out: &mut [u8],
1686 accum: &mut [f32],
1687 w: usize,
1688 dirty_y0: usize,
1689 dirty_y1: usize,
1690 cmds: &[DrawCmd],
1691 props_list: &[EmitterRenderProps<'_>],
1692 ) {
1693 #[cfg(not(target_arch = "wasm32"))]
1694 {
1695 let dirty_rows = dirty_y1 - dirty_y0;
1696 let dirty_pixels = dirty_rows * w;
1697 if dirty_pixels >= 120_000 && dirty_rows >= 32 && cmds.len() >= 16 {
1698 let workers = std::thread::available_parallelism()
1699 .map(|n| n.get())
1700 .unwrap_or(1)
1701 .min(8)
1702 .min(dirty_rows / 16);
1703 if workers > 1 {
1704 let stride = w * 4;
1705 let rows_per_band = dirty_rows.div_ceil(workers);
1706 let accum_dirty = &mut accum[dirty_y0 * stride..dirty_y1 * stride];
1707 let out_dirty = &mut out[dirty_y0 * stride..dirty_y1 * stride];
1708 std::thread::scope(|scope| {
1709 let mut a_rest = accum_dirty;
1710 let mut o_rest = out_dirty;
1711 let mut band_y0 = dirty_y0;
1712 while band_y0 < dirty_y1 {
1713 let take_rows = rows_per_band.min(dirty_y1 - band_y0);
1714 let take_elems = take_rows * stride;
1715 let (a_band, a_next) = a_rest.split_at_mut(take_elems);
1716 let (o_band, o_next) = o_rest.split_at_mut(take_elems);
1717 a_rest = a_next;
1718 o_rest = o_next;
1719 let band_y1 = band_y0 + take_rows;
1720 scope.spawn(move || {
1721 rasterize_single_band(
1722 o_band,
1723 a_band,
1724 w,
1725 band_y0,
1726 band_y1,
1727 cmds,
1728 props_list,
1729 );
1730 });
1731 band_y0 = band_y1;
1732 }
1733 });
1734 return;
1735 }
1736 }
1737 }
1738
1739 let stride = w * 4;
1740 let start = dirty_y0 * stride;
1741 let end = dirty_y1 * stride;
1742 rasterize_single_band(
1743 &mut out[start..end],
1744 &mut accum[start..end],
1745 w,
1746 dirty_y0,
1747 dirty_y1,
1748 cmds,
1749 props_list,
1750 );
1751 }
1752
1753 fn rasterize_single_band(
1754 out_band: &mut [u8],
1755 accum_band: &mut [f32],
1756 w: usize,
1757 band_y0: usize,
1758 band_y1: usize,
1759 cmds: &[DrawCmd],
1760 props_list: &[EmitterRenderProps<'_>],
1761 ) {
1762 let stride = w * 4;
1763 let mut wx_heap: Vec<f32> = Vec::new();
1764 let mut wx_stack = [0.0f32; 64];
1765
1766 for cmd in cmds {
1767 if cmd.max_y < band_y0 || cmd.min_y >= band_y1 {
1768 continue;
1769 }
1770 let y_lo = cmd.min_y.max(band_y0);
1771 let y_hi = cmd.max_y.min(band_y1 - 1);
1772 let x_lo = cmd.min_x;
1773 let x_hi = cmd.max_x;
1774
1775 match cmd.shape {
1776 DrawShape::Point => {
1777 let pa = cmd.color[3];
1778 let off = (y_lo - band_y0) * stride + x_lo * 4;
1779 let dst = &mut accum_band[off..off + 4];
1780 if pa >= 1.0 - 1e-5 {
1781 dst[0] = cmd.color[0];
1782 dst[1] = cmd.color[1];
1783 dst[2] = cmd.color[2];
1784 dst[3] = 1.0;
1785 } else {
1786 let inv_a = 1.0 - pa;
1787 dst[0] = cmd.color[0] * pa + dst[0] * inv_a;
1788 dst[1] = cmd.color[1] * pa + dst[1] * inv_a;
1789 dst[2] = cmd.color[2] * pa + dst[2] * inv_a;
1790 dst[3] = pa + dst[3] * inv_a;
1791 }
1792 }
1793 DrawShape::Blob {
1794 cx,
1795 cy,
1796 inv_two_sigma_sq,
1797 } => {
1798 let span_x = x_hi - x_lo + 1;
1799 let wx: &mut [f32] = if span_x <= wx_stack.len() {
1800 &mut wx_stack[..span_x]
1801 } else {
1802 wx_heap.resize(span_x, 0.0);
1803 &mut wx_heap[..span_x]
1804 };
1805 for (i, w_slot) in wx.iter_mut().enumerate() {
1806 let dx = (x_lo + i) as f64 + 0.5 - cx;
1807 *w_slot = (-(dx * dx) * inv_two_sigma_sq).exp() as f32;
1808 }
1809
1810 let sa = cmd.color[3];
1811 let sr = cmd.color[0] * sa;
1812 let sg = cmd.color[1] * sa;
1813 let sb = cmd.color[2] * sa;
1814 let row_x_start = x_lo * 4;
1815 let row_x_end = (x_hi + 1) * 4;
1816
1817 for py in y_lo..=y_hi {
1818 let dy = py as f64 + 0.5 - cy;
1819 let wy = (-(dy * dy) * inv_two_sigma_sq).exp() as f32;
1820 let row_a = sa * wy;
1821 if row_a <= 1e-5 {
1822 continue;
1823 }
1824 let row_r = sr * wy;
1825 let row_g = sg * wy;
1826 let row_b = sb * wy;
1827 let row_off = (py - band_y0) * stride;
1828 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
1829 for (dst, &gx) in row_pixels.chunks_exact_mut(4).zip(wx.iter()) {
1830 let pa = row_a * gx;
1831 if pa <= 1e-5 {
1832 continue;
1833 }
1834 let inv_a = 1.0 - pa;
1835 dst[0] = row_r * gx + dst[0] * inv_a;
1836 dst[1] = row_g * gx + dst[1] * inv_a;
1837 dst[2] = row_b * gx + dst[2] * inv_a;
1838 dst[3] = pa + dst[3] * inv_a;
1839 }
1840 }
1841 }
1842 DrawShape::NGon {
1843 cx,
1844 cy,
1845 inv_two_sigma_sq,
1846 inv_half_period,
1847 spike_period,
1848 phase,
1849 sharpness,
1850 } => {
1851 let span_x = x_hi - x_lo + 1;
1852 let wx: &mut [f32] = if span_x <= wx_stack.len() {
1853 &mut wx_stack[..span_x]
1854 } else {
1855 wx_heap.resize(span_x, 0.0);
1856 &mut wx_heap[..span_x]
1857 };
1858 for (i, w_slot) in wx.iter_mut().enumerate() {
1859 let dx = (x_lo + i) as f64 + 0.5 - cx;
1860 *w_slot = (-(dx * dx) * inv_two_sigma_sq).exp() as f32;
1861 }
1862
1863 let sa = cmd.color[3];
1864 let cr = cmd.color[0];
1865 let cg = cmd.color[1];
1866 let cb = cmd.color[2];
1867 let row_x_start = x_lo * 4;
1868 let row_x_end = (x_hi + 1) * 4;
1869
1870 for py in y_lo..=y_hi {
1871 let dy = py as f64 + 0.5 - cy;
1872 let wy = (-(dy * dy) * inv_two_sigma_sq).exp() as f32;
1873 let row_a = sa * wy;
1874 if row_a <= 1e-5 {
1875 continue;
1876 }
1877 let row_off = (py - band_y0) * stride;
1878 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
1879 for (i, dst) in row_pixels.chunks_exact_mut(4).enumerate() {
1880 let env_a = row_a * wx[i];
1881 if env_a <= 1e-5 {
1882 continue;
1883 }
1884 let dx = (x_lo + i) as f64 + 0.5 - cx;
1885 let angle = (-dy).atan2(dx) - phase;
1886 let off = angle.rem_euclid(spike_period);
1887 let to_spike = off.min(spike_period - off);
1888 let shape_w = (1.0 - to_spike * inv_half_period).powf(sharpness) as f32;
1889 let pa = env_a * shape_w;
1890 if pa <= 1e-5 {
1891 continue;
1892 }
1893 let inv_a = 1.0 - pa;
1894 dst[0] = cr * pa + dst[0] * inv_a;
1895 dst[1] = cg * pa + dst[1] * inv_a;
1896 dst[2] = cb * pa + dst[2] * inv_a;
1897 dst[3] = pa + dst[3] * inv_a;
1898 }
1899 }
1900 }
1901 DrawShape::Bitmap {
1902 emitter_idx,
1903 cx,
1904 cy,
1905 draw_w,
1906 draw_h,
1907 rot_z_deg,
1908 } => {
1909 let Some((sprite, _)) = props_list[emitter_idx].resolved_sprite() else {
1910 continue;
1911 };
1912 draw_bitmap_band(
1913 accum_band,
1914 stride,
1915 band_y0,
1916 y_lo,
1917 y_hi,
1918 x_lo,
1919 x_hi,
1920 cx,
1921 cy,
1922 draw_w,
1923 draw_h,
1924 rot_z_deg,
1925 cmd.color,
1926 sprite,
1927 );
1928 }
1929 }
1930 }
1931
1932 // Pack premultiplied f32 -> u8 and simultaneously reset `accum_band` to 0.0
1933 // while the cache lines are hot so `scratch_accum` stays zeroed for the next frame.
1934 for (dst, src) in out_band.iter_mut().zip(accum_band.iter_mut()) {
1935 let v = *src;
1936 *src = 0.0;
1937 *dst = (v.clamp(0.0, 1.0) * 255.0 + 0.5) as u8;
1938 }
1939 }
1940
1941 #[allow(clippy::too_many_arguments)]
1942 #[inline]
1943 fn draw_bitmap_band(
1944 accum_band: &mut [f32],
1945 stride: usize,
1946 band_y0: usize,
1947 y_lo: usize,
1948 y_hi: usize,
1949 x_lo: usize,
1950 x_hi: usize,
1951 cx: f64,
1952 cy: f64,
1953 draw_w: f64,
1954 draw_h: f64,
1955 rot_z_deg: f64,
1956 tint: [f32; 4],
1957 sprite: &SpriteImage,
1958 ) {
1959 let inv_dw = 1.0 / draw_w;
1960 let inv_dh = 1.0 / draw_h;
1961 let edge_u = inv_dw * 0.5;
1962 let edge_v = inv_dh * 0.5;
1963 let inv_2edge_u = 1.0 / (2.0 * edge_u);
1964 let inv_2edge_v = 1.0 / (2.0 * edge_v);
1965 let sw_i = sprite.size[0] as usize;
1966 let sh_i = sprite.size[1] as usize;
1967 let row_x_start = x_lo * 4;
1968 let row_x_end = (x_hi + 1) * 4;
1969
1970 // Fast path: axis-aligned (unrotated) sprite.
1971 if rot_z_deg.abs() <= 1e-6 {
1972 let u0 = (x_lo as f64 + 0.5 - cx) * inv_dw + 0.5;
1973 if sw_i == 1 && sh_i == 1 {
1974 let s0 = sprite.rgba[0] as f32 * INV_255 * tint[0] * tint[3];
1975 let s1 = sprite.rgba[1] as f32 * INV_255 * tint[1] * tint[3];
1976 let s2 = sprite.rgba[2] as f32 * INV_255 * tint[2] * tint[3];
1977 let s3 = sprite.rgba[3] as f32 * INV_255 * tint[3];
1978 if s3 <= 1e-5 {
1979 return;
1980 }
1981 for py in y_lo..=y_hi {
1982 let v = (py as f64 + 0.5 - cy) * inv_dh + 0.5;
1983 if v <= -edge_v || v >= 1.0 + edge_v {
1984 continue;
1985 }
1986 let cov_v = ((v + edge_v) * inv_2edge_v)
1987 .min((1.0 + edge_v - v) * inv_2edge_v)
1988 .clamp(0.0, 1.0);
1989 if cov_v <= 1e-4 {
1990 continue;
1991 }
1992 let cov_vf = cov_v as f32;
1993 let row_off = (py - band_y0) * stride;
1994 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
1995 let mut u = u0;
1996 for dst in row_pixels.chunks_exact_mut(4) {
1997 if u > -edge_u && u < 1.0 + edge_u {
1998 let cov_u = ((u + edge_u) * inv_2edge_u)
1999 .min((1.0 + edge_u - u) * inv_2edge_u)
2000 .clamp(0.0, 1.0);
2001 let cov = cov_u as f32 * cov_vf;
2002 if cov > 1e-4 {
2003 let pa = s3 * cov;
2004 if pa > 1e-5 {
2005 let inv_a = 1.0 - pa;
2006 dst[0] = s0 * cov + dst[0] * inv_a;
2007 dst[1] = s1 * cov + dst[1] * inv_a;
2008 dst[2] = s2 * cov + dst[2] * inv_a;
2009 dst[3] = pa + dst[3] * inv_a;
2010 }
2011 }
2012 }
2013 u += inv_dw;
2014 }
2015 }
2016 return;
2017 }
2018
2019 let sw_f = sw_i as f64;
2020 let sh_f = sh_i as f64;
2021 let sw_max = (sw_i - 1) as f64;
2022 let sh_max = (sh_i - 1) as f64;
2023 let tr = tint[0] * INV_255;
2024 let tg = tint[1] * INV_255;
2025 let tb = tint[2] * INV_255;
2026 let ta = tint[3] * INV_255;
2027
2028 for py in y_lo..=y_hi {
2029 let v = (py as f64 + 0.5 - cy) * inv_dh + 0.5;
2030 if v <= -edge_v || v >= 1.0 + edge_v {
2031 continue;
2032 }
2033 let cov_v = ((v + edge_v) * inv_2edge_v)
2034 .min((1.0 + edge_v - v) * inv_2edge_v)
2035 .clamp(0.0, 1.0);
2036 if cov_v <= 1e-4 {
2037 continue;
2038 }
2039 let fy = (v.clamp(0.0, 1.0) * sh_f - 0.5).clamp(0.0, sh_max);
2040 let y0 = fy.floor() as usize;
2041 let y1 = (y0 + 1).min(sh_i - 1);
2042 let ty = (fy - y0 as f64) as f32;
2043 let one_minus_ty = 1.0 - ty;
2044 let row0 = y0 * sw_i;
2045 let row1 = y1 * sw_i;
2046 let cov_vf = cov_v as f32;
2047
2048 let row_off = (py - band_y0) * stride;
2049 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
2050 let mut u = u0;
2051 for dst in row_pixels.chunks_exact_mut(4) {
2052 if u > -edge_u && u < 1.0 + edge_u {
2053 let cov_u = ((u + edge_u) * inv_2edge_u)
2054 .min((1.0 + edge_u - u) * inv_2edge_u)
2055 .clamp(0.0, 1.0);
2056 let cov = cov_u as f32 * cov_vf;
2057 if cov > 1e-4 {
2058 let fx = (u.clamp(0.0, 1.0) * sw_f - 0.5).clamp(0.0, sw_max);
2059 let x0 = fx.floor() as usize;
2060 let x1 = (x0 + 1).min(sw_i - 1);
2061 let tx = (fx - x0 as f64) as f32;
2062 let omt = 1.0 - tx;
2063
2064 let w00 = omt * one_minus_ty;
2065 let w10 = tx * one_minus_ty;
2066 let w01 = omt * ty;
2067 let w11 = tx * ty;
2068
2069 let i00 = (row0 + x0) * 4;
2070 let i10 = (row0 + x1) * 4;
2071 let i01 = (row1 + x0) * 4;
2072 let i11 = (row1 + x1) * 4;
2073
2074 let s_a = sprite.rgba[i00 + 3] as f32 * w00
2075 + sprite.rgba[i10 + 3] as f32 * w10
2076 + sprite.rgba[i01 + 3] as f32 * w01
2077 + sprite.rgba[i11 + 3] as f32 * w11;
2078 let pa = s_a * ta * cov;
2079 if pa > 1e-5 {
2080 let s_r = sprite.rgba[i00] as f32 * w00
2081 + sprite.rgba[i10] as f32 * w10
2082 + sprite.rgba[i01] as f32 * w01
2083 + sprite.rgba[i11] as f32 * w11;
2084 let s_g = sprite.rgba[i00 + 1] as f32 * w00
2085 + sprite.rgba[i10 + 1] as f32 * w10
2086 + sprite.rgba[i01 + 1] as f32 * w01
2087 + sprite.rgba[i11 + 1] as f32 * w11;
2088 let s_b = sprite.rgba[i00 + 2] as f32 * w00
2089 + sprite.rgba[i10 + 2] as f32 * w10
2090 + sprite.rgba[i01 + 2] as f32 * w01
2091 + sprite.rgba[i11 + 2] as f32 * w11;
2092 let inv_a = 1.0 - pa;
2093 dst[0] = s_r * (tr * cov * tint[3]) + dst[0] * inv_a;
2094 dst[1] = s_g * (tg * cov * tint[3]) + dst[1] * inv_a;
2095 dst[2] = s_b * (tb * cov * tint[3]) + dst[2] * inv_a;
2096 dst[3] = pa + dst[3] * inv_a;
2097 }
2098 }
2099 }
2100 u += inv_dw;
2101 }
2102 }
2103 return;
2104 }
2105
2106 // General rotated bitmap path with incremental scanline UV stepping.
2107 let theta = rot_z_deg.to_radians();
2108 let cos_t = theta.cos();
2109 let sin_t = theta.sin();
2110 let du_dx = cos_t * inv_dw;
2111 let dv_dx = sin_t * inv_dh;
2112 let dx0 = (x_lo as f64 + 0.5) - cx;
2113 let sw_f = sw_i as f64;
2114 let sh_f = sh_i as f64;
2115 let sw_max = (sw_i - 1) as f64;
2116 let sh_max = (sh_i - 1) as f64;
2117 let tr = tint[0] * tint[3] * INV_255;
2118 let tg = tint[1] * tint[3] * INV_255;
2119 let tb = tint[2] * tint[3] * INV_255;
2120 let ta = tint[3] * INV_255;
2121
2122 for py in y_lo..=y_hi {
2123 let dy = (py as f64 + 0.5) - cy;
2124 let mut u = (dx0 * cos_t - dy * sin_t) * inv_dw + 0.5;
2125 let mut v = (dx0 * sin_t + dy * cos_t) * inv_dh + 0.5;
2126 let row_off = (py - band_y0) * stride;
2127 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
2128
2129 for dst in row_pixels.chunks_exact_mut(4) {
2130 if u > -edge_u && u < 1.0 + edge_u && v > -edge_v && v < 1.0 + edge_v {
2131 let cov_u = ((u + edge_u) * inv_2edge_u)
2132 .min((1.0 + edge_u - u) * inv_2edge_u)
2133 .clamp(0.0, 1.0);
2134 let cov_v = ((v + edge_v) * inv_2edge_v)
2135 .min((1.0 + edge_v - v) * inv_2edge_v)
2136 .clamp(0.0, 1.0);
2137 let cov = (cov_u * cov_v) as f32;
2138 if cov > 1e-4 {
2139 let fx = (u.clamp(0.0, 1.0) * sw_f - 0.5).clamp(0.0, sw_max);
2140 let fy = (v.clamp(0.0, 1.0) * sh_f - 0.5).clamp(0.0, sh_max);
2141 let x0 = fx.floor() as usize;
2142 let y0 = fy.floor() as usize;
2143 let x1 = (x0 + 1).min(sw_i - 1);
2144 let y1 = (y0 + 1).min(sh_i - 1);
2145 let tx = (fx - x0 as f64) as f32;
2146 let ty = (fy - y0 as f64) as f32;
2147
2148 let w00 = (1.0 - tx) * (1.0 - ty);
2149 let w10 = tx * (1.0 - ty);
2150 let w01 = (1.0 - tx) * ty;
2151 let w11 = tx * ty;
2152
2153 let i00 = (y0 * sw_i + x0) * 4;
2154 let i10 = (y0 * sw_i + x1) * 4;
2155 let i01 = (y1 * sw_i + x0) * 4;
2156 let i11 = (y1 * sw_i + x1) * 4;
2157
2158 let s_a = sprite.rgba[i00 + 3] as f32 * w00
2159 + sprite.rgba[i10 + 3] as f32 * w10
2160 + sprite.rgba[i01 + 3] as f32 * w01
2161 + sprite.rgba[i11 + 3] as f32 * w11;
2162 let pa = s_a * ta * cov;
2163 if pa > 1e-5 {
2164 let s_r = sprite.rgba[i00] as f32 * w00
2165 + sprite.rgba[i10] as f32 * w10
2166 + sprite.rgba[i01] as f32 * w01
2167 + sprite.rgba[i11] as f32 * w11;
2168 let s_g = sprite.rgba[i00 + 1] as f32 * w00
2169 + sprite.rgba[i10 + 1] as f32 * w10
2170 + sprite.rgba[i01 + 1] as f32 * w01
2171 + sprite.rgba[i11 + 1] as f32 * w11;
2172 let s_b = sprite.rgba[i00 + 2] as f32 * w00
2173 + sprite.rgba[i10 + 2] as f32 * w10
2174 + sprite.rgba[i01 + 2] as f32 * w01
2175 + sprite.rgba[i11 + 2] as f32 * w11;
2176 let inv_a = 1.0 - pa;
2177 dst[0] = s_r * (tr * cov) + dst[0] * inv_a;
2178 dst[1] = s_g * (tg * cov) + dst[1] * inv_a;
2179 dst[2] = s_b * (tb * cov) + dst[2] * inv_a;
2180 dst[3] = pa + dst[3] * inv_a;
2181 }
2182 }
2183 }
2184 u += du_dx;
2185 v += dv_dx;
2186 }
2187 }
2188 }
2189}
2190
2191#[cfg(test)]314#[cfg(test)]
2192mod w26c_tests {315mod w26c_tests {
2193 use super::*;316 use super::*;
crates/engine/src/particles/raster.rs+736-222
...@@ -1,5 +1,3 @@...@@ -1,5 +1,3 @@
1//! 2D particle rasterization (points, blobs, NGons, and bilinear bitmap sprites).
2
3use std::collections::HashMap;1use std::collections::HashMap;
42
5use model::{Comp, ExprEngine, Gradient, Node, NodeId};3use model::{Comp, ExprEngine, Gradient, Node, NodeId};
...@@ -8,10 +6,50 @@ use super::{...@@ -8,10 +6,50 @@ use super::{
8 BLOB_SIGMA_PER_SIZE, CAMERA_DISTANCE, Particle, ParticleStyleKind, SpriteImage,6 BLOB_SIGMA_PER_SIZE, CAMERA_DISTANCE, Particle, ParticleStyleKind, SpriteImage,
9};7};
108
9const INV_255: f32 = 1.0 / 255.0;
10
11pub(super) struct DrawCmd {
12 min_x: usize,
13 max_x: usize,
14 min_y: usize,
15 max_y: usize,
16 color: [f32; 4],
17 shape: DrawShape,
18}
19
20enum DrawShape {
21 Point,
22 Blob {
23 cx: f64,
24 cy: f64,
25 inv_two_sigma_sq: f64,
26 },
27 NGon {
28 cx: f64,
29 cy: f64,
30 inv_two_sigma_sq: f64,
31 inv_half_period: f64,
32 spike_period: f64,
33 phase: f64,
34 sharpness: f64,
35 },
36 Bitmap {
37 emitter_idx: usize,
38 cx: f64,
39 cy: f64,
40 draw_w: f64,
41 draw_h: f64,
42 rot_z_deg: f64,
43 },
44}
45
11struct EmitterRenderProps<'a> {46struct EmitterRenderProps<'a> {
12 emitter_id: NodeId,47 emitter_hash: u64,
13 style: ParticleStyleKind,48 style: ParticleStyleKind,
49 /// Owned 1x1 tiny-background sprite, if applicable.
14 tiny_sprite: Option<([f64; 2], SpriteImage)>,50 tiny_sprite: Option<([f64; 2], SpriteImage)>,
51 /// External sprite reference + nominal dimensions when not a tiny background.
52 ext_sprite: Option<(&'a SpriteImage, [f64; 2])>,
15 ngon_sides: f64,53 ngon_sides: f64,
16 size_over_life: Option<&'a model::BezierSpline>,54 size_over_life: Option<&'a model::BezierSpline>,
17 fade_in: f64,55 fade_in: f64,
...@@ -19,21 +57,25 @@ struct EmitterRenderProps<'a> {...@@ -19,21 +57,25 @@ struct EmitterRenderProps<'a> {
19 color_over_life: Option<Gradient>,57 color_over_life: Option<Gradient>,
20}58}
2159
60impl<'a> EmitterRenderProps<'a> {
61 #[inline]
62 fn resolved_sprite(&self) -> Option<(&SpriteImage, [f64; 2])> {
63 match &self.tiny_sprite {
64 Some((nominal, sprite)) => Some((sprite, *nominal)),
65 None => self.ext_sprite,
66 }
67 }
68}
69
22fn collect_emitter_render_props<'a>(70fn collect_emitter_render_props<'a>(
23 comp: &'a Comp,71 comp: &'a Comp,
24 emitter_nodes: &HashMap<u64, NodeId>,72 emitter_nodes: &HashMap<u64, NodeId>,
25 particles: &[Particle],
26 time: f64,73 time: f64,
27 expr: &ExprEngine,74 expr: &ExprEngine,
28) -> HashMap<u64, EmitterRenderProps<'a>> {75 sprites: &'a HashMap<NodeId, SpriteImage>,
29 let mut map = HashMap::new();76) -> Vec<EmitterRenderProps<'a>> {
30 for p in particles {77 let mut list = Vec::with_capacity(emitter_nodes.len());
31 if map.contains_key(&p.emitter_hash) {78 for (&emitter_hash, &emitter_id) in emitter_nodes {
32 continue;
33 }
34 let Some(&emitter_id) = emitter_nodes.get(&p.emitter_hash) else {
35 continue;
36 };
37 let Some(node) = comp.nodes.get(emitter_id.0) else {79 let Some(node) = comp.nodes.get(emitter_id.0) else {
38 continue;80 continue;
39 };81 };
...@@ -56,33 +98,48 @@ fn collect_emitter_render_props<'a>(...@@ -56,33 +98,48 @@ fn collect_emitter_render_props<'a>(
56 .eval_number(node, "ParticleStyle.FadeOut", time, 1.0, expr)98 .eval_number(node, "ParticleStyle.FadeOut", time, 1.0, expr)
57 .clamp(0.0, 1.0);99 .clamp(0.0, 1.0);
58 let color_over_life_on =100 let color_over_life_on =
59 comp.eval_number(node, "ParticleStyle.ColorOverLifeControls", time, 0.0, expr) > 0.5;101 comp.eval_number(node, "ParticleStyle.ColorOverLifeControls", time, 0.0, expr)
102 > 0.5;
60 let color_over_life = if color_over_life_on {103 let color_over_life = if color_over_life_on {
61 comp.eval_gradient(node, "ParticleStyle.ColorOverLife", time)104 comp.eval_gradient(node, "ParticleStyle.ColorOverLife", time)
62 } else {105 } else {
63 None106 None
64 };107 };
65 map.insert(108 let tiny_sprite = tiny_background_sprite(comp, node, time, expr);
66 p.emitter_hash,109 let ext_sprite = if tiny_sprite.is_none() && style == ParticleStyleKind::Bitmap {
67 EmitterRenderProps {110 sprites
68 emitter_id,111 .get(&emitter_id)
69 style,112 .filter(|s| {
70 tiny_sprite: tiny_background_sprite(comp, node, time, expr),113 s.size[0] > 0
71 ngon_sides: comp.eval_number(node, "ParticleStyleNGon.NGonSides", time, 5.0, expr).round().max(3.0),114 && s.size[1] > 0
72 size_over_life,115 && s.rgba.len()
73 fade_in,116 >= (s.size[0] as usize)
74 fade_out,117 .saturating_mul(s.size[1] as usize)
75 color_over_life,118 .saturating_mul(4)
76 },119 })
77 );120 .map(|s| (s, [s.size[0] as f64, s.size[1] as f64]))
121 } else {
122 None
123 };
124 list.push(EmitterRenderProps {
125 emitter_hash,
126 style,
127 tiny_sprite,
128 ext_sprite,
129 ngon_sides: comp
130 .eval_number(node, "ParticleStyleNGon.NGonSides", time, 5.0, expr)
131 .round()
132 .max(3.0),
133 size_over_life,
134 fade_in,
135 fade_out,
136 color_over_life,
137 });
78 }138 }
79 map139 list
80}140}
81141
82/// Solid sprite for a `Background` tool narrower than 16 px.142/// Solid sprite for a `Background` tool narrower than 16 px.
83///
84/// The engine evaluates such tools at comp size, so the particle uses the tool's nominal
85/// `Width`/`Height` and its flat color directly.
86fn tiny_background_sprite(143fn tiny_background_sprite(
87 comp: &Comp,144 comp: &Comp,
88 emitter: &Node,145 emitter: &Node,
...@@ -99,7 +156,8 @@ fn tiny_background_sprite(...@@ -99,7 +156,8 @@ fn tiny_background_sprite(
99 if !(w >= 1.0 && h >= 1.0 && (w < 16.0 || h < 16.0)) {156 if !(w >= 1.0 && h >= 1.0 && (w < 16.0 || h < 16.0)) {
100 return None;157 return None;
101 }158 }
102 let channel = |name: &str, default: f64| comp.eval_number(src, name, t, default, expr).clamp(0.0, 1.0);159 let channel =
160 |name: &str, default: f64| comp.eval_number(src, name, t, default, expr).clamp(0.0, 1.0);
103 let a = channel("TopLeftAlpha", 1.0);161 let a = channel("TopLeftAlpha", 1.0);
104 let px = |c: f64| (c * a * 255.0 + 0.5) as u8;162 let px = |c: f64| (c * a * 255.0 + 0.5) as u8;
105 let rgba = vec![163 let rgba = vec![
...@@ -111,9 +169,28 @@ fn tiny_background_sprite(...@@ -111,9 +169,28 @@ fn tiny_background_sprite(
111 Some(([w, h], SpriteImage { size: [1, 1], rgba }))169 Some(([w, h], SpriteImage { size: [1, 1], rgba }))
112}170}
113171
172/// Clamps a floating-point `[lo, hi]` interval to `[0, limit - 1]`, returning `None` if empty.
173#[inline]
174fn clip_bounds(lo: f64, hi: f64, limit: usize) -> Option<(usize, usize)> {
175 if limit == 0 || !lo.is_finite() || !hi.is_finite() {
176 return None;
177 }
178 let max_i = (limit - 1) as isize;
179 let a = lo.floor() as isize;
180 let b = hi.ceil() as isize;
181 if b < 0 || a > max_i {
182 return None;
183 }
184 let min_u = a.max(0) as usize;
185 let max_u = b.min(max_i) as usize;
186 (min_u <= max_u).then_some((min_u, max_u))
187}
188
114#[allow(clippy::too_many_arguments)]189#[allow(clippy::too_many_arguments)]
115pub(super) fn rasterize_particles(190pub(super) fn rasterize_particles(
116 out: &mut [u8],191 out: &mut [u8],
192 scratch_accum: &mut Vec<f32>,
193 scratch_cmds: &mut Vec<DrawCmd>,
117 dims: [u32; 2],194 dims: [u32; 2],
118 px_scale: f64,195 px_scale: f64,
119 comp: &Comp,196 comp: &Comp,
...@@ -127,25 +204,47 @@ pub(super) fn rasterize_particles(...@@ -127,25 +204,47 @@ pub(super) fn rasterize_particles(
127 return;204 return;
128 }205 }
129206
130 let props_map = collect_emitter_render_props(comp, emitter_nodes, particles, time, expr);
131 let w = dims[0] as usize;207 let w = dims[0] as usize;
132 let h = dims[1] as usize;208 let h = dims[1] as usize;
209 if w == 0 || h == 0 {
210 return;
211 }
133 let w_f = w as f64;212 let w_f = w as f64;
134 let h_f = h as f64;213 let h_f = h as f64;
135214
136 // Accumulate in linear-ish float premultiplied RGBA for clean blending, then pack to u8.215 let props_list = collect_emitter_render_props(comp, emitter_nodes, time, expr, sprites);
137 let mut accum = vec![0.0f32; w * h * 4];216 if props_list.is_empty() {
217 return;
218 }
219
220 scratch_cmds.clear();
221 if scratch_cmds.capacity() < particles.len() {
222 scratch_cmds.reserve(particles.len() - scratch_cmds.capacity());
223 }
224
225 let mut dirty_y0 = h;
226 let mut dirty_y1 = 0usize;
227 let mut last_hash = u64::MAX;
228 let mut last_idx = usize::MAX;
138229
139 for p in particles {230 for p in particles {
140 if !p.alive {231 if !p.alive {
141 continue;232 continue;
142 }233 }
143 let Some(props) = props_map.get(&p.emitter_hash) else {234 let props_idx = if p.emitter_hash == last_hash && last_idx < props_list.len() {
144 continue;235 last_idx
236 } else {
237 let Some(idx) = props_list.iter().position(|pr| pr.emitter_hash == p.emitter_hash)
238 else {
239 continue;
240 };
241 last_hash = p.emitter_hash;
242 last_idx = idx;
243 idx
145 };244 };
245 let props = &props_list[props_idx];
146246
147 let life_frac = (p.age / p.lifespan.max(1.0)).clamp(0.0, 1.0);247 let life_frac = (p.age / p.lifespan.max(1.0)).clamp(0.0, 1.0);
148 // Fusion's SizeOverLife LUT maps 0.5 -> 1.0x (0.0 -> 0x, 1.0 -> 2x).
149 let size_mult = props248 let size_mult = props
150 .size_over_life249 .size_over_life
151 .map(|sp| (2.0 * sp.eval(life_frac)).max(0.0))250 .map(|sp| (2.0 * sp.eval(life_frac)).max(0.0))
...@@ -183,76 +282,428 @@ pub(super) fn rasterize_particles(...@@ -183,76 +282,428 @@ pub(super) fn rasterize_particles(
183 continue;282 continue;
184 }283 }
185284
186 // Fusion 2D particle coordinates: X in [-0.5, +0.5], Y-up with same unit scale as X.
187 let cx = (p.pos[0] * depth_scale + 0.5) * w_f;285 let cx = (p.pos[0] * depth_scale + 0.5) * w_f;
188 let cy = h_f * 0.5 - p.pos[1] * depth_scale * w_f;286 let cy = h_f * 0.5 - p.pos[1] * depth_scale * w_f;
189287
190 if props.style == ParticleStyleKind::Bitmap {288 if props.style == ParticleStyleKind::Bitmap {
191 let (sprite, nominal) = match &props.tiny_sprite {289 if let Some((_, nominal)) = props.resolved_sprite() {
192 Some((nominal, sprite)) => (Some(sprite), *nominal),290 let draw_w = size_world * nominal[0] * px_scale;
193 None => {291 let draw_h = size_world * nominal[1] * px_scale;
194 let sprite = sprites.get(&props.emitter_id);292 if draw_w < 0.5 || draw_h < 0.5 {
195 (sprite, sprite.map_or([0.0; 2], |s| [s.size[0] as f64, s.size[1] as f64]))293 continue;
196 }294 }
197 };295 let hw = draw_w * 0.5;
198 if let Some(sprite) = sprite.filter(|s| {296 let hh = draw_h * 0.5;
199 s.size[0] > 0297 let (rx, ry) = if p.rot_z.abs() <= 1e-6 {
200 && s.size[1] > 0298 (hw + 1.0, hh + 1.0)
201 && s.rgba.len() >= (s.size[0] as usize).saturating_mul(s.size[1] as usize).saturating_mul(4)299 } else {
202 }) {300 let theta = p.rot_z.to_radians();
203 draw_bitmap_particle(301 let ca_t = theta.cos().abs();
204 &mut accum,302 let sa_t = theta.sin().abs();
205 w,303 (hw * ca_t + hh * sa_t + 1.0, hw * sa_t + hh * ca_t + 1.0)
206 h,304 };
207 cx,305 let Some((min_x, max_x)) = clip_bounds(cx - rx, cx + rx, w) else {
208 cy,306 continue;
209 size_world * nominal[0] * px_scale,307 };
210 size_world * nominal[1] * px_scale,308 let Some((min_y, max_y)) = clip_bounds(cy - ry, cy + ry, h) else {
211 p.rot_z,309 continue;
212 [cr, cg, cb, ca],310 };
213 sprite,311 dirty_y0 = dirty_y0.min(min_y);
214 );312 dirty_y1 = dirty_y1.max(max_y + 1);
313 scratch_cmds.push(DrawCmd {
314 min_x,
315 max_x,
316 min_y,
317 max_y,
318 color: [cr, cg, cb, ca],
319 shape: DrawShape::Bitmap {
320 emitter_idx: props_idx,
321 cx,
322 cy,
323 draw_w,
324 draw_h,
325 rot_z_deg: p.rot_z,
326 },
327 });
215 continue;328 continue;
216 }329 }
217 }330 }
218331
219 match props.style {332 match props.style {
220 ParticleStyleKind::Point => {333 ParticleStyleKind::Point => {
221 blend_pixel(&mut accum, w, h, cx.floor(), cy.floor(), [cr, cg, cb, ca]);334 let ix = cx.floor() as isize;
335 let iy = cy.floor() as isize;
336 if ix < 0 || iy < 0 || ix >= w as isize || iy >= h as isize {
337 continue;
338 }
339 let ux = ix as usize;
340 let uy = iy as usize;
341 dirty_y0 = dirty_y0.min(uy);
342 dirty_y1 = dirty_y1.max(uy + 1);
343 scratch_cmds.push(DrawCmd {
344 min_x: ux,
345 max_x: ux,
346 min_y: uy,
347 max_y: uy,
348 color: [cr, cg, cb, ca],
349 shape: DrawShape::Point,
350 });
222 }351 }
223 ParticleStyleKind::Blob | ParticleStyleKind::Bitmap => {352 ParticleStyleKind::Blob | ParticleStyleKind::Bitmap => {
224 let sigma = BLOB_SIGMA_PER_SIZE * size_world * px_scale;353 let sigma = BLOB_SIGMA_PER_SIZE * size_world * px_scale;
225 draw_soft_particle(&mut accum, w, h, cx, cy, sigma, [cr, cg, cb, ca], |_, _| 1.0);354 if sigma <= 1e-6 {
355 continue;
356 }
357 let inv_two_sigma_sq = 0.5 / (sigma * sigma);
358 let bound = (4.0 * sigma).min((((ca as f64) * 1.0e5).ln().max(0.0) / inv_two_sigma_sq).sqrt());
359 let Some((min_x, max_x)) = clip_bounds(cx - bound, cx + bound, w) else {
360 continue;
361 };
362 let Some((min_y, max_y)) = clip_bounds(cy - bound, cy + bound, h) else {
363 continue;
364 };
365 dirty_y0 = dirty_y0.min(min_y);
366 dirty_y1 = dirty_y1.max(max_y + 1);
367 scratch_cmds.push(DrawCmd {
368 min_x,
369 max_x,
370 min_y,
371 max_y,
372 color: [cr, cg, cb, ca],
373 shape: DrawShape::Blob {
374 cx,
375 cy,
376 inv_two_sigma_sq,
377 },
378 });
226 }379 }
227 ParticleStyleKind::NGon => {380 ParticleStyleKind::NGon => {
228 let sigma = BLOB_SIGMA_PER_SIZE * size_world * px_scale;381 let sigma = BLOB_SIGMA_PER_SIZE * size_world * px_scale;
382 if sigma <= 1e-6 {
383 continue;
384 }
385 let inv_two_sigma_sq = 0.5 / (sigma * sigma);
386 let bound = (4.0 * sigma).min((((ca as f64) * 1.0e5).ln().max(0.0) / inv_two_sigma_sq).sqrt());
387 let Some((min_x, max_x)) = clip_bounds(cx - bound, cx + bound, w) else {
388 continue;
389 };
390 let Some((min_y, max_y)) = clip_bounds(cy - bound, cy + bound, h) else {
391 continue;
392 };
229 let sides = props.ngon_sides;393 let sides = props.ngon_sides;
230 let spike_period = std::f64::consts::TAU / sides;394 let spike_period = std::f64::consts::TAU / sides;
231 let phase = std::f64::consts::FRAC_PI_2 + p.rot_z.to_radians();395 let phase = std::f64::consts::FRAC_PI_2 + p.rot_z.to_radians();
232 // Spike sharpness fitted to Fusion 21.1: alpha mass is 0.18/0.48/0.78 of a blob for 3/5/8 sides.
233 let sharpness = 4.5 * (3.0 / sides).powf(2.8);396 let sharpness = 4.5 * (3.0 / sides).powf(2.8);
234 draw_soft_particle(&mut accum, w, h, cx, cy, sigma, [cr, cg, cb, ca], |dx, dy| {397 dirty_y0 = dirty_y0.min(min_y);
235 // Distance to the nearest spike, as a fraction of half the spike period.398 dirty_y1 = dirty_y1.max(max_y + 1);
236 let angle = (-dy).atan2(dx) - phase;399 scratch_cmds.push(DrawCmd {
237 let off = angle.rem_euclid(spike_period);400 min_x,
238 let to_spike = off.min(spike_period - off);401 max_x,
239 (1.0 - to_spike / (0.5 * spike_period)).powf(sharpness)402 min_y,
403 max_y,
404 color: [cr, cg, cb, ca],
405 shape: DrawShape::NGon {
406 cx,
407 cy,
408 inv_two_sigma_sq,
409 inv_half_period: 2.0 / spike_period,
410 spike_period,
411 phase,
412 sharpness,
413 },
240 });414 });
241 }415 }
242 ParticleStyleKind::Brush => {}416 ParticleStyleKind::Brush => {}
243 }417 }
244 }418 }
245419
246 for (dst, &src) in out.iter_mut().zip(accum.iter()) {420 if scratch_cmds.is_empty() || dirty_y0 >= dirty_y1 {
247 *dst = (src.clamp(0.0, 1.0) * 255.0 + 0.5) as u8;421 return;
422 }
423
424 let needed_floats = w * h * 4;
425 if scratch_accum.len() < needed_floats {
426 scratch_accum.resize(needed_floats, 0.0);
248 }427 }
428
429 rasterize_bands(
430 out,
431 &mut scratch_accum[..needed_floats],
432 w,
433 dirty_y0,
434 dirty_y1,
435 scratch_cmds,
436 &props_list,
437 );
249}438}
250439
251#[allow(clippy::too_many_arguments)]440fn rasterize_bands(
252fn draw_bitmap_particle(441 out: &mut [u8],
253 accum: &mut [f32],442 accum: &mut [f32],
254 w: usize,443 w: usize,
255 h: usize,444 dirty_y0: usize,
445 dirty_y1: usize,
446 cmds: &[DrawCmd],
447 props_list: &[EmitterRenderProps<'_>],
448) {
449 #[cfg(not(target_arch = "wasm32"))]
450 {
451 let dirty_rows = dirty_y1 - dirty_y0;
452 let dirty_pixels = dirty_rows * w;
453 if dirty_pixels >= 120_000 && dirty_rows >= 32 && cmds.len() >= 16 {
454 let workers = std::thread::available_parallelism()
455 .map(|n| n.get())
456 .unwrap_or(1)
457 .min(8)
458 .min(dirty_rows / 16);
459 if workers > 1 {
460 let stride = w * 4;
461 let rows_per_band = dirty_rows.div_ceil(workers);
462 let accum_dirty = &mut accum[dirty_y0 * stride..dirty_y1 * stride];
463 let out_dirty = &mut out[dirty_y0 * stride..dirty_y1 * stride];
464 std::thread::scope(|scope| {
465 let mut a_rest = accum_dirty;
466 let mut o_rest = out_dirty;
467 let mut band_y0 = dirty_y0;
468 while band_y0 < dirty_y1 {
469 let take_rows = rows_per_band.min(dirty_y1 - band_y0);
470 let take_elems = take_rows * stride;
471 let (a_band, a_next) = a_rest.split_at_mut(take_elems);
472 let (o_band, o_next) = o_rest.split_at_mut(take_elems);
473 a_rest = a_next;
474 o_rest = o_next;
475 let band_y1 = band_y0 + take_rows;
476 scope.spawn(move || {
477 rasterize_single_band(
478 o_band,
479 a_band,
480 w,
481 band_y0,
482 band_y1,
483 cmds,
484 props_list,
485 );
486 });
487 band_y0 = band_y1;
488 }
489 });
490 return;
491 }
492 }
493 }
494
495 let stride = w * 4;
496 let start = dirty_y0 * stride;
497 let end = dirty_y1 * stride;
498 rasterize_single_band(
499 &mut out[start..end],
500 &mut accum[start..end],
501 w,
502 dirty_y0,
503 dirty_y1,
504 cmds,
505 props_list,
506 );
507}
508
509fn rasterize_single_band(
510 out_band: &mut [u8],
511 accum_band: &mut [f32],
512 w: usize,
513 band_y0: usize,
514 band_y1: usize,
515 cmds: &[DrawCmd],
516 props_list: &[EmitterRenderProps<'_>],
517) {
518 let stride = w * 4;
519 let mut wx_heap: Vec<f32> = Vec::new();
520 let mut wx_stack = [0.0f32; 64];
521
522 for cmd in cmds {
523 if cmd.max_y < band_y0 || cmd.min_y >= band_y1 {
524 continue;
525 }
526 let y_lo = cmd.min_y.max(band_y0);
527 let y_hi = cmd.max_y.min(band_y1 - 1);
528 let x_lo = cmd.min_x;
529 let x_hi = cmd.max_x;
530
531 match cmd.shape {
532 DrawShape::Point => {
533 let pa = cmd.color[3];
534 let off = (y_lo - band_y0) * stride + x_lo * 4;
535 let dst = &mut accum_band[off..off + 4];
536 if pa >= 1.0 - 1e-5 {
537 dst[0] = cmd.color[0];
538 dst[1] = cmd.color[1];
539 dst[2] = cmd.color[2];
540 dst[3] = 1.0;
541 } else {
542 let inv_a = 1.0 - pa;
543 dst[0] = cmd.color[0] * pa + dst[0] * inv_a;
544 dst[1] = cmd.color[1] * pa + dst[1] * inv_a;
545 dst[2] = cmd.color[2] * pa + dst[2] * inv_a;
546 dst[3] = pa + dst[3] * inv_a;
547 }
548 }
549 DrawShape::Blob {
550 cx,
551 cy,
552 inv_two_sigma_sq,
553 } => {
554 let span_x = x_hi - x_lo + 1;
555 let wx: &mut [f32] = if span_x <= wx_stack.len() {
556 &mut wx_stack[..span_x]
557 } else {
558 wx_heap.resize(span_x, 0.0);
559 &mut wx_heap[..span_x]
560 };
561 for (i, w_slot) in wx.iter_mut().enumerate() {
562 let dx = (x_lo + i) as f64 + 0.5 - cx;
563 *w_slot = (-(dx * dx) * inv_two_sigma_sq).exp() as f32;
564 }
565
566 let sa = cmd.color[3];
567 let sr = cmd.color[0] * sa;
568 let sg = cmd.color[1] * sa;
569 let sb = cmd.color[2] * sa;
570 let row_x_start = x_lo * 4;
571 let row_x_end = (x_hi + 1) * 4;
572
573 for py in y_lo..=y_hi {
574 let dy = py as f64 + 0.5 - cy;
575 let wy = (-(dy * dy) * inv_two_sigma_sq).exp() as f32;
576 let row_a = sa * wy;
577 if row_a <= 1e-5 {
578 continue;
579 }
580 let row_r = sr * wy;
581 let row_g = sg * wy;
582 let row_b = sb * wy;
583 let row_off = (py - band_y0) * stride;
584 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
585 for (dst, &gx) in row_pixels.chunks_exact_mut(4).zip(wx.iter()) {
586 let pa = row_a * gx;
587 if pa <= 1e-5 {
588 continue;
589 }
590 let inv_a = 1.0 - pa;
591 dst[0] = row_r * gx + dst[0] * inv_a;
592 dst[1] = row_g * gx + dst[1] * inv_a;
593 dst[2] = row_b * gx + dst[2] * inv_a;
594 dst[3] = pa + dst[3] * inv_a;
595 }
596 }
597 }
598 DrawShape::NGon {
599 cx,
600 cy,
601 inv_two_sigma_sq,
602 inv_half_period,
603 spike_period,
604 phase,
605 sharpness,
606 } => {
607 let span_x = x_hi - x_lo + 1;
608 let wx: &mut [f32] = if span_x <= wx_stack.len() {
609 &mut wx_stack[..span_x]
610 } else {
611 wx_heap.resize(span_x, 0.0);
612 &mut wx_heap[..span_x]
613 };
614 for (i, w_slot) in wx.iter_mut().enumerate() {
615 let dx = (x_lo + i) as f64 + 0.5 - cx;
616 *w_slot = (-(dx * dx) * inv_two_sigma_sq).exp() as f32;
617 }
618
619 let sa = cmd.color[3];
620 let cr = cmd.color[0];
621 let cg = cmd.color[1];
622 let cb = cmd.color[2];
623 let row_x_start = x_lo * 4;
624 let row_x_end = (x_hi + 1) * 4;
625
626 for py in y_lo..=y_hi {
627 let dy = py as f64 + 0.5 - cy;
628 let wy = (-(dy * dy) * inv_two_sigma_sq).exp() as f32;
629 let row_a = sa * wy;
630 if row_a <= 1e-5 {
631 continue;
632 }
633 let row_off = (py - band_y0) * stride;
634 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
635 for (i, dst) in row_pixels.chunks_exact_mut(4).enumerate() {
636 let env_a = row_a * wx[i];
637 if env_a <= 1e-5 {
638 continue;
639 }
640 let dx = (x_lo + i) as f64 + 0.5 - cx;
641 let angle = (-dy).atan2(dx) - phase;
642 let off = angle.rem_euclid(spike_period);
643 let to_spike = off.min(spike_period - off);
644 let shape_w = (1.0 - to_spike * inv_half_period).powf(sharpness) as f32;
645 let pa = env_a * shape_w;
646 if pa <= 1e-5 {
647 continue;
648 }
649 let inv_a = 1.0 - pa;
650 dst[0] = cr * pa + dst[0] * inv_a;
651 dst[1] = cg * pa + dst[1] * inv_a;
652 dst[2] = cb * pa + dst[2] * inv_a;
653 dst[3] = pa + dst[3] * inv_a;
654 }
655 }
656 }
657 DrawShape::Bitmap {
658 emitter_idx,
659 cx,
660 cy,
661 draw_w,
662 draw_h,
663 rot_z_deg,
664 } => {
665 let Some((sprite, _)) = props_list[emitter_idx].resolved_sprite() else {
666 continue;
667 };
668 draw_bitmap_band(
669 accum_band,
670 stride,
671 band_y0,
672 y_lo,
673 y_hi,
674 x_lo,
675 x_hi,
676 cx,
677 cy,
678 draw_w,
679 draw_h,
680 rot_z_deg,
681 cmd.color,
682 sprite,
683 );
684 }
685 }
686 }
687
688 // Pack premultiplied f32 -> u8 and simultaneously reset `accum_band` to 0.0
689 // while the cache lines are hot so `scratch_accum` stays zeroed for the next frame.
690 for (dst, src) in out_band.iter_mut().zip(accum_band.iter_mut()) {
691 let v = *src;
692 *src = 0.0;
693 *dst = (v.clamp(0.0, 1.0) * 255.0 + 0.5) as u8;
694 }
695}
696
697#[allow(clippy::too_many_arguments)]
698#[inline]
699fn draw_bitmap_band(
700 accum_band: &mut [f32],
701 stride: usize,
702 band_y0: usize,
703 y_lo: usize,
704 y_hi: usize,
705 x_lo: usize,
706 x_hi: usize,
256 cx: f64,707 cx: f64,
257 cy: f64,708 cy: f64,
258 draw_w: f64,709 draw_w: f64,
...@@ -261,170 +712,233 @@ fn draw_bitmap_particle(...@@ -261,170 +712,233 @@ fn draw_bitmap_particle(
261 tint: [f32; 4],712 tint: [f32; 4],
262 sprite: &SpriteImage,713 sprite: &SpriteImage,
263) {714) {
264 if draw_w < 0.5 || draw_h < 0.5 {
265 return;
266 }
267
268 let hw = draw_w * 0.5;
269 let hh = draw_h * 0.5;
270 let theta = rot_z_deg.to_radians();
271 let cos_t = theta.cos();
272 let sin_t = theta.sin();
273
274 let rx = hw * cos_t.abs() + hh * sin_t.abs() + 1.0;
275 let ry = hw * sin_t.abs() + hh * cos_t.abs() + 1.0;
276
277 let min_x = ((cx - rx).floor() as isize).max(0) as usize;
278 let max_x = ((cx + rx).ceil() as isize).min(w as isize - 1);
279 let min_y = ((cy - ry).floor() as isize).max(0) as usize;
280 let max_y = ((cy + ry).ceil() as isize).min(h as isize - 1);
281 if max_x < min_x as isize || max_y < min_y as isize {
282 return;
283 }
284
285 let inv_dw = 1.0 / draw_w;715 let inv_dw = 1.0 / draw_w;
286 let inv_dh = 1.0 / draw_h;716 let inv_dh = 1.0 / draw_h;
287 let edge_u = inv_dw * 0.5;717 let edge_u = inv_dw * 0.5;
288 let edge_v = inv_dh * 0.5;718 let edge_v = inv_dh * 0.5;
719 let inv_2edge_u = 1.0 / (2.0 * edge_u);
720 let inv_2edge_v = 1.0 / (2.0 * edge_v);
289 let sw_i = sprite.size[0] as usize;721 let sw_i = sprite.size[0] as usize;
290 let sh_i = sprite.size[1] as usize;722 let sh_i = sprite.size[1] as usize;
723 let row_x_start = x_lo * 4;
724 let row_x_end = (x_hi + 1) * 4;
725
726 // Fast path: axis-aligned (unrotated) sprite.
727 if rot_z_deg.abs() <= 1e-6 {
728 let u0 = (x_lo as f64 + 0.5 - cx) * inv_dw + 0.5;
729 if sw_i == 1 && sh_i == 1 {
730 let s0 = sprite.rgba[0] as f32 * INV_255 * tint[0] * tint[3];
731 let s1 = sprite.rgba[1] as f32 * INV_255 * tint[1] * tint[3];
732 let s2 = sprite.rgba[2] as f32 * INV_255 * tint[2] * tint[3];
733 let s3 = sprite.rgba[3] as f32 * INV_255 * tint[3];
734 if s3 <= 1e-5 {
735 return;
736 }
737 for py in y_lo..=y_hi {
738 let v = (py as f64 + 0.5 - cy) * inv_dh + 0.5;
739 if v <= -edge_v || v >= 1.0 + edge_v {
740 continue;
741 }
742 let cov_v = ((v + edge_v) * inv_2edge_v)
743 .min((1.0 + edge_v - v) * inv_2edge_v)
744 .clamp(0.0, 1.0);
745 if cov_v <= 1e-4 {
746 continue;
747 }
748 let cov_vf = cov_v as f32;
749 let row_off = (py - band_y0) * stride;
750 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
751 let mut u = u0;
752 for dst in row_pixels.chunks_exact_mut(4) {
753 if u > -edge_u && u < 1.0 + edge_u {
754 let cov_u = ((u + edge_u) * inv_2edge_u)
755 .min((1.0 + edge_u - u) * inv_2edge_u)
756 .clamp(0.0, 1.0);
757 let cov = cov_u as f32 * cov_vf;
758 if cov > 1e-4 {
759 let pa = s3 * cov;
760 if pa > 1e-5 {
761 let inv_a = 1.0 - pa;
762 dst[0] = s0 * cov + dst[0] * inv_a;
763 dst[1] = s1 * cov + dst[1] * inv_a;
764 dst[2] = s2 * cov + dst[2] * inv_a;
765 dst[3] = pa + dst[3] * inv_a;
766 }
767 }
768 }
769 u += inv_dw;
770 }
771 }
772 return;
773 }
291774
292 for py in min_y..=(max_y as usize) {775 let sw_f = sw_i as f64;
293 let dy = (py as f64 + 0.5) - cy;776 let sh_f = sh_i as f64;
294 let row_off = py * w * 4;777 let sw_max = (sw_i - 1) as f64;
295 for px in min_x..=(max_x as usize) {778 let sh_max = (sh_i - 1) as f64;
296 let dx = (px as f64 + 0.5) - cx;779 let tr = tint[0] * INV_255;
297 // Inverse rotate into sprite local space (CCW in Y-up).780 let tg = tint[1] * INV_255;
298 let lx = dx * cos_t - dy * sin_t;781 let tb = tint[2] * INV_255;
299 let ly = dx * sin_t + dy * cos_t;782 let ta = tint[3] * INV_255;
300783
301 let u = lx * inv_dw + 0.5;784 for py in y_lo..=y_hi {
302 let v = ly * inv_dh + 0.5;785 let v = (py as f64 + 0.5 - cy) * inv_dh + 0.5;
303 if u <= -edge_u || u >= 1.0 + edge_u || v <= -edge_v || v >= 1.0 + edge_v {786 if v <= -edge_v || v >= 1.0 + edge_v {
304 continue;787 continue;
305 }788 }
306789 let cov_v = ((v + edge_v) * inv_2edge_v)
307 // Anti-aliased border coverage (0.5px feather at edges).790 .min((1.0 + edge_v - v) * inv_2edge_v)
308 let cov_u = ((u + edge_u) / (2.0 * edge_u))
309 .min((1.0 + edge_u - u) / (2.0 * edge_u))
310 .clamp(0.0, 1.0);
311 let cov_v = ((v + edge_v) / (2.0 * edge_v))
312 .min((1.0 + edge_v - v) / (2.0 * edge_v))
313 .clamp(0.0, 1.0);791 .clamp(0.0, 1.0);
314 let cov = (cov_u * cov_v) as f32;792 if cov_v <= 1e-4 {
315 if cov <= 1e-4 {
316 continue;793 continue;
317 }794 }
318795 let fy = (v.clamp(0.0, 1.0) * sh_f - 0.5).clamp(0.0, sh_max);
319 let sample = sample_sprite_bilinear(796 let y0 = fy.floor() as usize;
320 &sprite.rgba,797 let y1 = (y0 + 1).min(sh_i - 1);
321 sw_i,798 let ty = (fy - y0 as f64) as f32;
322 sh_i,799 let one_minus_ty = 1.0 - ty;
323 u.clamp(0.0, 1.0),800 let row0 = y0 * sw_i;
324 v.clamp(0.0, 1.0),801 let row1 = y1 * sw_i;
325 );802 let cov_vf = cov_v as f32;
326 let alpha_scale = tint[3] * cov;803
327 let pa = sample[3] * alpha_scale;804 let row_off = (py - band_y0) * stride;
328 if pa <= 1e-5 {805 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
329 continue;806 let mut u = u0;
807 for dst in row_pixels.chunks_exact_mut(4) {
808 if u > -edge_u && u < 1.0 + edge_u {
809 let cov_u = ((u + edge_u) * inv_2edge_u)
810 .min((1.0 + edge_u - u) * inv_2edge_u)
811 .clamp(0.0, 1.0);
812 let cov = cov_u as f32 * cov_vf;
813 if cov > 1e-4 {
814 let fx = (u.clamp(0.0, 1.0) * sw_f - 0.5).clamp(0.0, sw_max);
815 let x0 = fx.floor() as usize;
816 let x1 = (x0 + 1).min(sw_i - 1);
817 let tx = (fx - x0 as f64) as f32;
818 let omt = 1.0 - tx;
819
820 let w00 = omt * one_minus_ty;
821 let w10 = tx * one_minus_ty;
822 let w01 = omt * ty;
823 let w11 = tx * ty;
824
825 let i00 = (row0 + x0) * 4;
826 let i10 = (row0 + x1) * 4;
827 let i01 = (row1 + x0) * 4;
828 let i11 = (row1 + x1) * 4;
829
830 let s_a = sprite.rgba[i00 + 3] as f32 * w00
831 + sprite.rgba[i10 + 3] as f32 * w10
832 + sprite.rgba[i01 + 3] as f32 * w01
833 + sprite.rgba[i11 + 3] as f32 * w11;
834 let pa = s_a * ta * cov;
835 if pa > 1e-5 {
836 let s_r = sprite.rgba[i00] as f32 * w00
837 + sprite.rgba[i10] as f32 * w10
838 + sprite.rgba[i01] as f32 * w01
839 + sprite.rgba[i11] as f32 * w11;
840 let s_g = sprite.rgba[i00 + 1] as f32 * w00
841 + sprite.rgba[i10 + 1] as f32 * w10
842 + sprite.rgba[i01 + 1] as f32 * w01
843 + sprite.rgba[i11 + 1] as f32 * w11;
844 let s_b = sprite.rgba[i00 + 2] as f32 * w00
845 + sprite.rgba[i10 + 2] as f32 * w10
846 + sprite.rgba[i01 + 2] as f32 * w01
847 + sprite.rgba[i11 + 2] as f32 * w11;
848 let inv_a = 1.0 - pa;
849 dst[0] = s_r * (tr * cov * tint[3]) + dst[0] * inv_a;
850 dst[1] = s_g * (tg * cov * tint[3]) + dst[1] * inv_a;
851 dst[2] = s_b * (tb * cov * tint[3]) + dst[2] * inv_a;
852 dst[3] = pa + dst[3] * inv_a;
853 }
854 }
855 }
856 u += inv_dw;
330 }857 }
331 let pr = sample[0] * tint[0] * alpha_scale;
332 let pg = sample[1] * tint[1] * alpha_scale;
333 let pb = sample[2] * tint[2] * alpha_scale;
334
335 let idx = row_off + px * 4;
336 let inv_a = 1.0 - pa;
337 accum[idx] = pr + accum[idx] * inv_a;
338 accum[idx + 1] = pg + accum[idx + 1] * inv_a;
339 accum[idx + 2] = pb + accum[idx + 2] * inv_a;
340 accum[idx + 3] = pa + accum[idx + 3] * inv_a;
341 }858 }
342 }
343}
344
345#[inline]
346fn sample_sprite_bilinear(rgba: &[u8], w: usize, h: usize, u: f64, v: f64) -> [f32; 4] {
347 let fx = (u * w as f64 - 0.5).clamp(0.0, (w - 1) as f64);
348 let fy = (v * h as f64 - 0.5).clamp(0.0, (h - 1) as f64);
349 let x0 = fx.floor() as usize;
350 let y0 = fy.floor() as usize;
351 let x1 = (x0 + 1).min(w - 1);
352 let y1 = (y0 + 1).min(h - 1);
353 let tx = (fx - x0 as f64) as f32;
354 let ty = (fy - y0 as f64) as f32;
355
356 let i00 = (y0 * w + x0) * 4;
357 let i10 = (y0 * w + x1) * 4;
358 let i01 = (y1 * w + x0) * 4;
359 let i11 = (y1 * w + x1) * 4;
360
361 let w00 = (1.0 - tx) * (1.0 - ty) * (1.0 / 255.0);
362 let w10 = tx * (1.0 - ty) * (1.0 / 255.0);
363 let w01 = (1.0 - tx) * ty * (1.0 / 255.0);
364 let w11 = tx * ty * (1.0 / 255.0);
365
366 [
367 rgba[i00] as f32 * w00
368 + rgba[i10] as f32 * w10
369 + rgba[i01] as f32 * w01
370 + rgba[i11] as f32 * w11,
371 rgba[i00 + 1] as f32 * w00
372 + rgba[i10 + 1] as f32 * w10
373 + rgba[i01 + 1] as f32 * w01
374 + rgba[i11 + 1] as f32 * w11,
375 rgba[i00 + 2] as f32 * w00
376 + rgba[i10 + 2] as f32 * w10
377 + rgba[i01 + 2] as f32 * w01
378 + rgba[i11 + 2] as f32 * w11,
379 rgba[i00 + 3] as f32 * w00
380 + rgba[i10 + 3] as f32 * w10
381 + rgba[i01 + 3] as f32 * w01
382 + rgba[i11 + 3] as f32 * w11,
383 ]
384}
385
386/// Source-over blends one premultiplied-accumulator pixel; out-of-bounds coordinates are ignored.
387#[inline]
388fn blend_pixel(accum: &mut [f32], w: usize, h: usize, x: f64, y: f64, color: [f32; 4]) {
389 if x < 0.0 || y < 0.0 || x >= w as f64 || y >= h as f64 {
390 return;859 return;
391 }860 }
392 let pa = color[3].clamp(0.0, 1.0);
393 if pa <= 1e-5 {
394 return;
395 }
396 let idx = (y as usize * w + x as usize) * 4;
397 let inv_a = 1.0 - pa;
398 accum[idx] = color[0] * pa + accum[idx] * inv_a;
399 accum[idx + 1] = color[1] * pa + accum[idx + 1] * inv_a;
400 accum[idx + 2] = color[2] * pa + accum[idx + 2] * inv_a;
401 accum[idx + 3] = pa + accum[idx + 3] * inv_a;
402}
403861
404/// Gaussian falloff sampled at pixel centers out to `4 sigma`, scaled by `shape(dx, dy)`.862 // General rotated bitmap path with incremental scanline UV stepping.
405#[allow(clippy::too_many_arguments)]863 let theta = rot_z_deg.to_radians();
406fn draw_soft_particle(864 let cos_t = theta.cos();
407 accum: &mut [f32],865 let sin_t = theta.sin();
408 w: usize,866 let du_dx = cos_t * inv_dw;
409 h: usize,867 let dv_dx = sin_t * inv_dh;
410 cx: f64,868 let dx0 = (x_lo as f64 + 0.5) - cx;
411 cy: f64,869 let sw_f = sw_i as f64;
412 sigma: f64,870 let sh_f = sh_i as f64;
413 color: [f32; 4],871 let sw_max = (sw_i - 1) as f64;
414 shape: impl Fn(f64, f64) -> f64,872 let sh_max = (sh_i - 1) as f64;
415) {873 let tr = tint[0] * tint[3] * INV_255;
416 let bound = 4.0 * sigma;874 let tg = tint[1] * tint[3] * INV_255;
417 let min_x = ((cx - bound).floor() as isize).max(0);875 let tb = tint[2] * tint[3] * INV_255;
418 let max_x = ((cx + bound).ceil() as isize).min(w as isize - 1);876 let ta = tint[3] * INV_255;
419 let min_y = ((cy - bound).floor() as isize).max(0);877
420 let max_y = ((cy + bound).ceil() as isize).min(h as isize - 1);878 for py in y_lo..=y_hi {
421 let inv_two_sigma_sq = 0.5 / (sigma * sigma);
422 for py in min_y..=max_y {
423 let dy = (py as f64 + 0.5) - cy;879 let dy = (py as f64 + 0.5) - cy;
424 for px in min_x..=max_x {880 let mut u = (dx0 * cos_t - dy * sin_t) * inv_dw + 0.5;
425 let dx = (px as f64 + 0.5) - cx;881 let mut v = (dx0 * sin_t + dy * cos_t) * inv_dh + 0.5;
426 let cov = ((-(dx * dx + dy * dy) * inv_two_sigma_sq).exp() * shape(dx, dy)) as f32;882 let row_off = (py - band_y0) * stride;
427 blend_pixel(accum, w, h, px as f64, py as f64, [color[0], color[1], color[2], color[3] * cov]);883 let row_pixels = &mut accum_band[row_off + row_x_start..row_off + row_x_end];
884
885 for dst in row_pixels.chunks_exact_mut(4) {
886 if u > -edge_u && u < 1.0 + edge_u && v > -edge_v && v < 1.0 + edge_v {
887 let cov_u = ((u + edge_u) * inv_2edge_u)
888 .min((1.0 + edge_u - u) * inv_2edge_u)
889 .clamp(0.0, 1.0);
890 let cov_v = ((v + edge_v) * inv_2edge_v)
891 .min((1.0 + edge_v - v) * inv_2edge_v)
892 .clamp(0.0, 1.0);
893 let cov = (cov_u * cov_v) as f32;
894 if cov > 1e-4 {
895 let fx = (u.clamp(0.0, 1.0) * sw_f - 0.5).clamp(0.0, sw_max);
896 let fy = (v.clamp(0.0, 1.0) * sh_f - 0.5).clamp(0.0, sh_max);
897 let x0 = fx.floor() as usize;
898 let y0 = fy.floor() as usize;
899 let x1 = (x0 + 1).min(sw_i - 1);
900 let y1 = (y0 + 1).min(sh_i - 1);
901 let tx = (fx - x0 as f64) as f32;
902 let ty = (fy - y0 as f64) as f32;
903
904 let w00 = (1.0 - tx) * (1.0 - ty);
905 let w10 = tx * (1.0 - ty);
906 let w01 = (1.0 - tx) * ty;
907 let w11 = tx * ty;
908
909 let i00 = (y0 * sw_i + x0) * 4;
910 let i10 = (y0 * sw_i + x1) * 4;
911 let i01 = (y1 * sw_i + x0) * 4;
912 let i11 = (y1 * sw_i + x1) * 4;
913
914 let s_a = sprite.rgba[i00 + 3] as f32 * w00
915 + sprite.rgba[i10 + 3] as f32 * w10
916 + sprite.rgba[i01 + 3] as f32 * w01
917 + sprite.rgba[i11 + 3] as f32 * w11;
918 let pa = s_a * ta * cov;
919 if pa > 1e-5 {
920 let s_r = sprite.rgba[i00] as f32 * w00
921 + sprite.rgba[i10] as f32 * w10
922 + sprite.rgba[i01] as f32 * w01
923 + sprite.rgba[i11] as f32 * w11;
924 let s_g = sprite.rgba[i00 + 1] as f32 * w00
925 + sprite.rgba[i10 + 1] as f32 * w10
926 + sprite.rgba[i01 + 1] as f32 * w01
927 + sprite.rgba[i11 + 1] as f32 * w11;
928 let s_b = sprite.rgba[i00 + 2] as f32 * w00
929 + sprite.rgba[i10 + 2] as f32 * w10
930 + sprite.rgba[i01 + 2] as f32 * w01
931 + sprite.rgba[i11 + 2] as f32 * w11;
932 let inv_a = 1.0 - pa;
933 dst[0] = s_r * (tr * cov) + dst[0] * inv_a;
934 dst[1] = s_g * (tg * cov) + dst[1] * inv_a;
935 dst[2] = s_b * (tb * cov) + dst[2] * inv_a;
936 dst[3] = pa + dst[3] * inv_a;
937 }
938 }
939 }
940 u += du_dx;
941 v += dv_dx;
428 }942 }
429 }943 }
430}944}
crates/engine/src/particles/sim.rs+73-34
...@@ -1,5 +1,3 @@...@@ -1,5 +1,3 @@
1//! Per-frame particle emission, regions, forces, collisions, and simulation stepping.
2
3use std::collections::HashSet;1use std::collections::HashSet;
42
5use model::{Comp, ExprEngine, Node};3use model::{Comp, ExprEngine, Node};
...@@ -141,24 +139,44 @@ fn emit_particles(...@@ -141,24 +139,44 @@ fn emit_particles(
141 let base_b = comp.eval_number(node, "ParticleStyle.Blue", t, 1.0, expr);139 let base_b = comp.eval_number(node, "ParticleStyle.Blue", t, 1.0, expr);
142 let base_a = comp.eval_number(node, "ParticleStyle.Alpha", t, 1.0, expr);140 let base_a = comp.eval_number(node, "ParticleStyle.Alpha", t, 1.0, expr);
143141
144 let color_var = comp.eval_number(node, "ParticleStyle.ColorVariance", t, 0.0, expr) > 0.5;142 let red_lo_off = comp.eval_number(node, "ParticleStyle.RedLow", t, 0.0, expr);
145 let r_lo = (base_r + comp.eval_number(node, "ParticleStyle.RedLow", t, 0.0, expr)).clamp(0.0, 1.0);143 let red_hi_off = comp.eval_number(node, "ParticleStyle.RedHigh", t, 0.0, expr);
146 let r_hi = (base_r + comp.eval_number(node, "ParticleStyle.RedHigh", t, 0.0, expr)).clamp(0.0, 1.0);144 let green_lo_off = comp.eval_number(node, "ParticleStyle.GreenLow", t, 0.0, expr);
147 let g_lo = (base_g + comp.eval_number(node, "ParticleStyle.GreenLow", t, 0.0, expr)).clamp(0.0, 1.0);145 let green_hi_off = comp.eval_number(node, "ParticleStyle.GreenHigh", t, 0.0, expr);
148 let g_hi = (base_g + comp.eval_number(node, "ParticleStyle.GreenHigh", t, 0.0, expr)).clamp(0.0, 1.0);146 let blue_lo_off = comp.eval_number(node, "ParticleStyle.BlueLow", t, 0.0, expr);
149 let b_lo = (base_b + comp.eval_number(node, "ParticleStyle.BlueLow", t, 0.0, expr)).clamp(0.0, 1.0);147 let blue_hi_off = comp.eval_number(node, "ParticleStyle.BlueHigh", t, 0.0, expr);
150 let b_hi = (base_b + comp.eval_number(node, "ParticleStyle.BlueHigh", t, 0.0, expr)).clamp(0.0, 1.0);148 let alpha_lo_off = comp.eval_number(node, "ParticleStyle.AlphaLow", t, 0.0, expr);
151 let a_lo = (base_a + comp.eval_number(node, "ParticleStyle.AlphaLow", t, 0.0, expr)).clamp(0.0, 1.0);149 let alpha_hi_off = comp.eval_number(node, "ParticleStyle.AlphaHigh", t, 0.0, expr);
152 let a_hi = (base_a + comp.eval_number(node, "ParticleStyle.AlphaHigh", t, 0.0, expr)).clamp(0.0, 1.0);150
153151 let color_var = comp.eval_number(node, "ParticleStyle.ColorVariance", t, 0.0, expr) > 0.5
152 || red_lo_off.abs() > 1e-9
153 || red_hi_off.abs() > 1e-9
154 || green_lo_off.abs() > 1e-9
155 || green_hi_off.abs() > 1e-9
156 || blue_lo_off.abs() > 1e-9
157 || blue_hi_off.abs() > 1e-9
158 || alpha_lo_off.abs() > 1e-9
159 || alpha_hi_off.abs() > 1e-9;
160
161 let r_lo = (base_r + red_lo_off).clamp(0.0, 1.0);
162 let r_hi = (base_r + red_hi_off).clamp(0.0, 1.0);
163 let g_lo = (base_g + green_lo_off).clamp(0.0, 1.0);
164 let g_hi = (base_g + green_hi_off).clamp(0.0, 1.0);
165 let b_lo = (base_b + blue_lo_off).clamp(0.0, 1.0);
166 let b_hi = (base_b + blue_hi_off).clamp(0.0, 1.0);
167 let a_lo = (base_a + alpha_lo_off).clamp(0.0, 1.0);
168 let a_hi = (base_a + alpha_hi_off).clamp(0.0, 1.0);
169
170 // Fusion's ParticleStyle.Size defaults to 0.1 across all styles.
154 let size_base = comp171 let size_base = comp
155 .eval_number(node, "ParticleStyle.Size", t, 1.0, expr)172 .eval_number(node, "ParticleStyle.Size", t, 0.1, expr)
156 .max(0.0);173 .max(0.0);
157 let size_var = comp174 let size_var = comp
158 .eval_number(node, "ParticleStyle.SizeVariance", t, 0.0, expr)175 .eval_number(node, "ParticleStyle.SizeVariance", t, 0.0, expr)
159 .max(0.0);176 .max(0.0);
160177
161 let region = RegionSpec::from_node(comp, node, t, expr);178 let region = RegionSpec::from_node(comp, node, t, expr);
179 state.particles.reserve(emit_count);
162180
163 for _ in 0..emit_count {181 for _ in 0..emit_count {
164 let mut pos = region.sample(&mut rng);182 let mut pos = region.sample(&mut rng);
...@@ -516,11 +534,18 @@ impl RegionSpec {...@@ -516,11 +534,18 @@ impl RegionSpec {
516 if r_pos > radius && r_next > radius {534 if r_pos > radius && r_next > radius {
517 return None;535 return None;
518 }536 }
519 let ref_v = if r_pos > 1e-9 { dp } else if r_next > 1e-9 { dn } else { [0.0, 1.0, 0.0] };537 let ref_v = if r_pos > 1e-9 {
520 let r_len = (ref_v[0] * ref_v[0] + ref_v[1] * ref_v[1] + ref_v[2] * ref_v[2]).sqrt().max(1e-9);538 dp
539 } else if r_next > 1e-9 {
540 dn
541 } else {
542 [0.0, 1.0, 0.0]
543 };
544 let r_len = (ref_v[0] * ref_v[0] + ref_v[1] * ref_v[1] + ref_v[2] * ref_v[2])
545 .sqrt()
546 .max(1e-9);
521 let mut n = [ref_v[0] / r_len, ref_v[1] / r_len, ref_v[2] / r_len];547 let mut n = [ref_v[0] / r_len, ref_v[1] / r_len, ref_v[2] / r_len];
522 if r_pos < radius && r_next >= radius {548 if r_pos < radius && r_next >= radius {
523 // Particle hitting sphere wall from inside
524 n = [-n[0], -n[1], -n[2]];549 n = [-n[0], -n[1], -n[2]];
525 let pushed = [550 let pushed = [
526 center[0] - n[0] * (radius - 1e-5).max(0.0),551 center[0] - n[0] * (radius - 1e-5).max(0.0),
...@@ -536,7 +561,11 @@ impl RegionSpec {...@@ -536,7 +561,11 @@ impl RegionSpec {
536 ];561 ];
537 Some((pushed, n))562 Some((pushed, n))
538 }563 }
539 Self::Rect { center, width, height } => {564 Self::Rect {
565 center,
566 width,
567 height,
568 } => {
540 let hx = width * 0.5;569 let hx = width * 0.5;
541 let hy = height * 0.5;570 let hy = height * 0.5;
542 if hy < 1e-6 {571 if hy < 1e-6 {
...@@ -555,15 +584,24 @@ impl RegionSpec {...@@ -555,15 +584,24 @@ impl RegionSpec {
555 }584 }
556 bounce_aabb(pos, vel, center, [hx, hy, 1e6], false)585 bounce_aabb(pos, vel, center, [hx, hy, 1e6], false)
557 }586 }
558 Self::Cube { center, width, height, depth } => {587 Self::Cube {
559 bounce_aabb(pos, vel, center, [width * 0.5, height * 0.5, depth * 0.5], true)588 center,
560 }589 width,
590 height,
591 depth,
592 } => bounce_aabb(pos, vel, center, [width * 0.5, height * 0.5, depth * 0.5], true),
561 Self::Point { center } => {593 Self::Point { center } => {
562 let cy = center[1];594 let cy = center[1];
563 let d0 = pos[1] - cy;595 let d0 = pos[1] - cy;
564 let d1 = next[1] - cy;596 let d1 = next[1] - cy;
565 if d0 * d1 <= 0.0 || d1.abs() <= 1e-5 {597 if d0 * d1 <= 0.0 || d1.abs() <= 1e-5 {
566 let ny = if vel[1] < 0.0 { 1.0 } else if vel[1] > 0.0 { -1.0 } else { return None };598 let ny = if vel[1] < 0.0 {
599 1.0
600 } else if vel[1] > 0.0 {
601 -1.0
602 } else {
603 return None;
604 };
567 let alpha = if (d0 - d1).abs() > 1e-12 {605 let alpha = if (d0 - d1).abs() > 1e-12 {
568 (d0 / (d0 - d1)).clamp(0.0, 1.0)606 (d0 / (d0 - d1)).clamp(0.0, 1.0)
569 } else {607 } else {
...@@ -601,7 +639,6 @@ fn bounce_aabb(...@@ -601,7 +639,6 @@ fn bounce_aabb(
601 }639 }
602640
603 if inside_pos {641 if inside_pos {
604 // Already inside: push out through the closest face
605 let mut best_axis = 0usize;642 let mut best_axis = 0usize;
606 let mut best_pen = f64::INFINITY;643 let mut best_pen = f64::INFINITY;
607 let mut best_sign = 1.0f64;644 let mut best_sign = 1.0f64;
...@@ -674,7 +711,7 @@ fn apply_modifier(...@@ -674,7 +711,7 @@ fn apply_modifier(
674) {711) {
675 match node.kind.as_str() {712 match node.kind.as_str() {
676 "pPointForce" => {713 "pPointForce" => {
677 let strength = comp.eval_number(node, "Strength", t, 0.0, expr);714 let strength = comp.eval_number(node, "Strength", t, 0.1, expr);
678 if strength.abs() < 1e-12 {715 if strength.abs() < 1e-12 {
679 return;716 return;
680 }717 }
...@@ -728,14 +765,14 @@ fn apply_modifier(...@@ -728,14 +765,14 @@ fn apply_modifier(
728 }765 }
729 }766 }
730 "pDrag" | "pFriction" => {767 "pDrag" | "pFriction" => {
731 let damp = if node.kind == "pFriction" {768 let vel_fric = if node.kind == "pFriction" || !node.inputs.contains_key("Drag") {
732 1.0 - comp.eval_number(node, "VelocityFriction", t, 0.05, expr)769 comp.eval_number(node, "VelocityFriction", t, 0.05, expr)
733 } else {770 } else {
734 1.0 - comp.eval_number(node, "Drag", t, 0.05, expr)771 comp.eval_number(node, "Drag", t, 0.05, expr)
735 }772 };
736 .clamp(0.0, 1.0);773 let damp = (1.0 - vel_fric).clamp(0.0, 1.0);
737 let spin_damp = if node.kind == "pFriction" {774 let spin_damp = if node.kind == "pFriction" || node.inputs.contains_key("SpinFriction") {
738 1.0 - comp.eval_number(node, "SpinFriction", t, 0.05, expr).clamp(0.0, 1.0)775 (1.0 - comp.eval_number(node, "SpinFriction", t, 0.05, expr)).clamp(0.0, 1.0)
739 } else {776 } else {
740 1.0777 1.0
741 };778 };
...@@ -752,11 +789,11 @@ fn apply_modifier(...@@ -752,11 +789,11 @@ fn apply_modifier(
752 "pTurbulence" => {789 "pTurbulence" => {
753 let sx = comp.eval_number(node, "XStrength", t, 0.1, expr);790 let sx = comp.eval_number(node, "XStrength", t, 0.1, expr);
754 let sy = comp.eval_number(node, "YStrength", t, 0.1, expr);791 let sy = comp.eval_number(node, "YStrength", t, 0.1, expr);
755 let sz = comp.eval_number(node, "ZStrength", t, 0.0, expr);792 let sz = comp.eval_number(node, "ZStrength", t, 0.1, expr);
756 if sx.abs() < 1e-12 && sy.abs() < 1e-12 && sz.abs() < 1e-12 {793 if sx.abs() < 1e-12 && sy.abs() < 1e-12 && sz.abs() < 1e-12 {
757 return;794 return;
758 }795 }
759 let density = comp.eval_number(node, "Density", t, 1.0, expr).max(0.01);796 let density = comp.eval_number(node, "Density", t, 10.0, expr).max(0.01);
760 let seed = comp.eval_number(node, "RandomSeed", t, 0.0, expr).round() as u64;797 let seed = comp.eval_number(node, "RandomSeed", t, 0.0, expr).round() as u64;
761 let time_shift = t * 0.03;798 let time_shift = t * 0.03;
762799
...@@ -768,8 +805,10 @@ fn apply_modifier(...@@ -768,8 +805,10 @@ fn apply_modifier(
768 let qy = p.pos[1] * density - time_shift * 0.7;805 let qy = p.pos[1] * density - time_shift * 0.7;
769 let qz = p.pos[2] * density;806 let qz = p.pos[2] * density;
770 let nx = value_noise_3d(qx, qy, qz, seed);807 let nx = value_noise_3d(qx, qy, qz, seed);
771 let ny = value_noise_3d(qx + 31.7, qy + 17.3, qz + 47.1, seed ^ 0x517C_C1B7_2722_0A95);808 let ny =
772 let nz = value_noise_3d(qx - 19.4, qy + 53.9, qz - 11.2, seed ^ 0x9E37_79B9_7F4A_7C15);809 value_noise_3d(qx + 31.7, qy + 17.3, qz + 47.1, seed ^ 0x517C_C1B7_2722_0A95);
810 let nz =
811 value_noise_3d(qx - 19.4, qy + 53.9, qz - 11.2, seed ^ 0x9E37_79B9_7F4A_7C15);
773 p.vel[0] += nx * sx * TURBULENCE_SCALE;812 p.vel[0] += nx * sx * TURBULENCE_SCALE;
774 p.vel[1] += ny * sy * TURBULENCE_SCALE;813 p.vel[1] += ny * sy * TURBULENCE_SCALE;
775 p.vel[2] += nz * sz * TURBULENCE_SCALE;814 p.vel[2] += nz * sz * TURBULENCE_SCALE;
scripts/accuracy_ledger.json+315-315
...@@ -1247,42 +1247,42 @@...@@ -1247,42 +1247,42 @@
1247 "category": "Transform, Warp & Framing"1247 "category": "Transform, Warp & Framing"
1248 },1248 },
1249 "Cube3D": {1249 "Cube3D": {
1250 "mean_accuracy": 98.5569,1250 "mean_accuracy": 99.9049,
1251 "min_accuracy": 97.8672,1251 "min_accuracy": 99.8407,
1252 "mean_alpha_accuracy": 94.9009,1252 "mean_alpha_accuracy": 99.9924,
1253 "min_alpha_accuracy": 92.4135,1253 "min_alpha_accuracy": 99.9084,
1254 "frames": 12,1254 "frames": 12,
1255 "timestamp": "2026-12-01T17:47:55Z",1255 "timestamp": "2026-12-01T23:48:11Z",
1256 "per_frame": [1256 "per_frame": [
1257 {1257 {
1258 "frame": 0,1258 "frame": 0,
1259 "label": "defaults",1259 "label": "defaults",
1260 "accuracy": 97.8672,1260 "accuracy": 99.8845,
1261 "alpha_accuracy": 92.4151261 "alpha_accuracy": 100.0
1262 },1262 },
1263 {1263 {
1264 "frame": 1,1264 "frame": 1,
1265 "label": "Left.MtlStdInputs.MaterialID=16, Front.MtlStdInputs.Diffuse.Color.Red=0.22421",1265 "label": "Left.MtlStdInputs.MaterialID=16, Front.MtlStdInputs.Diffuse.Color.Red=0.22421",
1266 "accuracy": 97.8866,1266 "accuracy": 99.9081,
1267 "alpha_accuracy": 92.4151267 "alpha_accuracy": 100.0
1268 },1268 },
1269 {1269 {
1270 "frame": 2,1270 "frame": 2,
1271 "label": "Transform3DOp.Translate.Z=-7.91602, Back.MtlStdInputs.ReceivesShadows=0, Front.MtlStdInputs.Transmittance.ColorDetail=0.89888",1271 "label": "Transform3DOp.Translate.Z=-7.91602, Back.MtlStdInputs.ReceivesShadows=0, Front.MtlStdInputs.Transmittance.ColorDetail=0.89888",
1272 "accuracy": 99.8103,1272 "accuracy": 99.915,
1273 "alpha_accuracy": 99.58351273 "alpha_accuracy": 100.0
1274 },1274 },
1275 {1275 {
1276 "frame": 3,1276 "frame": 3,
1277 "label": "Right.MtlStdInputs.Diffuse.Color.Blue=0.46754",1277 "label": "Right.MtlStdInputs.Diffuse.Color.Blue=0.46754",
1278 "accuracy": 97.9141,1278 "accuracy": 99.8845,
1279 "alpha_accuracy": 92.4151279 "alpha_accuracy": 100.0
1280 },1280 },
1281 {1281 {
1282 "frame": 4,1282 "frame": 4,
1283 "label": "Back.MtlStdInputs.Specular.Color.Blue=0.70776, SurfaceCubeInputs.Controls.Tangents.Show=1",1283 "label": "Back.MtlStdInputs.Specular.Color.Blue=0.70776, SurfaceCubeInputs.Controls.Tangents.Show=1",
1284 "accuracy": 97.8672,1284 "accuracy": 99.8845,
1285 "alpha_accuracy": 92.4151285 "alpha_accuracy": 100.0
1286 },1286 },
1287 {1287 {
1288 "frame": 5,1288 "frame": 5,
...@@ -1293,8 +1293,8 @@...@@ -1293,8 +1293,8 @@
1293 {1293 {
1294 "frame": 6,1294 "frame": 6,
1295 "label": "Top.MtlStdInputs.Transmittance.Color.Green=0.54232",1295 "label": "Top.MtlStdInputs.Transmittance.Color.Green=0.54232",
1296 "accuracy": 97.8672,1296 "accuracy": 99.8845,
1297 "alpha_accuracy": 92.4151297 "alpha_accuracy": 100.0
1298 },1298 },
1299 {1299 {
1300 "frame": 7,1300 "frame": 7,
...@@ -1305,20 +1305,20 @@...@@ -1305,20 +1305,20 @@
1305 {1305 {
1306 "frame": 8,1306 "frame": 8,
1307 "label": "Top.MtlStdInputs.Specular.Intensity=0.48618, Left.MtlStdInputs.Diffuse.Color.Blue=0.3401, SurfaceCubeInputs.SubdivisionWidth=11",1307 "label": "Top.MtlStdInputs.Specular.Intensity=0.48618, Left.MtlStdInputs.Diffuse.Color.Blue=0.3401, SurfaceCubeInputs.SubdivisionWidth=11",
1308 "accuracy": 97.8954,1308 "accuracy": 99.8874,
1309 "alpha_accuracy": 92.41351309 "alpha_accuracy": 100.0
1310 },1310 },
1311 {1311 {
1312 "frame": 9,1312 "frame": 9,
1313 "label": "Transform3DOp.InvertTransform=1",1313 "label": "Transform3DOp.InvertTransform=1",
1314 "accuracy": 97.8672,1314 "accuracy": 99.8845,
1315 "alpha_accuracy": 92.4151315 "alpha_accuracy": 100.0
1316 },1316 },
1317 {1317 {
1318 "frame": 10,1318 "frame": 10,
1319 "label": "Right.MtlStdInputs.Transmittance.AlphaDetail=0.5861, Top.MtlStdInputs.Transmittance.Saturation=0.56722",1319 "label": "Right.MtlStdInputs.Transmittance.AlphaDetail=0.5861, Top.MtlStdInputs.Transmittance.Saturation=0.56722",
1320 "accuracy": 97.8672,1320 "accuracy": 99.8845,
1321 "alpha_accuracy": 92.4151321 "alpha_accuracy": 100.0
1322 },1322 },
1323 {1323 {
1324 "frame": 11,1324 "frame": 11,
...@@ -1496,47 +1496,47 @@...@@ -1496,47 +1496,47 @@
1496 "category": "Transform, Warp & Framing"1496 "category": "Transform, Warp & Framing"
1497 },1497 },
1498 "DaySky": {1498 "DaySky": {
1499 "mean_accuracy": 98.8731,1499 "mean_accuracy": 99.8635,
1500 "min_accuracy": 93.8147,1500 "min_accuracy": 99.3055,
1501 "mean_alpha_accuracy": 100.0,1501 "mean_alpha_accuracy": 100.0,
1502 "min_alpha_accuracy": 100.0,1502 "min_alpha_accuracy": 100.0,
1503 "frames": 12,1503 "frames": 12,
1504 "timestamp": "2026-12-01T15:40:16Z",1504 "timestamp": "2026-12-01T23:48:02Z",
1505 "per_frame": [1505 "per_frame": [
1506 {1506 {
1507 "frame": 0,1507 "frame": 0,
1508 "label": "defaults",1508 "label": "defaults",
1509 "accuracy": 99.0831,1509 "accuracy": 99.8897,
1510 "alpha_accuracy": 100.01510 "alpha_accuracy": 100.0
1511 },1511 },
1512 {1512 {
1513 "frame": 1,1513 "frame": 1,
1514 "label": "Day=17, Circumsolar.Intensity=0.74033",1514 "label": "Day=17, Circumsolar.Intensity=0.74033",
1515 "accuracy": 99.1467,1515 "accuracy": 99.9022,
1516 "alpha_accuracy": 100.01516 "alpha_accuracy": 100.0
1517 },1517 },
1518 {1518 {
1519 "frame": 2,1519 "frame": 2,
1520 "label": "mask: ApplyMaskInverted=1, MultiplyByMask=1, FitMask=Stretch, MaskChannel=5, MaskLow=0.90546, MaskHigh=0.89202, MaskClipBlack=0, MaskClipWhite=0, Horizon.Brightness=0.6, Latitude=74.84104, Turbidity=0.32029",1520 "label": "mask: ApplyMaskInverted=1, MultiplyByMask=1, FitMask=Stretch, MaskChannel=5, MaskLow=0.90546, MaskHigh=0.89202, MaskClipBlack=0, MaskClipWhite=0, Horizon.Brightness=0.6, Latitude=74.84104, Turbidity=0.32029",
1521 "accuracy": 99.5588,1521 "accuracy": 99.8984,
1522 "alpha_accuracy": 100.01522 "alpha_accuracy": 100.0
1523 },1523 },
1524 {1524 {
1525 "frame": 3,1525 "frame": 3,
1526 "label": "Time=22.45137",1526 "label": "Time=22.45137",
1527 "accuracy": 93.8147,1527 "accuracy": 99.3055,
1528 "alpha_accuracy": 100.01528 "alpha_accuracy": 100.0
1529 },1529 },
1530 {1530 {
1531 "frame": 4,1531 "frame": 4,
1532 "label": "GlobalIn=144, Exposure=0.87893",1532 "label": "GlobalIn=144, Exposure=0.87893",
1533 "accuracy": 99.1135,1533 "accuracy": 99.892,
1534 "alpha_accuracy": 100.01534 "alpha_accuracy": 100.0
1535 },1535 },
1536 {1536 {
1537 "frame": 5,1537 "frame": 5,
1538 "label": "Longitude=143.9376, Month=September, Circumsolar.Width=0.20021",1538 "label": "Longitude=143.9376, Month=September, Circumsolar.Width=0.20021",
1539 "accuracy": 99.4673,1539 "accuracy": 99.8696,
1540 "alpha_accuracy": 100.01540 "alpha_accuracy": 100.0
1541 },1541 },
1542 {1542 {
...@@ -1554,25 +1554,25 @@...@@ -1554,25 +1554,25 @@
1554 {1554 {
1555 "frame": 8,1555 "frame": 8,
1556 "label": "GlobalOut=548, Day=27, Circumsolar.Intensity=0.12047",1556 "label": "GlobalOut=548, Day=27, Circumsolar.Intensity=0.12047",
1557 "accuracy": 99.3797,1557 "accuracy": 99.9408,
1558 "alpha_accuracy": 100.01558 "alpha_accuracy": 100.0
1559 },1559 },
1560 {1560 {
1561 "frame": 9,1561 "frame": 9,
1562 "label": "Horizon.Brightness=0.90014",1562 "label": "Horizon.Brightness=0.90014",
1563 "accuracy": 99.1079,1563 "accuracy": 99.888,
1564 "alpha_accuracy": 100.01564 "alpha_accuracy": 100.0
1565 },1565 },
1566 {1566 {
1567 "frame": 10,1567 "frame": 10,
1568 "label": "Latitude=70.22675, Turbidity=0.26902",1568 "label": "Latitude=70.22675, Turbidity=0.26902",
1569 "accuracy": 99.4541,1569 "accuracy": 99.9051,
1570 "alpha_accuracy": 100.01570 "alpha_accuracy": 100.0
1571 },1571 },
1572 {1572 {
1573 "frame": 11,1573 "frame": 11,
1574 "label": "Day=23, Circumsolar.Intensity=0.90625, Horizon.Brightness=0.19732, Latitude=38.59997, Turbidity=0.83761, Time=21.22089, GlobalIn=444, Exposure=0.25907, Longitude=95.61617, Month=May",1574 "label": "Day=23, Circumsolar.Intensity=0.90625, Horizon.Brightness=0.19732, Latitude=38.59997, Turbidity=0.83761, Time=21.22089, GlobalIn=444, Exposure=0.25907, Longitude=95.61617, Month=May",
1575 "accuracy": 98.3517,1575 "accuracy": 99.8711,
1576 "alpha_accuracy": 100.01576 "alpha_accuracy": 100.0
1577 }1577 }
1578 ],1578 ],
...@@ -2492,12 +2492,12 @@...@@ -2492,12 +2492,12 @@
2492 "category": "Generators"2492 "category": "Generators"
2493 },2493 },
2494 "FilmGrain": {2494 "FilmGrain": {
2495 "mean_accuracy": 96.2094,2495 "mean_accuracy": 96.3089,
2496 "min_accuracy": 91.7395,2496 "min_accuracy": 91.7395,
2497 "mean_alpha_accuracy": 100.0,2497 "mean_alpha_accuracy": 100.0,
2498 "min_alpha_accuracy": 100.0,2498 "min_alpha_accuracy": 100.0,
2499 "frames": 12,2499 "frames": 12,
2500 "timestamp": "2026-12-01T18:59:00Z",2500 "timestamp": "2026-12-01T23:49:26Z",
2501 "per_frame": [2501 "per_frame": [
2502 {2502 {
2503 "frame": 0,2503 "frame": 0,
...@@ -2514,37 +2514,37 @@...@@ -2514,37 +2514,37 @@
2514 {2514 {
2515 "frame": 2,2515 "frame": 2,
2516 "label": "mask: ApplyMaskInverted=1, MultiplyByMask=1, FitMask=Stretch, MaskChannel=1, MaskLow=0.83829, MaskHigh=0.27302, MaskClipBlack=0, MaskClipWhite=0, GreenYSize=2.56413, MasterXSize=2.07301, RedRoughness=4.73538",2516 "label": "mask: ApplyMaskInverted=1, MultiplyByMask=1, FitMask=Stretch, MaskChannel=1, MaskLow=0.83829, MaskHigh=0.27302, MaskClipBlack=0, MaskClipWhite=0, GreenYSize=2.56413, MasterXSize=2.07301, RedRoughness=4.73538",
2517 "accuracy": 96.5892,2517 "accuracy": 96.587,
2518 "alpha_accuracy": 100.02518 "alpha_accuracy": 100.0
2519 },2519 },
2520 {2520 {
2521 "frame": 3,2521 "frame": 3,
2522 "label": "BlueXSize=1.46911",2522 "label": "BlueXSize=1.46911",
2523 "accuracy": 96.632,2523 "accuracy": 96.6373,
2524 "alpha_accuracy": 100.02524 "alpha_accuracy": 100.0
2525 },2525 },
2526 {2526 {
2527 "frame": 4,2527 "frame": 4,
2528 "label": "RedYSize=3.4556, GreenXSize=1.41648",2528 "label": "RedYSize=3.4556, GreenXSize=1.41648",
2529 "accuracy": 96.6088,2529 "accuracy": 96.6201,
2530 "alpha_accuracy": 100.02530 "alpha_accuracy": 100.0
2531 },2531 },
2532 {2532 {
2533 "frame": 5,2533 "frame": 5,
2534 "label": "TimeLockSeed=1, GreenOffset=-0.0103, BlueStrength=4.07106",2534 "label": "TimeLockSeed=1, GreenOffset=-0.0103, BlueStrength=4.07106",
2535 "accuracy": 95.6434,2535 "accuracy": 96.6551,
2536 "alpha_accuracy": 100.02536 "alpha_accuracy": 100.0
2537 },2537 },
2538 {2538 {
2539 "frame": 6,2539 "frame": 6,
2540 "label": "BlueOffset=-0.02686",2540 "label": "BlueOffset=-0.02686",
2541 "accuracy": 96.6281,2541 "accuracy": 96.6155,
2542 "alpha_accuracy": 100.02542 "alpha_accuracy": 100.0
2543 },2543 },
2544 {2544 {
2545 "frame": 7,2545 "frame": 7,
2546 "label": "RedXSize=1.93192, LogProcessing=0",2546 "label": "RedXSize=1.93192, LogProcessing=0",
2547 "accuracy": 95.6357,2547 "accuracy": 95.8466,
2548 "alpha_accuracy": 100.02548 "alpha_accuracy": 100.0
2549 },2549 },
2550 {2550 {
...@@ -2568,7 +2568,7 @@...@@ -2568,7 +2568,7 @@
2568 {2568 {
2569 "frame": 11,2569 "frame": 11,
2570 "label": "LockSizeXY=0, Complexity=7, GreenYSize=0.55074, MasterXSize=4.65962, RedRoughness=2.72199, BlueXSize=1.21276, RedYSize=0.35629, GreenXSize=2.91717, TimeLockSeed=1, GreenOffset=-0.06399",2570 "label": "LockSizeXY=0, Complexity=7, GreenYSize=0.55074, MasterXSize=4.65962, RedRoughness=2.72199, BlueXSize=1.21276, RedYSize=0.35629, GreenXSize=2.91717, TimeLockSeed=1, GreenOffset=-0.06399",
2571 "accuracy": 96.6445,2571 "accuracy": 96.6146,
2572 "alpha_accuracy": 100.02572 "alpha_accuracy": 100.0
2573 }2573 }
2574 ],2574 ],
...@@ -3737,12 +3737,12 @@...@@ -3737,12 +3737,12 @@
3737 "category": "3D Pipeline"3737 "category": "3D Pipeline"
3738 },3738 },
3739 "MtlBlinn": {3739 "MtlBlinn": {
3740 "mean_accuracy": 99.1714,3740 "mean_accuracy": 99.5709,
3741 "min_accuracy": 95.8793,3741 "min_accuracy": 97.8704,
3742 "mean_alpha_accuracy": 94.9089,3742 "mean_alpha_accuracy": 94.9089,
3743 "min_alpha_accuracy": 48.6462,3743 "min_alpha_accuracy": 48.6462,
3744 "frames": 12,3744 "frames": 12,
3745 "timestamp": "2026-12-01T17:48:05Z",3745 "timestamp": "2026-12-01T23:49:17Z",
3746 "per_frame": [3746 "per_frame": [
3747 {3747 {
3748 "frame": 0,3748 "frame": 0,
...@@ -3765,7 +3765,7 @@...@@ -3765,7 +3765,7 @@
3765 {3765 {
3766 "frame": 3,3766 "frame": 3,
3767 "label": "Diffuse.Opacity=0.93702",3767 "label": "Diffuse.Opacity=0.93702",
3768 "accuracy": 97.0419,3768 "accuracy": 98.7846,
3769 "alpha_accuracy": 96.43663769 "alpha_accuracy": 96.4366
3770 },3770 },
3771 {3771 {
...@@ -3813,7 +3813,7 @@...@@ -3813,7 +3813,7 @@
3813 {3813 {
3814 "frame": 11,3814 "frame": 11,
3815 "label": "Specular.Color.Red=0.78044, Specular.Color.Green=0.64395, Diffuse.Color.Blue=0.83415, Diffuse.Color.Green=0.50219, Specular.Intensity=0.71189, Diffuse.Opacity=0.88575, Transmittance.ColorDetail=0.84589, Specular.Color.Blue=0.58158, ReceivesShadows=0, Transmittance.Saturation=0.70342",3815 "label": "Specular.Color.Red=0.78044, Specular.Color.Green=0.64395, Diffuse.Color.Blue=0.83415, Diffuse.Color.Green=0.50219, Specular.Intensity=0.71189, Diffuse.Opacity=0.88575, Transmittance.ColorDetail=0.84589, Specular.Color.Blue=0.58158, ReceivesShadows=0, Transmittance.Saturation=0.70342",
3816 "accuracy": 95.8793,3816 "accuracy": 98.9311,
3817 "alpha_accuracy": 93.82353817 "alpha_accuracy": 93.8235
3818 }3818 }
3819 ],3819 ],
...@@ -3903,12 +3903,12 @@...@@ -3903,12 +3903,12 @@
3903 "category": "3D Pipeline"3903 "category": "3D Pipeline"
3904 },3904 },
3905 "MtlPhong": {3905 "MtlPhong": {
3906 "mean_accuracy": 98.8657,3906 "mean_accuracy": 99.4048,
3907 "min_accuracy": 91.2276,3907 "min_accuracy": 96.5864,
3908 "mean_alpha_accuracy": 91.0109,3908 "mean_alpha_accuracy": 91.0109,
3909 "min_alpha_accuracy": 8.5935,3909 "min_alpha_accuracy": 8.5935,
3910 "frames": 12,3910 "frames": 12,
3911 "timestamp": "2026-12-01T17:48:14Z",3911 "timestamp": "2026-12-01T23:49:09Z",
3912 "per_frame": [3912 "per_frame": [
3913 {3913 {
3914 "frame": 0,3914 "frame": 0,
...@@ -3949,7 +3949,7 @@...@@ -3949,7 +3949,7 @@
3949 {3949 {
3950 "frame": 6,3950 "frame": 6,
3951 "label": "Diffuse.Opacity=0.73887",3951 "label": "Diffuse.Opacity=0.73887",
3952 "accuracy": 91.2276,3952 "accuracy": 97.6971,
3953 "alpha_accuracy": 87.96753953 "alpha_accuracy": 87.9675
3954 },3954 },
3955 {3955 {
...@@ -4235,84 +4235,84 @@...@@ -4235,84 +4235,84 @@
4235 "category": "Time, Routing & Utility"4235 "category": "Time, Routing & Utility"
4236 },4236 },
4237 "Plasma": {4237 "Plasma": {
4238 "mean_accuracy": 98.0516,4238 "mean_accuracy": 99.8692,
4239 "min_accuracy": 77.8272,4239 "min_accuracy": 98.4626,
4240 "mean_alpha_accuracy": 98.0419,4240 "mean_alpha_accuracy": 99.8702,
4241 "min_alpha_accuracy": 77.6996,4241 "min_alpha_accuracy": 98.4736,
4242 "frames": 12,4242 "frames": 12,
4243 "timestamp": "2026-12-01T15:45:00Z",4243 "timestamp": "2026-12-01T23:47:54Z",
4244 "per_frame": [4244 "per_frame": [
4245 {4245 {
4246 "frame": 0,4246 "frame": 0,
4247 "label": "defaults",4247 "label": "defaults",
4248 "accuracy": 99.946,4248 "accuracy": 99.9981,
4249 "alpha_accuracy": 99.94694249 "alpha_accuracy": 99.9984
4250 },4250 },
4251 {4251 {
4252 "frame": 1,4252 "frame": 1,
4253 "label": "Phase=0.21449, Operation=2",4253 "label": "Phase=0.21449, Operation=2",
4254 "accuracy": 99.3417,4254 "accuracy": 99.9882,
4255 "alpha_accuracy": 99.34924255 "alpha_accuracy": 99.9873
4256 },4256 },
4257 {4257 {
4258 "frame": 2,4258 "frame": 2,
4259 "label": "mask: ApplyMaskInverted=1, MultiplyByMask=1, FitMask=Width, MaskChannel=0, MaskLow=0.67719, MaskHigh=0.45798, MaskClipBlack=0, MaskClipWhite=0, Circle1Scale=2.31527, GlobalOut=320, Circle1Center=[0.3014, 0.5722]",4259 "label": "mask: ApplyMaskInverted=1, MultiplyByMask=1, FitMask=Width, MaskChannel=0, MaskLow=0.67719, MaskHigh=0.45798, MaskClipBlack=0, MaskClipWhite=0, Circle1Scale=2.31527, GlobalOut=320, Circle1Center=[0.3014, 0.5722]",
4260 "accuracy": 99.9466,4260 "accuracy": 99.998,
4261 "alpha_accuracy": 99.94584261 "alpha_accuracy": 99.9979
4262 },4262 },
4263 {4263 {
4264 "frame": 3,4264 "frame": 3,
4265 "label": "Circle4Type=1",4265 "label": "Circle4Type=1",
4266 "accuracy": 99.8825,4266 "accuracy": 99.998,
4267 "alpha_accuracy": 99.88364267 "alpha_accuracy": 99.9979
4268 },4268 },
4269 {4269 {
4270 "frame": 4,4270 "frame": 4,
4271 "label": "Circle4Scale=6.22018, Scale=1.53596",4271 "label": "Circle4Scale=6.22018, Scale=1.53596",
4272 "accuracy": 99.9498,4272 "accuracy": 99.9979,
4273 "alpha_accuracy": 99.95054273 "alpha_accuracy": 99.9979
4274 },4274 },
4275 {4275 {
4276 "frame": 5,4276 "frame": 5,
4277 "label": "AlphaPhase=0.33794, Circle2Center=[0.9242, 0.4649], Circle3Center=[0.62, 0.423]",4277 "label": "AlphaPhase=0.33794, Circle2Center=[0.9242, 0.4649], Circle3Center=[0.62, 0.423]",
4278 "accuracy": 99.9473,4278 "accuracy": 99.998,
4279 "alpha_accuracy": 99.9474279 "alpha_accuracy": 99.9982
4280 },4280 },
4281 {4281 {
4282 "frame": 6,4282 "frame": 6,
4283 "label": "Circle3Type=0",4283 "label": "Circle3Type=0",
4284 "accuracy": 99.9432,4284 "accuracy": 99.998,
4285 "alpha_accuracy": 99.94474285 "alpha_accuracy": 99.9981
4286 },4286 },
4287 {4287 {
4288 "frame": 7,4288 "frame": 7,
4289 "label": "RedPhase=0.39531, Circle4Center=[0.2463, 0.1526]",4289 "label": "RedPhase=0.39531, Circle4Center=[0.2463, 0.1526]",
4290 "accuracy": 99.9467,4290 "accuracy": 99.998,
4291 "alpha_accuracy": 99.94724291 "alpha_accuracy": 99.9981
4292 },4292 },
4293 {4293 {
4294 "frame": 8,4294 "frame": 8,
4295 "label": "Circle1Type=0, Circle3Scale=6.13489, Circle2Type=0",4295 "label": "Circle1Type=0, Circle3Scale=6.13489, Circle2Type=0",
4296 "accuracy": 99.9929,4296 "accuracy": 99.998,
4297 "alpha_accuracy": 99.99274297 "alpha_accuracy": 99.9981
4298 },4298 },
4299 {4299 {
4300 "frame": 9,4300 "frame": 9,
4301 "label": "Circle2Scale=9.01932",4301 "label": "Circle2Scale=9.01932",
4302 "accuracy": 99.9485,4302 "accuracy": 99.998,
4303 "alpha_accuracy": 99.94844303 "alpha_accuracy": 99.998
4304 },4304 },
4305 {4305 {
4306 "frame": 10,4306 "frame": 10,
4307 "label": "BluePhase=0.16082, GreenPhase=0.31153",4307 "label": "BluePhase=0.16082, GreenPhase=0.31153",
4308 "accuracy": 99.9466,4308 "accuracy": 99.9981,
4309 "alpha_accuracy": 99.94694309 "alpha_accuracy": 99.9984
4310 },4310 },
4311 {4311 {
4312 "frame": 11,4312 "frame": 11,
4313 "label": "Phase=0.3804, Operation=3, Circle1Scale=7.48849, GlobalOut=837, Circle1Center=[0.0597, 0.8826], Circle4Type=1, Circle4Scale=9.22157, Scale=4.53735, AlphaPhase=0.06949, Circle2Center=[0.7631, 0.8558]",4313 "label": "Phase=0.3804, Operation=3, Circle1Scale=7.48849, GlobalOut=837, Circle1Center=[0.0597, 0.8826], Circle4Type=1, Circle4Scale=9.22157, Scale=4.53735, AlphaPhase=0.06949, Circle2Center=[0.7631, 0.8558]",
4314 "accuracy": 77.8272,4314 "accuracy": 98.4626,
4315 "alpha_accuracy": 77.69964315 "alpha_accuracy": 98.4736
4316 }4316 }
4317 ],4317 ],
4318 "category": "Generators"4318 "category": "Generators"
...@@ -5314,84 +5314,84 @@...@@ -5314,84 +5314,84 @@
5314 "category": "Blur, Sharpen & Glow"5314 "category": "Blur, Sharpen & Glow"
5315 },5315 },
5316 "Text3D": {5316 "Text3D": {
5317 "mean_accuracy": 97.9281,5317 "mean_accuracy": 98.5185,
5318 "min_accuracy": 93.6396,5318 "min_accuracy": 95.337,
5319 "mean_alpha_accuracy": 97.9066,5319 "mean_alpha_accuracy": 98.5028,
5320 "min_alpha_accuracy": 93.6396,5320 "min_alpha_accuracy": 95.337,
5321 "frames": 12,5321 "frames": 12,
5322 "timestamp": "2026-12-01T18:57:44Z",5322 "timestamp": "2026-12-01T23:48:17Z",
5323 "per_frame": [5323 "per_frame": [
5324 {5324 {
5325 "frame": 0,5325 "frame": 0,
5326 "label": "defaults",5326 "label": "defaults",
5327 "accuracy": 98.4733,5327 "accuracy": 98.8826,
5328 "alpha_accuracy": 98.47335328 "alpha_accuracy": 98.8826
5329 },5329 },
5330 {5330 {
5331 "frame": 1,5331 "frame": 1,
5332 "label": "Level1=1, MiterLimit1=2.25293",5332 "label": "Level1=1, MiterLimit1=2.25293",
5333 "accuracy": 98.4733,5333 "accuracy": 98.8826,
5334 "alpha_accuracy": 98.47335334 "alpha_accuracy": 98.8826
5335 },5335 },
5336 {5336 {
5337 "frame": 2,5337 "frame": 2,
5338 "label": "HorizontallyJustified=0.26834, Red1Clone=0.1994, CleanIntersections1=1",5338 "label": "HorizontallyJustified=0.26834, Red1Clone=0.1994, CleanIntersections1=1",
5339 "accuracy": 98.4733,5339 "accuracy": 98.8826,
5340 "alpha_accuracy": 98.47335340 "alpha_accuracy": 98.8826
5341 },5341 },
5342 {5342 {
5343 "frame": 3,5343 "frame": 3,
5344 "label": "LinePivot=[0.2658, -0.0958]",5344 "label": "LinePivot=[0.2658, -0.0958]",
5345 "accuracy": 98.4733,5345 "accuracy": 98.8826,
5346 "alpha_accuracy": 98.47335346 "alpha_accuracy": 98.8826
5347 },5347 },
5348 {5348 {
5349 "frame": 4,5349 "frame": 4,
5350 "label": "CharacterSizeX=1.3364, ImageSource1=1",5350 "label": "CharacterSizeX=1.3364, ImageSource1=1",
5351 "accuracy": 98.5892,5351 "accuracy": 99.1562,
5352 "alpha_accuracy": 98.58925352 "alpha_accuracy": 99.1562
5353 },5353 },
5354 {5354 {
5355 "frame": 5,5355 "frame": 5,
5356 "label": "LineSizeY=4.18055, BlueBevel=0.54337, UseOneMaterial=0",5356 "label": "LineSizeY=4.18055, BlueBevel=0.54337, UseOneMaterial=0",
5357 "accuracy": 93.6396,5357 "accuracy": 95.337,
5358 "alpha_accuracy": 93.63965358 "alpha_accuracy": 95.337
5359 },5359 },
5360 {5360 {
5361 "frame": 6,5361 "frame": 6,
5362 "label": "VerticallyJustified=0.22981",5362 "label": "VerticallyJustified=0.22981",
5363 "accuracy": 98.4733,5363 "accuracy": 98.8826,
5364 "alpha_accuracy": 98.47335364 "alpha_accuracy": 98.8826
5365 },5365 },
5366 {5366 {
5367 "frame": 7,5367 "frame": 7,
5368 "label": "ScrollPosition=0.71693, Overlap1=1",5368 "label": "ScrollPosition=0.71693, Overlap1=1",
5369 "accuracy": 98.4733,5369 "accuracy": 98.8826,
5370 "alpha_accuracy": 98.47335370 "alpha_accuracy": 98.8826
5371 },5371 },
5372 {5372 {
5373 "frame": 8,5373 "frame": 8,
5374 "label": "SpecularRed=0.45963, ColorBrush1=14, Clip=1",5374 "label": "SpecularRed=0.45963, ColorBrush1=14, Clip=1",
5375 "accuracy": 98.4733,5375 "accuracy": 98.8826,
5376 "alpha_accuracy": 98.47335376 "alpha_accuracy": 98.8826
5377 },5377 },
5378 {5378 {
5379 "frame": 9,5379 "frame": 9,
5380 "label": "AlphaBevel=0.47633",5380 "label": "AlphaBevel=0.47633",
5381 "accuracy": 98.4733,5381 "accuracy": 98.8826,
5382 "alpha_accuracy": 98.47335382 "alpha_accuracy": 98.8826
5383 },5383 },
5384 {5384 {
5385 "frame": 10,5385 "frame": 10,
5386 "label": "SelectElement=1, Green1=0.35516",5386 "label": "SelectElement=1, Green1=0.35516",
5387 "accuracy": 98.7313,5387 "accuracy": 99.0704,
5388 "alpha_accuracy": 98.47335388 "alpha_accuracy": 98.8826
5389 },5389 },
5390 {5390 {
5391 "frame": 11,5391 "frame": 11,
5392 "label": "Level1=1, MiterLimit1=3.74615, HorizontallyJustified=0.78566, Red1Clone=0.71672, CleanIntersections1=1, LinePivot=[0.235, -0.1265], CharacterSizeX=2.83709, ImageSource1=2, LineSizeY=2.83828, BlueBevel=0.27492",5392 "label": "Level1=1, MiterLimit1=3.74615, HorizontallyJustified=0.78566, Red1Clone=0.71672, CleanIntersections1=1, LinePivot=[0.235, -0.1265], CharacterSizeX=2.83709, ImageSource1=2, LineSizeY=2.83828, BlueBevel=0.27492",
5393 "accuracy": 96.3905,5393 "accuracy": 97.5975,
5394 "alpha_accuracy": 96.39055394 "alpha_accuracy": 97.5975
5395 }5395 }
5396 ],5396 ],
5397 "category": "3D Pipeline"5397 "category": "3D Pipeline"
...@@ -6310,333 +6310,333 @@...@@ -6310,333 +6310,333 @@
6310 "category": "Masks"6310 "category": "Masks"
6311 },6311 },
6312 "pBounce": {6312 "pBounce": {
6313 "mean_accuracy": 98.5555,6313 "mean_accuracy": 99.8083,
6314 "min_accuracy": 98.1757,6314 "min_accuracy": 99.6713,
6315 "mean_alpha_accuracy": 98.5555,6315 "mean_alpha_accuracy": 99.8083,
6316 "min_alpha_accuracy": 98.1757,6316 "min_alpha_accuracy": 99.6713,
6317 "frames": 12,6317 "frames": 12,
6318 "timestamp": "2026-12-01T15:48:22Z",6318 "timestamp": "2026-12-01T23:48:48Z",
6319 "per_frame": [6319 "per_frame": [
6320 {6320 {
6321 "frame": 0,6321 "frame": 0,
6322 "label": "defaults",6322 "label": "defaults",
6323 "accuracy": 99.119,6323 "accuracy": 99.9599,
6324 "alpha_accuracy": 99.1196324 "alpha_accuracy": 99.9599
6325 },6325 },
6326 {6326 {
6327 "frame": 1,6327 "frame": 1,
6328 "label": "Roughness=9.94739, Set13=0",6328 "label": "Roughness=9.94739, Set13=0",
6329 "accuracy": 98.8851,6329 "accuracy": 99.9249,
6330 "alpha_accuracy": 98.88516330 "alpha_accuracy": 99.9249
6331 },6331 },
6332 {6332 {
6333 "frame": 2,6333 "frame": 2,
6334 "label": "Set1=0, Set6=0, Set19=0",6334 "label": "Set1=0, Set6=0, Set19=0",
6335 "accuracy": 98.8063,6335 "accuracy": 99.8943,
6336 "alpha_accuracy": 98.80636336 "alpha_accuracy": 99.8943
6337 },6337 },
6338 {6338 {
6339 "frame": 3,6339 "frame": 3,
6340 "label": "Set25=0",6340 "label": "Set25=0",
6341 "accuracy": 98.7001,6341 "accuracy": 99.8616,
6342 "alpha_accuracy": 98.70016342 "alpha_accuracy": 99.8616
6343 },6343 },
6344 {6344 {
6345 "frame": 4,6345 "frame": 4,
6346 "label": "Set28=0, Set21=0",6346 "label": "Set28=0, Set21=0",
6347 "accuracy": 98.5436,6347 "accuracy": 99.8464,
6348 "alpha_accuracy": 98.54366348 "alpha_accuracy": 99.8464
6349 },6349 },
6350 {6350 {
6351 "frame": 5,6351 "frame": 5,
6352 "label": "Set27=0, Set5=0, Set20=0",6352 "label": "Set27=0, Set5=0, Set20=0",
6353 "accuracy": 98.5054,6353 "accuracy": 99.8142,
6354 "alpha_accuracy": 98.50546354 "alpha_accuracy": 99.8142
6355 },6355 },
6356 {6356 {
6357 "frame": 6,6357 "frame": 6,
6358 "label": "SetMode=Ignore",6358 "label": "SetMode=Ignore",
6359 "accuracy": 98.5573,6359 "accuracy": 99.7892,
6360 "alpha_accuracy": 98.55736360 "alpha_accuracy": 99.7892
6361 },6361 },
6362 {6362 {
6363 "frame": 7,6363 "frame": 7,
6364 "label": "EndAge=0.49319, Variance=0.31734",6364 "label": "EndAge=0.49319, Variance=0.31734",
6365 "accuracy": 98.4019,6365 "accuracy": 99.765,
6366 "alpha_accuracy": 98.40196366 "alpha_accuracy": 99.765
6367 },6367 },
6368 {6368 {
6369 "frame": 8,6369 "frame": 8,
6370 "label": "RandomSeed=743, Set29=0, Set4=0",6370 "label": "RandomSeed=743, Set29=0, Set4=0",
6371 "accuracy": 98.3643,6371 "accuracy": 99.7458,
6372 "alpha_accuracy": 98.36436372 "alpha_accuracy": 99.7458
6373 },6373 },
6374 {6374 {
6375 "frame": 9,6375 "frame": 9,
6376 "label": "Set22=0",6376 "label": "Set22=0",
6377 "accuracy": 98.3073,6377 "accuracy": 99.7216,
6378 "alpha_accuracy": 98.30736378 "alpha_accuracy": 99.7216
6379 },6379 },
6380 {6380 {
6381 "frame": 10,6381 "frame": 10,
6382 "label": "LineRgn.End.Y=-1.35171, Set11=0",6382 "label": "LineRgn.End.Y=-1.35171, Set11=0",
6383 "accuracy": 98.1757,6383 "accuracy": 99.7053,
6384 "alpha_accuracy": 98.17576384 "alpha_accuracy": 99.7053
6385 },6385 },
6386 {6386 {
6387 "frame": 11,6387 "frame": 11,
6388 "label": "Roughness=13.26565, Set13=0, Set1=0, Set6=0, Set19=0, Set25=0, Set28=0, Set21=0, Set27=0, Set5=0",6388 "label": "Roughness=13.26565, Set13=0, Set1=0, Set6=0, Set19=0, Set25=0, Set28=0, Set21=0, Set27=0, Set5=0",
6389 "accuracy": 98.3003,6389 "accuracy": 99.6713,
6390 "alpha_accuracy": 98.30036390 "alpha_accuracy": 99.6713
6391 }6391 }
6392 ],6392 ],
6393 "category": "Particles"6393 "category": "Particles"
6394 },6394 },
6395 "pDirectionalForce": {6395 "pDirectionalForce": {
6396 "mean_accuracy": 98.4816,6396 "mean_accuracy": 99.8136,
6397 "min_accuracy": 97.9117,6397 "min_accuracy": 99.708,
6398 "mean_alpha_accuracy": 98.4816,6398 "mean_alpha_accuracy": 99.8136,
6399 "min_alpha_accuracy": 97.9117,6399 "min_alpha_accuracy": 99.708,
6400 "frames": 12,6400 "frames": 12,
6401 "timestamp": "2026-12-01T15:48:28Z",6401 "timestamp": "2026-12-01T23:48:36Z",
6402 "per_frame": [6402 "per_frame": [
6403 {6403 {
6404 "frame": 0,6404 "frame": 0,
6405 "label": "defaults",6405 "label": "defaults",
6406 "accuracy": 99.119,6406 "accuracy": 99.9599,
6407 "alpha_accuracy": 99.1196407 "alpha_accuracy": 99.9599
6408 },6408 },
6409 {6409 {
6410 "frame": 1,6410 "frame": 1,
6411 "label": "Probability=0.84725, Set26=0",6411 "label": "Probability=0.84725, Set26=0",
6412 "accuracy": 98.8805,6412 "accuracy": 99.9288,
6413 "alpha_accuracy": 98.88056413 "alpha_accuracy": 99.9288
6414 },6414 },
6415 {6415 {
6416 "frame": 2,6416 "frame": 2,
6417 "label": "Strength=0.10884, Set21=0, Set13=0",6417 "label": "Strength=0.10884, Set21=0, Set13=0",
6418 "accuracy": 98.7972,6418 "accuracy": 99.8979,
6419 "alpha_accuracy": 98.79726419 "alpha_accuracy": 99.8979
6420 },6420 },
6421 {6421 {
6422 "frame": 3,6422 "frame": 3,
6423 "label": "Set4=0",6423 "label": "Set4=0",
6424 "accuracy": 98.7043,6424 "accuracy": 99.8778,
6425 "alpha_accuracy": 98.70436425 "alpha_accuracy": 99.8778
6426 },6426 },
6427 {6427 {
6428 "frame": 4,6428 "frame": 4,
6429 "label": "EndAge=0.32638, Set3=0",6429 "label": "EndAge=0.32638, Set3=0",
6430 "accuracy": 98.5449,6430 "accuracy": 99.8432,
6431 "alpha_accuracy": 98.54496431 "alpha_accuracy": 99.8432
6432 },6432 },
6433 {6433 {
6434 "frame": 5,6434 "frame": 5,
6435 "label": "Set6=0, Set30=0, Set32=0",6435 "label": "Set6=0, Set30=0, Set32=0",
6436 "accuracy": 98.4607,6436 "accuracy": 99.8102,
6437 "alpha_accuracy": 98.46076437 "alpha_accuracy": 99.8102
6438 },6438 },
6439 {6439 {
6440 "frame": 6,6440 "frame": 6,
6441 "label": "RegionMode=Ignore",6441 "label": "RegionMode=Ignore",
6442 "accuracy": 98.4911,6442 "accuracy": 99.7909,
6443 "alpha_accuracy": 98.49116443 "alpha_accuracy": 99.7909
6444 },6444 },
6445 {6445 {
6446 "frame": 7,6446 "frame": 7,
6447 "label": "StartAge=0.58407, Set5=0",6447 "label": "StartAge=0.58407, Set5=0",
6448 "accuracy": 98.3235,6448 "accuracy": 99.7666,
6449 "alpha_accuracy": 98.32356449 "alpha_accuracy": 99.7666
6450 },6450 },
6451 {6451 {
6452 "frame": 8,6452 "frame": 8,
6453 "label": "Set25=0, Set14=0, Set9=0",6453 "label": "Set25=0, Set14=0, Set9=0",
6454 "accuracy": 98.2251,6454 "accuracy": 99.7358,
6455 "alpha_accuracy": 98.22516455 "alpha_accuracy": 99.7358
6456 },6456 },
6457 {6457 {
6458 "frame": 9,6458 "frame": 9,
6459 "label": "Set10=0",6459 "label": "Set10=0",
6460 "accuracy": 98.1312,6460 "accuracy": 99.7281,
6461 "alpha_accuracy": 98.13126461 "alpha_accuracy": 99.7281
6462 },6462 },
6463 {6463 {
6464 "frame": 10,6464 "frame": 10,
6465 "label": "Set18=0, Set31=0",6465 "label": "Set18=0, Set31=0",
6466 "accuracy": 97.9117,6466 "accuracy": 99.7164,
6467 "alpha_accuracy": 97.91176467 "alpha_accuracy": 99.7164
6468 },6468 },
6469 {6469 {
6470 "frame": 11,6470 "frame": 11,
6471 "label": "Probability=0.09316, Set26=0, Strength=-0.05223, Set21=0, Set13=0, Set4=0, EndAge=0.62652, Set3=0, Set6=0, Set30=0",6471 "label": "Probability=0.09316, Set26=0, Strength=-0.05223, Set21=0, Set13=0, Set4=0, EndAge=0.62652, Set3=0, Set6=0, Set30=0",
6472 "accuracy": 98.1898,6472 "accuracy": 99.708,
6473 "alpha_accuracy": 98.18986473 "alpha_accuracy": 99.708
6474 }6474 }
6475 ],6475 ],
6476 "category": "Particles"6476 "category": "Particles"
6477 },6477 },
6478 "pDrag": {6478 "pDrag": {
6479 "mean_accuracy": 98.6098,6479 "mean_accuracy": 99.8245,
6480 "min_accuracy": 98.31,6480 "min_accuracy": 99.7331,
6481 "mean_alpha_accuracy": 98.6098,6481 "mean_alpha_accuracy": 99.8245,
6482 "min_alpha_accuracy": 98.31,6482 "min_alpha_accuracy": 99.7331,
6483 "frames": 12,6483 "frames": 12,
6484 "timestamp": "2026-12-01T15:48:35Z",6484 "timestamp": "2026-12-01T23:49:01Z",
6485 "per_frame": [6485 "per_frame": [
6486 {6486 {
6487 "frame": 0,6487 "frame": 0,
6488 "label": "defaults",6488 "label": "defaults",
6489 "accuracy": 99.1184,6489 "accuracy": 99.9591,
6490 "alpha_accuracy": 99.11846490 "alpha_accuracy": 99.9591
6491 },6491 },
6492 {6492 {
6493 "frame": 1,6493 "frame": 1,
6494 "label": "Region=CubeRgn, Set2=0",6494 "label": "Region=CubeRgn, Set2=0",
6495 "accuracy": 98.8878,6495 "accuracy": 99.9231,
6496 "alpha_accuracy": 98.88786496 "alpha_accuracy": 99.9231
6497 },6497 },
6498 {6498 {
6499 "frame": 2,6499 "frame": 2,
6500 "label": "Set15=0, Set25=0, Set12=0",6500 "label": "Set15=0, Set25=0, Set12=0",
6501 "accuracy": 98.8104,6501 "accuracy": 99.8991,
6502 "alpha_accuracy": 98.81046502 "alpha_accuracy": 99.8991
6503 },6503 },
6504 {6504 {
6505 "frame": 3,6505 "frame": 3,
6506 "label": "Set13=0",6506 "label": "Set13=0",
6507 "accuracy": 98.7067,6507 "accuracy": 99.8714,
6508 "alpha_accuracy": 98.70676508 "alpha_accuracy": 99.8714
6509 },6509 },
6510 {6510 {
6511 "frame": 4,6511 "frame": 4,
6512 "label": "Set1=0, Set19=0",6512 "label": "Set1=0, Set19=0",
6513 "accuracy": 98.563,6513 "accuracy": 99.8478,
6514 "alpha_accuracy": 98.5636514 "alpha_accuracy": 99.8478
6515 },6515 },
6516 {6516 {
6517 "frame": 5,6517 "frame": 5,
6518 "label": "SpinFriction=0.90166, Set30=0, SetMode=DontAffect",6518 "label": "SpinFriction=0.90166, Set30=0, SetMode=DontAffect",
6519 "accuracy": 98.5434,6519 "accuracy": 99.8246,
6520 "alpha_accuracy": 98.54346520 "alpha_accuracy": 99.8246
6521 },6521 },
6522 {6522 {
6523 "frame": 6,6523 "frame": 6,
6524 "label": "Set3=0",6524 "label": "Set3=0",
6525 "accuracy": 98.6045,6525 "accuracy": 99.7949,
6526 "alpha_accuracy": 98.60456526 "alpha_accuracy": 99.7949
6527 },6527 },
6528 {6528 {
6529 "frame": 7,6529 "frame": 7,
6530 "label": "Set21=0, Probability=0.09181",6530 "label": "Set21=0, Probability=0.09181",
6531 "accuracy": 98.4676,6531 "accuracy": 99.778,
6532 "alpha_accuracy": 98.46766532 "alpha_accuracy": 99.778
6533 },6533 },
6534 {6534 {
6535 "frame": 8,6535 "frame": 8,
6536 "label": "Set20=0, Set16=0, RandomSeed=915",6536 "label": "Set20=0, Set16=0, RandomSeed=915",
6537 "accuracy": 98.4425,6537 "accuracy": 99.7742,
6538 "alpha_accuracy": 98.44256538 "alpha_accuracy": 99.7742
6539 },6539 },
6540 {6540 {
6541 "frame": 9,6541 "frame": 9,
6542 "label": "StartAge=0.05488",6542 "label": "StartAge=0.05488",
6543 "accuracy": 98.4165,6543 "accuracy": 99.7445,
6544 "alpha_accuracy": 98.41656544 "alpha_accuracy": 99.7445
6545 },6545 },
6546 {6546 {
6547 "frame": 10,6547 "frame": 10,
6548 "label": "Set17=0, Set22=0",6548 "label": "Set17=0, Set22=0",
6549 "accuracy": 98.31,6549 "accuracy": 99.7443,
6550 "alpha_accuracy": 98.316550 "alpha_accuracy": 99.7443
6551 },6551 },
6552 {6552 {
6553 "frame": 11,6553 "frame": 11,
6554 "label": "Region=LineRgn, Set2=0, Set15=0, Set25=0, Set12=0, Set13=0, Set1=0, Set19=0, SpinFriction=0.63321, Set30=0",6554 "label": "Region=LineRgn, Set2=0, Set15=0, Set25=0, Set12=0, Set13=0, Set1=0, Set19=0, SpinFriction=0.63321, Set30=0",
6555 "accuracy": 98.4467,6555 "accuracy": 99.7331,
6556 "alpha_accuracy": 98.44676556 "alpha_accuracy": 99.7331
6557 }6557 }
6558 ],6558 ],
6559 "category": "Particles"6559 "category": "Particles"
6560 },6560 },
6561 "pEmitter": {6561 "pEmitter": {
6562 "mean_accuracy": 98.2475,6562 "mean_accuracy": 99.8132,
6563 "min_accuracy": 97.0471,6563 "min_accuracy": 99.6732,
6564 "mean_alpha_accuracy": 98.2482,6564 "mean_alpha_accuracy": 99.8121,
6565 "min_alpha_accuracy": 97.0471,6565 "min_alpha_accuracy": 99.6732,
6566 "frames": 12,6566 "frames": 12,
6567 "timestamp": "2026-12-01T15:48:42Z",6567 "timestamp": "2026-12-01T23:48:24Z",
6568 "per_frame": [6568 "per_frame": [
6569 {6569 {
6570 "frame": 0,6570 "frame": 0,
6571 "label": "defaults",6571 "label": "defaults",
6572 "accuracy": 99.0113,6572 "accuracy": 99.9564,
6573 "alpha_accuracy": 99.01136573 "alpha_accuracy": 99.9564
6574 },6574 },
6575 {6575 {
6576 "frame": 1,6576 "frame": 1,
6577 "label": "Set24=1, Set14=1",6577 "label": "Set24=1, Set14=1",
6578 "accuracy": 98.7924,6578 "accuracy": 99.9309,
6579 "alpha_accuracy": 98.79246579 "alpha_accuracy": 99.9309
6580 },6580 },
6581 {6581 {
6582 "frame": 2,6582 "frame": 2,
6583 "label": "RotationZ=134.28566, RotationXVariance=145.73754, VelocityVariance=0.49077",6583 "label": "RotationZ=134.28566, RotationXVariance=145.73754, VelocityVariance=0.49077",
6584 "accuracy": 97.6235,6584 "accuracy": 99.8807,
6585 "alpha_accuracy": 97.62356585 "alpha_accuracy": 99.8807
6586 },6586 },
6587 {6587 {
6588 "frame": 3,6588 "frame": 3,
6589 "label": "SpinZVariance=90.70891",6589 "label": "SpinZVariance=90.70891",
6590 "accuracy": 98.6042,6590 "accuracy": 99.862,
6591 "alpha_accuracy": 98.60426591 "alpha_accuracy": 99.862
6592 },6592 },
6593 {6593 {
6594 "frame": 4,6594 "frame": 4,
6595 "label": "SphereRgn.Rotate.Z=31.10569, ParticleStyle.RedHigh=-0.43584",6595 "label": "SphereRgn.Rotate.Z=31.10569, ParticleStyle.RedHigh=-0.43584",
6596 "accuracy": 98.6261,6596 "accuracy": 99.8546,
6597 "alpha_accuracy": 98.63466597 "alpha_accuracy": 99.842
6598 },6598 },
6599 {6599 {
6600 "frame": 5,6600 "frame": 5,
6601 "label": "Set18=1, TimeLockSeed=1, Set7=1",6601 "label": "Set18=1, TimeLockSeed=1, Set7=1",
6602 "accuracy": 98.5158,6602 "accuracy": 99.8199,
6603 "alpha_accuracy": 98.51586603 "alpha_accuracy": 99.8199
6604 },6604 },
6605 {6605 {
6606 "frame": 6,6606 "frame": 6,
6607 "label": "Set3=1",6607 "label": "Set3=1",
6608 "accuracy": 98.4437,6608 "accuracy": 99.8074,
6609 "alpha_accuracy": 98.44376609 "alpha_accuracy": 99.8074
6610 },6610 },
6611 {6611 {
6612 "frame": 7,6612 "frame": 7,
6613 "label": "ParticleStyle.BlueHigh=0.10081, Set17=1",6613 "label": "ParticleStyle.BlueHigh=0.10081, Set17=1",
6614 "accuracy": 98.4191,6614 "accuracy": 99.7962,
6615 "alpha_accuracy": 98.41916615 "alpha_accuracy": 99.7962
6616 },6616 },
6617 {6617 {
6618 "frame": 8,6618 "frame": 8,
6619 "label": "ParticleStyle.GreenLow=0.74792, InheritVelocityVariance=0.8157, InheritVelocity=1.28612",6619 "label": "ParticleStyle.GreenLow=0.74792, InheritVelocityVariance=0.8157, InheritVelocity=1.28612",
6620 "accuracy": 98.4047,6620 "accuracy": 99.7598,
6621 "alpha_accuracy": 98.40476621 "alpha_accuracy": 99.7598
6622 },6622 },
6623 {6623 {
6624 "frame": 9,6624 "frame": 9,
6625 "label": "ParticleStylePoint.SubPixelRendered=1",6625 "label": "ParticleStylePoint.SubPixelRendered=1",
6626 "accuracy": 98.2948,6626 "accuracy": 99.7425,
6627 "alpha_accuracy": 98.29486627 "alpha_accuracy": 99.7425
6628 },6628 },
6629 {6629 {
6630 "frame": 10,6630 "frame": 10,
6631 "label": "AlwaysFaceCamera=0, AngleVariance=149.8772",6631 "label": "AlwaysFaceCamera=0, AngleVariance=149.8772",
6632 "accuracy": 97.0471,6632 "accuracy": 99.6732,
6633 "alpha_accuracy": 97.04716633 "alpha_accuracy": 99.6732
6634 },6634 },
6635 {6635 {
6636 "frame": 11,6636 "frame": 11,
6637 "label": "Set24=1, Set14=1, RotationZ=320.52137, RotationXVariance=331.97326, VelocityVariance=0.08809, SpinZVariance=72.25177, SphereRgn.Rotate.Z=139.15569, ParticleStyle.RedHigh=0.16444, Set18=1, TimeLockSeed=1",6637 "label": "Set24=1, Set14=1, RotationZ=320.52137, RotationXVariance=331.97326, VelocityVariance=0.08809, SpinZVariance=72.25177, SphereRgn.Rotate.Z=139.15569, ParticleStyle.RedHigh=0.16444, Set18=1, TimeLockSeed=1",
6638 "accuracy": 97.1871,6638 "accuracy": 99.6747,
6639 "alpha_accuracy": 97.18716639 "alpha_accuracy": 99.6747
6640 }6640 }
6641 ],6641 ],
6642 "category": "Particles"6642 "category": "Particles"
...@@ -6808,250 +6808,250 @@...@@ -6808,250 +6808,250 @@
6808 "category": "Particles"6808 "category": "Particles"
6809 },6809 },
6810 "pPointForce": {6810 "pPointForce": {
6811 "mean_accuracy": 98.5158,6811 "mean_accuracy": 99.7975,
6812 "min_accuracy": 97.9994,6812 "min_accuracy": 99.6424,
6813 "mean_alpha_accuracy": 98.5158,6813 "mean_alpha_accuracy": 99.7975,
6814 "min_alpha_accuracy": 97.9994,6814 "min_alpha_accuracy": 99.6424,
6815 "frames": 12,6815 "frames": 12,
6816 "timestamp": "2026-12-01T15:49:02Z",6816 "timestamp": "2026-12-01T23:48:42Z",
6817 "per_frame": [6817 "per_frame": [
6818 {6818 {
6819 "frame": 0,6819 "frame": 0,
6820 "label": "defaults",6820 "label": "defaults",
6821 "accuracy": 99.119,6821 "accuracy": 99.9599,
6822 "alpha_accuracy": 99.1196822 "alpha_accuracy": 99.9599
6823 },6823 },
6824 {6824 {
6825 "frame": 1,6825 "frame": 1,
6826 "label": "EndAge=0.6275, Set13=0",6826 "label": "EndAge=0.6275, Set13=0",
6827 "accuracy": 98.8842,6827 "accuracy": 99.9335,
6828 "alpha_accuracy": 98.88426828 "alpha_accuracy": 99.9335
6829 },6829 },
6830 {6830 {
6831 "frame": 2,6831 "frame": 2,
6832 "label": "Set19=0, StartAge=0.3012, Set24=0",6832 "label": "Set19=0, StartAge=0.3012, Set24=0",
6833 "accuracy": 98.8076,6833 "accuracy": 99.8894,
6834 "alpha_accuracy": 98.80766834 "alpha_accuracy": 99.8894
6835 },6835 },
6836 {6836 {
6837 "frame": 3,6837 "frame": 3,
6838 "label": "Set11=0",6838 "label": "Set11=0",
6839 "accuracy": 98.6889,6839 "accuracy": 99.8816,
6840 "alpha_accuracy": 98.68896840 "alpha_accuracy": 99.8816
6841 },6841 },
6842 {6842 {
6843 "frame": 4,6843 "frame": 4,
6844 "label": "Set1=0, Set10=0",6844 "label": "Set1=0, Set10=0",
6845 "accuracy": 98.5319,6845 "accuracy": 99.8456,
6846 "alpha_accuracy": 98.53196846 "alpha_accuracy": 99.8456
6847 },6847 },
6848 {6848 {
6849 "frame": 5,6849 "frame": 5,
6850 "label": "Set12=0, Set29=0, Set28=0",6850 "label": "Set12=0, Set29=0, Set28=0",
6851 "accuracy": 98.4815,6851 "accuracy": 99.8069,
6852 "alpha_accuracy": 98.48156852 "alpha_accuracy": 99.8069
6853 },6853 },
6854 {6854 {
6855 "frame": 6,6855 "frame": 6,
6856 "label": "Set20=0",6856 "label": "Set20=0",
6857 "accuracy": 98.5125,6857 "accuracy": 99.7751,
6858 "alpha_accuracy": 98.51256858 "alpha_accuracy": 99.7751
6859 },6859 },
6860 {6860 {
6861 "frame": 7,6861 "frame": 7,
6862 "label": "Set26=0, Translate.Z=-7.72739",6862 "label": "Set26=0, Translate.Z=-7.72739",
6863 "accuracy": 98.404,6863 "accuracy": 99.7727,
6864 "alpha_accuracy": 98.4046864 "alpha_accuracy": 99.7727
6865 },6865 },
6866 {6866 {
6867 "frame": 8,6867 "frame": 8,
6868 "label": "Set2=0, Probability=0.84479, Set30=0",6868 "label": "Set2=0, Probability=0.84479, Set30=0",
6869 "accuracy": 98.2762,6869 "accuracy": 99.7243,
6870 "alpha_accuracy": 98.27626870 "alpha_accuracy": 99.7243
6871 },6871 },
6872 {6872 {
6873 "frame": 9,6873 "frame": 9,
6874 "label": "Set32=0",6874 "label": "Set32=0",
6875 "accuracy": 98.1689,6875 "accuracy": 99.6953,
6876 "alpha_accuracy": 98.16896876 "alpha_accuracy": 99.6953
6877 },6877 },
6878 {6878 {
6879 "frame": 10,6879 "frame": 10,
6880 "label": "Set22=0, Set6=0",6880 "label": "Set22=0, Set6=0",
6881 "accuracy": 97.9994,6881 "accuracy": 99.6432,
6882 "alpha_accuracy": 97.99946882 "alpha_accuracy": 99.6432
6883 },6883 },
6884 {6884 {
6885 "frame": 11,6885 "frame": 11,
6886 "label": "EndAge=0.79341, Set13=0, Set19=0, StartAge=0.81852, Set24=0, Set11=0, Set1=0, Set10=0, Set12=0, Set29=0",6886 "label": "EndAge=0.79341, Set13=0, Set19=0, StartAge=0.81852, Set24=0, Set11=0, Set1=0, Set10=0, Set12=0, Set29=0",
6887 "accuracy": 98.3149,6887 "accuracy": 99.6424,
6888 "alpha_accuracy": 98.31496888 "alpha_accuracy": 99.6424
6889 }6889 }
6890 ],6890 ],
6891 "category": "Particles"6891 "category": "Particles"
6892 },6892 },
6893 "pRender": {6893 "pRender": {
6894 "mean_accuracy": 98.4485,6894 "mean_accuracy": 99.6839,
6895 "min_accuracy": 97.7268,6895 "min_accuracy": 98.4009,
6896 "mean_alpha_accuracy": 98.4485,6896 "mean_alpha_accuracy": 99.6839,
6897 "min_alpha_accuracy": 97.7268,6897 "min_alpha_accuracy": 98.4009,
6898 "frames": 12,6898 "frames": 12,
6899 "timestamp": "2026-12-01T15:49:08Z",6899 "timestamp": "2026-12-01T23:48:30Z",
6900 "per_frame": [6900 "per_frame": [
6901 {6901 {
6902 "frame": 0,6902 "frame": 0,
6903 "label": "defaults",6903 "label": "defaults",
6904 "accuracy": 99.119,6904 "accuracy": 99.9599,
6905 "alpha_accuracy": 99.1196905 "alpha_accuracy": 99.9599
6906 },6906 },
6907 {6907 {
6908 "frame": 1,6908 "frame": 1,
6909 "label": "PreGenerateFrames=90, ObjectID.Set19=4",6909 "label": "PreGenerateFrames=90, ObjectID.Set19=4",
6910 "accuracy": 97.7268,6910 "accuracy": 98.4009,
6911 "alpha_accuracy": 97.72686911 "alpha_accuracy": 98.4009
6912 },6912 },
6913 {6913 {
6914 "frame": 2,6914 "frame": 2,
6915 "label": "mask: ApplyMaskInverted=1, MultiplyByMask=1, FitMask=Height, MaskChannel=0, MaskLow=0.60876, MaskHigh=0.61963, MaskClipBlack=0, MaskClipWhite=0, ObjectID.Set14=19, GlobalIn=358, ObjectID.Set12=8",6915 "label": "mask: ApplyMaskInverted=1, MultiplyByMask=1, FitMask=Height, MaskChannel=0, MaskLow=0.60876, MaskHigh=0.61963, MaskClipBlack=0, MaskClipWhite=0, ObjectID.Set14=19, GlobalIn=358, ObjectID.Set12=8",
6916 "accuracy": 98.7439,6916 "accuracy": 99.9397,
6917 "alpha_accuracy": 98.74396917 "alpha_accuracy": 99.9397
6918 },6918 },
6919 {6919 {
6920 "frame": 3,6920 "frame": 3,
6921 "label": "RotationOrder=4",6921 "label": "RotationOrder=4",
6922 "accuracy": 98.7015,6922 "accuracy": 99.8654,
6923 "alpha_accuracy": 98.70156923 "alpha_accuracy": 99.8654
6924 },6924 },
6925 {6925 {
6926 "frame": 4,6926 "frame": 4,
6927 "label": "ObjectID.Set15=23, Glow=0.09235",6927 "label": "ObjectID.Set15=23, Glow=0.09235",
6928 "accuracy": 98.5458,6928 "accuracy": 99.846,
6929 "alpha_accuracy": 98.54586929 "alpha_accuracy": 99.846
6930 },6930 },
6931 {6931 {
6932 "frame": 5,6932 "frame": 5,
6933 "label": "ObjectID.Set26=22, MaterialID.Set11=3, ShowGrid=1",6933 "label": "ObjectID.Set26=22, MaterialID.Set11=3, ShowGrid=1",
6934 "accuracy": 98.5078,6934 "accuracy": 99.8147,
6935 "alpha_accuracy": 98.50786935 "alpha_accuracy": 99.8147
6936 },6936 },
6937 {6937 {
6938 "frame": 6,6938 "frame": 6,
6939 "label": "ObjectID.Set23=15",6939 "label": "ObjectID.Set23=15",
6940 "accuracy": 98.5608,6940 "accuracy": 99.7969,
6941 "alpha_accuracy": 98.56086941 "alpha_accuracy": 99.7969
6942 },6942 },
6943 {6943 {
6944 "frame": 7,6944 "frame": 7,
6945 "label": "ObjectID.Set18=15, GridBlue=0.40469",6945 "label": "ObjectID.Set18=15, GridBlue=0.40469",
6946 "accuracy": 98.404,6946 "accuracy": 99.7727,
6947 "alpha_accuracy": 98.4046947 "alpha_accuracy": 99.7727
6948 },6948 },
6949 {6949 {
6950 "frame": 8,6950 "frame": 8,
6951 "label": "OutputMode=ThreeD, GenerateZBuffer=1, ObjectID.Set1=2",6951 "label": "OutputMode=ThreeD, GenerateZBuffer=1, ObjectID.Set1=2",
6952 "accuracy": 98.368,6952 "accuracy": 99.7773,
6953 "alpha_accuracy": 98.3686953 "alpha_accuracy": 99.7773
6954 },6954 },
6955 {6955 {
6956 "frame": 9,6956 "frame": 9,
6957 "label": "MaterialID.Set22=21",6957 "label": "MaterialID.Set22=21",
6958 "accuracy": 98.3152,6958 "accuracy": 99.7519,
6959 "alpha_accuracy": 98.31526959 "alpha_accuracy": 99.7519
6960 },6960 },
6961 {6961 {
6962 "frame": 10,6962 "frame": 10,
6963 "label": "ObjectID.Set32=10, Rotate.X=-76.18976",6963 "label": "ObjectID.Set32=10, Rotate.X=-76.18976",
6964 "accuracy": 97.9746,6964 "accuracy": 99.7909,
6965 "alpha_accuracy": 97.97466965 "alpha_accuracy": 99.7909
6966 },6966 },
6967 {6967 {
6968 "frame": 11,6968 "frame": 11,
6969 "label": "PreGenerateFrames=14, ObjectID.Set19=9, ObjectID.Set14=7, GlobalIn=876, ObjectID.Set12=23, RotationOrder=3, ObjectID.Set15=5, Glow=0.39248, ObjectID.Set26=14, MaterialID.Set11=22",6969 "label": "PreGenerateFrames=14, ObjectID.Set19=9, ObjectID.Set14=7, GlobalIn=876, ObjectID.Set12=23, RotationOrder=3, ObjectID.Set15=5, Glow=0.39248, ObjectID.Set26=14, MaterialID.Set11=22",
6970 "accuracy": 98.4146,6970 "accuracy": 99.4911,
6971 "alpha_accuracy": 98.41466971 "alpha_accuracy": 99.4911
6972 }6972 }
6973 ],6973 ],
6974 "category": "Particles"6974 "category": "Particles"
6975 },6975 },
6976 "pTurbulence": {6976 "pTurbulence": {
6977 "mean_accuracy": 98.5835,6977 "mean_accuracy": 99.8163,
6978 "min_accuracy": 98.2654,6978 "min_accuracy": 99.6958,
6979 "mean_alpha_accuracy": 98.5835,6979 "mean_alpha_accuracy": 99.8163,
6980 "min_alpha_accuracy": 98.2654,6980 "min_alpha_accuracy": 99.6958,
6981 "frames": 12,6981 "frames": 12,
6982 "timestamp": "2026-12-01T15:49:15Z",6982 "timestamp": "2026-12-01T23:48:55Z",
6983 "per_frame": [6983 "per_frame": [
6984 {6984 {
6985 "frame": 0,6985 "frame": 0,
6986 "label": "defaults",6986 "label": "defaults",
6987 "accuracy": 99.119,6987 "accuracy": 99.9599,
6988 "alpha_accuracy": 99.1196988 "alpha_accuracy": 99.9599
6989 },6989 },
6990 {6990 {
6991 "frame": 1,6991 "frame": 1,
6992 "label": "SetMode=DontAffect, ZStrength=0.24941",6992 "label": "SetMode=DontAffect, ZStrength=0.24941",
6993 "accuracy": 98.8854,6993 "accuracy": 99.9277,
6994 "alpha_accuracy": 98.88546994 "alpha_accuracy": 99.9277
6995 },6995 },
6996 {6996 {
6997 "frame": 2,6997 "frame": 2,
6998 "label": "Set5=0, TimeLockSeed=1, Set12=0",6998 "label": "Set5=0, TimeLockSeed=1, Set12=0",
6999 "accuracy": 98.8075,6999 "accuracy": 99.896,
7000 "alpha_accuracy": 98.80757000 "alpha_accuracy": 99.896
7001 },7001 },
7002 {7002 {
7003 "frame": 3,7003 "frame": 3,
7004 "label": "Set16=0",7004 "label": "Set16=0",
7005 "accuracy": 98.7008,7005 "accuracy": 99.8682,
7006 "alpha_accuracy": 98.70087006 "alpha_accuracy": 99.8682
7007 },7007 },
7008 {7008 {
7009 "frame": 4,7009 "frame": 4,
7010 "label": "Set21=0, Set19=0",7010 "label": "Set21=0, Set19=0",
7011 "accuracy": 98.5508,7011 "accuracy": 99.8482,
7012 "alpha_accuracy": 98.55087012 "alpha_accuracy": 99.8482
7013 },7013 },
7014 {7014 {
7015 "frame": 5,7015 "frame": 5,
7016 "label": "Set17=0, Set20=0, Set23=0",7016 "label": "Set17=0, Set20=0, Set23=0",
7017 "accuracy": 98.5278,7017 "accuracy": 99.8121,
7018 "alpha_accuracy": 98.52787018 "alpha_accuracy": 99.8121
7019 },7019 },
7020 {7020 {
7021 "frame": 6,7021 "frame": 6,
7022 "label": "Set11=0",7022 "label": "Set11=0",
7023 "accuracy": 98.5823,7023 "accuracy": 99.7999,
7024 "alpha_accuracy": 98.58237024 "alpha_accuracy": 99.7999
7025 },7025 },
7026 {7026 {
7027 "frame": 7,7027 "frame": 7,
7028 "label": "RegionMode=NotInside, Set2=0",7028 "label": "RegionMode=NotInside, Set2=0",
7029 "accuracy": 98.4446,7029 "accuracy": 99.7751,
7030 "alpha_accuracy": 98.44467030 "alpha_accuracy": 99.7751
7031 },7031 },
7032 {7032 {
7033 "frame": 8,7033 "frame": 8,
7034 "label": "Set27=0, Set25=0, Set6=0",7034 "label": "Set27=0, Set25=0, Set6=0",
7035 "accuracy": 98.4108,7035 "accuracy": 99.7596,
7036 "alpha_accuracy": 98.41087036 "alpha_accuracy": 99.7596
7037 },7037 },
7038 {7038 {
7039 "frame": 9,7039 "frame": 9,
7040 "label": "Set29=0",7040 "label": "Set29=0",
7041 "accuracy": 98.378,7041 "accuracy": 99.7468,
7042 "alpha_accuracy": 98.3787042 "alpha_accuracy": 99.7468
7043 },7043 },
7044 {7044 {
7045 "frame": 10,7045 "frame": 10,
7046 "label": "Region=MeshRegion, Set13=0",7046 "label": "Region=MeshRegion, Set13=0",
7047 "accuracy": 98.2654,7047 "accuracy": 99.7064,
7048 "alpha_accuracy": 98.26547048 "alpha_accuracy": 99.7064
7049 },7049 },
7050 {7050 {
7051 "frame": 11,7051 "frame": 11,
7052 "label": "SetMode=Ignore, ZStrength=0.41533, Set5=0, TimeLockSeed=1, Set12=0, Set16=0, Set21=0, Set19=0, Set17=0, Set20=0",7052 "label": "SetMode=Ignore, ZStrength=0.41533, Set5=0, TimeLockSeed=1, Set12=0, Set16=0, Set21=0, Set19=0, Set17=0, Set20=0",
7053 "accuracy": 98.3298,7053 "accuracy": 99.6958,
7054 "alpha_accuracy": 98.32987054 "alpha_accuracy": 99.6958
7055 }7055 }
7056 ],7056 ],
7057 "category": "Particles"7057 "category": "Particles"