mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 12:44:11 -10:00
raea light check now plays each scene live (raea play --offscreen --no-vsync --3d, 6 s at 1080p) and reports its milliseconds a frame; adds a traced-ao path (raster with systems/rt's traced occlusion); measures distance on 8x8-pixel block means, so antialiasing and a reference's leftover noise count for little; measures flicker as the second difference in time of each pixel's error against the same shot path-traced, so motion cancels; keeps a reference only while it's the same frames at the same samples (made.json); and takes a scene's own sample count. The path tracer's reset is now one-shot, as Solari's is (vendor/bevy_solari pathtracer/extract.rs, raea: mark): it stayed set, so a cut under the path tracer restarted accumulation every frame after it. RAEA_LIGHT_SPP restarts each frame's accumulation (raea-render restart_pathtracer), so a thing moving under a held camera isn't smeared. LT1 measured on FLOOR3 against a 2048-sample reference: raster 1.38 stops off (worst tile 3.37), 18.0 ms a frame; Solari 0.96 (2.62), nearly all one bias a stop dark, 47.6 ms a frame. Berlin is the main scene from here; it and the kitchen get references once their materials and lights are in the traced path. LT1's plan table is in the feature.
42 lines
1.7 KiB
Rust
42 lines
1.7 KiB
Rust
//! raea-render as a library: raea's render engine. An edit is a Program (rows spawned and keyed per frame, ir.rs), made by
|
|
//! raea from a composition (or by raea-runtime-encode from an HTML page); it's drawn by Bevy (engine.rs). Renders to
|
|
//! files, the direct GPU path and the sound are raea-runtime-encode's; the media verbs are raea-app-media's.
|
|
|
|
// the image codecs raea-render links (PNG, JPEG), shared with dependents (the media verbs among them) without a second copy
|
|
pub use image;
|
|
pub mod engine;
|
|
|
|
use std::path::{Path, PathBuf};
|
|
|
|
use raea_core_program::{eval, ir};
|
|
|
|
use eval::Tup;
|
|
use ir::{Program, V};
|
|
|
|
/// A program's rows as spawned, in order.
|
|
pub fn inserted_of(p: &Program) -> Vec<Tup> {
|
|
let mut out = Vec::new();
|
|
for (kind, rows) in &p.spawns {
|
|
for r in rows {
|
|
let id = match r.get("id") {
|
|
Some(V::S(s)) => s.clone(),
|
|
_ => format!("{kind}{}", out.len()),
|
|
};
|
|
out.push(Tup { kind: kind.clone(), id, vals: r.iter().filter(|(k, _)| *k != "id").map(|(k, v)| (k.clone(), v.clone())).collect() });
|
|
}
|
|
}
|
|
out
|
|
}
|
|
|
|
// a path-traced camera's accumulation started again on the next draw (RAEA_LIGHT_SPP's frames, docs/realism.feature LT1)
|
|
#[cfg(feature = "raytracing")]
|
|
pub use raea_render_raytrace::restart_pathtracer;
|
|
|
|
pub fn dir_of(path: &str) -> PathBuf {
|
|
dunce::canonicalize(Path::new(path).parent().filter(|d| !d.as_os_str().is_empty()).unwrap_or(Path::new("."))).unwrap_or_else(|_| PathBuf::from("."))
|
|
}
|
|
|
|
pub fn save_png(path: &Path, rgba: &[u8], w: u32, h: u32) -> Result<(), String> {
|
|
image::save_buffer(path, rgba, w, h, image::ColorType::Rgba8).map_err(|e| format!("{}: {e}", path.display()))
|
|
}
|