Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
SG13: raea fingerprint things' lurch runs on every render
shinyobjectz7a1520bc3b6d
diff --git a/docs/stage-guards.feature b/docs/stage-guards.featureindex 7fa357dc..2a466727 100644--- a/docs/stage-guards.feature+++ b/docs/stage-guards.feature@@ -406,6 +406,13 @@ Feature: Stage guards: a 3D render an agent can't break# jumps there); on the clean scenes, 13 lurches on cameras locked to a walking body (sheet3d) or a first-person# walk starting with no ease, and two dolly reversals (soma_dressed's 0.15 m, Stay's 0.84 m in and 0.43 m out at# 1:12). Left: `raea fingerprint things`' lurch check, still its own.+ # Branch stage-guards-16: folded in. That check (camera-speed, P2) read the picture's motion and compared each+ # half second's mean speed with the one before, inside a move away from its eases; a speed that ramps up over a+ # few frames passes the one-frame kink above and was caught only there, by hand. motion.rs `ramps` runs the same+ # on the camera itself on every render, as a camera-lurch warning at 2x (none near a kink already said). On the+ # 29 clean scenes: 3 warnings, all real (creatures' camera locked to the raccoon as it breaks from a walk to a+ # run, 2.4x); the 13 errors are the same. On film2: 6 warnings beside its 41 errors. `raea fingerprint things`+ # keeps its own for video with no 3D scene (footage).Scenario: SG14. The frame is composedGiven the plandiff --git a/systems/stage/src/motion.rs b/systems/stage/src/motion.rsindex 6e7978c5..4dce7741 100644--- a/systems/stage/src/motion.rs+++ b/systems/stage/src/motion.rs@@ -84,6 +84,7 @@ pub(crate) fn camera(st: &Stage) -> Vec<Finding> {let lin: Vec<f32> = (0..v.len()).map(|i| if i == 0 { 0.0 } else { (v[i].eye - v[i - 1].eye).length() }).collect();let ang: Vec<f32> = (0..v.len()).map(|i| if i == 0 { 0.0 } else { v[i - 1].turn(&v[i]) }).collect();for (what, s, seen) in [("travel", &lin, SEEN_TRAVEL), ("turn", &ang, SEEN_TURN)] {+ let mut said = Vec::new();let top = s.iter().copied().fold(0.0, f32::max);if top <= 1e-5 {continue;@@ -103,18 +104,54 @@ pub(crate) fn camera(st: &Stage) -> Vec<Finding> {let mut f = st.finding("camera-lurch", level, k - 1, k, says).fix("move the camera on one smooth path through its keys (raea/camera's cameraPath, and path.check() for keys that still brake), easing only where it starts and stops");f.measure = Some(raea_core_facts::finding::Measure { name: "speed change".into(), value: r.min(99.0) as f64, unit: "x".into(), limit: Some(LURCH as f64) });out.push(f);+ said.push(k);i += 3;continue;}}i += 1;}+ out.extend(ramps(st, a, what, s, (MOVING * top).max(seen), &said));}out.extend(reversals(st, a, &v));}out}+/// `raea fingerprint things`' lurch (camera-speed, read from the picture's motion and run only by hand), folded in on+/// the camera itself so every render runs it: inside a move, its eases (half a second each end) left out, a half+/// second whose mean speed is LURCH times the one before's, or that fraction of it. A speed that ramps up over a few+/// frames passes the one-frame kink above. A warning, as that check's was (P2); none near a kink already said.+fn ramps(st: &Stage, a: usize, what: &str, s: &[f32], moving: f32, said: &[usize]) -> Vec<Finding> {+ let half = ((st.fps * 0.5).round() as usize).max(2);+ let mean = |r: std::ops::Range<usize>| s[r].iter().sum::<f32>() / half as f32;+ let mut out = Vec::new();+ let mut i = 1;+ while i < s.len() {+ let start = i;+ while i < s.len() && s[i] > moving {+ i += 1;+ }+ let (mut t, end) = (start + half, i.saturating_sub(half));+ while t + 2 * half <= end {+ let (m0, m1) = (mean(t..t + half), mean(t + half..t + 2 * half));+ let (r, k) = (m0.max(m1) / m0.min(m1).max(1e-6), a + t + half);+ if r >= LURCH && !said.iter().any(|x| x.abs_diff(k) <= 2 * half) {+ let how = if m1 > m0 { "speeds up" } else { "slows" };+ let says = format!("the camera's {what} {how} {r:.1}x within half a second at {}, mid-move", st.at(k));+ let mut f = st.finding("camera-lurch", Level::Warn, k - half, k + half - 1, says).fix("ease the speed change over a second or more, or hold one speed through the move (raea/camera's cameraPath)");+ f.measure = Some(raea_core_facts::finding::Measure { name: "speed change over half a second".into(), value: r.min(99.0) as f64, unit: "x".into(), limit: Some(LURCH as f64) });+ out.push(f);+ t += 2 * half;+ continue;+ }+ t += half;+ }+ i += 1;+ }+ out+}+/// A dolly in then out, or a pan one way then back, within REVERSE_SECS.fn reversals(st: &Stage, a: usize, v: &[View]) -> Vec<Finding> {let mut out = Vec::new();@@ -273,6 +310,24 @@ mod tests {assert!(f.iter().any(|f| f.check == "camera-lurch" && f.level == Level::Error), "{f:?}");}+ #[test]+ fn a_speed_that_ramps_up_over_a_few_frames_lurches_too() {+ // 2 cm a frame (eased in), then 2 to 8 cm a frame over 8 frames, then 8 (eased out): no frame kinks alone, but+ // its half seconds either side of the ramp differ 3x, as `raea fingerprint things` read it from the picture+ let speed = |i: usize| match i {+ 0..15 => 0.02 * eased(i as f32 / 15.0),+ 15..50 => 0.02,+ 50..58 => 0.02 + 0.06 * (i - 50) as f32 / 8.0,+ 58..105 => 0.08,+ _ => 0.08 * (1.0 - eased((i - 105) as f32 / 15.0)),+ };+ let mut z = 20.0;+ let ramp: Vec<Vec<Item>> = (0..120).map(|i| { z -= speed(i); vec![cam([0.0, 0.0, z], [0.0, 0.0, -100.0])] }).collect();+ let f: Vec<Finding> = run(ramp).into_iter().filter(|f| f.check == "camera-lurch").collect();+ assert_eq!(f.len(), 1, "{f:?}");+ assert!(f[0].level == Level::Warn && f[0].says.contains("speeds up"), "{}", f[0].says);+ }+#[test]fn a_cut_is_not_a_lurch_and_in_then_out_is_a_reversal() {let cut: Vec<Vec<Item>> = (0..60).map(|i| if i < 30 { vec![cam([0.0, 0.0, 10.0 - 0.01 * i as f32], [0.0; 3])] } else { vec![cam([5.0, 2.0, 3.0 - 0.01 * (i - 30) as f32], [5.0, 2.0, -10.0])] }).collect();