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
DR3: a render's exposure warnings and raea scene light's cuts are Findings
shinyobjectz8a676800586b
diff --git a/Cargo.lock b/Cargo.lockindex 2b04d65f..4d74b4d3 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -15400,6 +15400,7 @@ version = "0.1.0"dependencies = ["bevy","image",+ "raea-core-facts","raea-core-scene","serde_json",]diff --git a/runtime/export/src/render.rs b/runtime/export/src/render.rsindex cbb14607..808458df 100644--- a/runtime/export/src/render.rs+++ b/runtime/export/src/render.rs@@ -139,6 +139,7 @@ fn with_exposure(said: String, out: &Path, manifest: Option<&Path>) -> String {}match raea_sys_light_meter::exposure::of_pngs(&pngs) {Ok((e, v)) => {+ let fs = raea_sys_light_meter::exposure::said(&v); // counted with the render's other findings (DR3)if let Some(m) = manifest {if let Ok(mut doc) = std::fs::read_to_string(m).map_err(|e| e.to_string()).and_then(|t| serde_json::from_str::<serde_json::Value>(&t).map_err(|e| e.to_string())) {if let Some(o) = doc.as_object_mut() {@@ -148,8 +149,8 @@ fn with_exposure(said: String, out: &Path, manifest: Option<&Path>) -> String {}}let mut msg = format!("{said}\nEXPOSURE {}", e.line());- for f in v["found"].as_array().into_iter().flatten() {- msg.push_str(&format!("\n {}: {}", f["level"].as_str().unwrap_or(""), f["says"].as_str().unwrap_or("")));+ for f in &fs {+ msg.push_str(&format!("\n {}", f.line()));}msg}diff --git a/runtime/export/src/scene.rs b/runtime/export/src/scene.rsindex f9bf047c..d8d65afa 100644--- a/runtime/export/src/scene.rs+++ b/runtime/export/src/scene.rs@@ -120,18 +120,10 @@ fn light(args: &[String]) -> Result<String, String> {let cuts = raea_sys_light_meter::cuts(&shots);if json_out {let shots: Vec<Value> = shots.iter().map(|(c, m)| json!({"composition": c, "frames": m.iter().map(|(f, v)| json!({"frame": f, "meter": v})).collect::<Vec<_>>()})).collect();- return Ok(serde_json::to_string_pretty(&json!({"shots": shots, "cuts": cuts})).unwrap_or_default());+ return Ok(serde_json::to_string_pretty(&json!({"shots": shots, "cuts": cuts, "findings": raea_sys_light_meter::cut_findings(&cuts)})).unwrap_or_default());}- let mut t = Vec::new();- for (c, m) in &shots {- for (f, v) in m {- t.push(raea_sys_light_meter::say(if c.is_empty() { "the composition" } else { c }, *f, v));- }- }- for c in &cuts {- t.push(format!("cut {}", c["says"].as_str().unwrap_or("")));- }- Ok(t.join("\n"))+ // each shot's meter, each cut, and the cuts' jumps and drifts as Findings (DR3), counted last+ Ok(raea_sys_light_meter::report(&shots, &cuts))}/// `--frame N`, 0 when it isn't given (scene lint and render --review).diff --git a/systems/light-meter/Cargo.toml b/systems/light-meter/Cargo.tomlindex 55fed1fa..0ce7e667 100644--- a/systems/light-meter/Cargo.toml+++ b/systems/light-meter/Cargo.toml@@ -8,6 +8,8 @@ description = "The light on a 3D shot's subject in lux, metered from the scene's[dependencies]raea-core-scene = { path = "../../core/scene" }+# what it finds, as raea's one Finding (docs/direction.feature DR3)+raea-core-facts = { path = "../../core/facts" }bevy = { version = "=0.20.0", default-features = false, features = ["std"] }serde_json = "1"image = { version = "0.25", default-features = false, features = ["png", "hdr"] }diff --git a/systems/light-meter/src/exposure.rs b/systems/light-meter/src/exposure.rsindex c7fc20c6..b17e4b90 100644--- a/systems/light-meter/src/exposure.rs+++ b/systems/light-meter/src/exposure.rs@@ -103,6 +103,14 @@ impl Exposure {}}+/// What a render's pictures were found to be (of_pngs's `found`) as its Findings (docs/direction.feature DR3), said+/// with the rest of the render's, so its count and its manifest have them.+pub fn said(v: &Value) -> Vec<raea_core_facts::Finding> {+ let fs: Vec<raea_core_facts::Finding> = v["found"].as_array().into_iter().flatten().filter_map(|f| raea_core_facts::Finding::of_value(f, "raea render")).collect();+ raea_core_facts::finding::said(&fs);+ fs+}+/// The exposure of PNG files, each read and measured, and all of them pooled (as one frame of all their pixels):/// `{"frames": [{file, exposure}], "exposure": pooled, "found": [{check, level, says}]}`.pub fn of_pngs(files: &[std::path::PathBuf]) -> Result<(Exposure, Value), String> {diff --git a/systems/light-meter/src/found.rs b/systems/light-meter/src/found.rsnew file mode 100644index 00000000..6f0a5166--- /dev/null+++ b/systems/light-meter/src/found.rs@@ -0,0 +1,63 @@+//! What the meter finds, as raea's one Finding (docs/direction.feature DR3): a cut that jumps in exposure or drifts in+//! white balance, about its two shots; and `raea scene light`'s text, its findings counted last.++use raea_core_facts::{Finding, Level, finding};+use serde_json::Value;++use crate::{DRIFT_MIRED, JUMP_STOPS};++/// Each cut's jump and drift (`cuts`), a warn about the shots on either side, with the stops or mired it turns on.+pub fn cut_findings(cuts: &[Value]) -> Vec<Finding> {+ let mut found = Vec::new();+ for c in cuts {+ for (k, check, unit, limit) in [("jump", "light-jump", "stops", JUMP_STOPS), ("drift", "light-drift", "mired", DRIFT_MIRED)] {+ if c[k] != true {+ continue;+ }+ let mut f = Finding::new(check, Level::Warn, c["says"].as_str().unwrap_or_default(), "raea scene light");+ for s in [&c["from"], &c["to"]] {+ f = f.about(s.as_str().unwrap_or_default(), None);+ }+ if let Some(v) = c[unit].as_f64() {+ f = f.measure(k, v, unit, Some(limit as f64));+ }+ found.push(f);+ }+ }+ found+}++/// `raea scene light`'s text: each shot's meter at its frames, each cut, then the cuts' findings and their count.+pub fn report(shots: &[(String, Vec<(i64, Value)>)], cuts: &[Value]) -> String {+ let mut t = Vec::new();+ for (c, m) in shots {+ for (f, v) in m {+ t.push(crate::say(if c.is_empty() { "the composition" } else { c }, *f, v));+ }+ }+ for c in cuts {+ t.push(format!("cut {}", c["says"].as_str().unwrap_or("")));+ }+ let found = cut_findings(cuts);+ t.extend(found.iter().map(Finding::line));+ t.push(format!("raea scene light: {}", finding::count(&found)));+ t.join("\n")+}++#[cfg(test)]+mod tests {+ use super::*;+ use serde_json::json;++ #[test]+ fn a_cut_that_jumps_and_drifts_is_two_warns_about_its_shots() {+ let cuts = vec![+ json!({"from": "wide", "to": "close", "stops": 0.9, "mired": 25.0, "jump": true, "drift": true, "says": "wide to close: the picture +0.90 stops"}),+ json!({"from": "close", "to": "end", "stops": 0.1, "mired": 2.0, "jump": false, "drift": false, "says": "close to end"}),+ ];+ let fs = cut_findings(&cuts);+ assert_eq!(fs.iter().map(|f| f.check.as_str()).collect::<Vec<_>>(), ["light-jump", "light-drift"]);+ assert_eq!((fs[0].about[1].name.as_str(), fs[1].measure.as_ref().map(|m| (m.value, m.unit.as_str()))), ("close", Some((25.0, "mired"))));+ assert!(report(&[], &cuts).ends_with("raea scene light: 0 errors, 2 warns, 0 notes"));+ }+}diff --git a/systems/light-meter/src/lib.rs b/systems/light-meter/src/lib.rsindex c620868b..c3bc9f21 100644--- a/systems/light-meter/src/lib.rs+++ b/systems/light-meter/src/lib.rs@@ -14,6 +14,8 @@pub mod exposure;+mod found;+pub use found::{cut_findings, report};use std::collections::HashMap;use std::f32::consts::{PI, TAU};use std::sync::{Arc, Mutex, OnceLock};