Skip to content

armgit / raea

Public Imported from GitHub
0

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.

Steady's rates, motion blur's kind, the path tracer's samples and air, and Solari's dynamic are props, each checked against its variable

shinyobjectz1dee25c609a4
diff --git a/docs/manual/reference/sdk/3d.md b/docs/manual/reference/sdk/3d.md
index e382c8b5..21353a5e 100644
--- a/docs/manual/reference/sdk/3d.md
+++ b/docs/manual/reference/sdk/3d.md
@@ -1318,6 +1318,7 @@ type AnimGraphNode = | { clip: string | number; time?: number; weight?: number;
| Field | Type | What it is |
| --- | --- | --- |
| `mode` (required) | `"msaa" \| "smaa" \| "fxaa" \| "none" \| "steady"` | "msaa" (4x multisampling, the default), "smaa" (morphological, high preset: the default with AmbientOcclusion, which can't multisample), "fxaa" (cheapest, softest), "none", or "steady": raea's temporal filter, each frame drawn from a slightly different place inside its pixels and blended with the frames before it, so what one frame can only draw as a pattern of pixels (levels cross-fading by distance, far detail a pixel wide, noisy light) settles to its true share; single-sampled, with depth and motion prepasses (on Berlin's fly, faster than msaa). The others draw a frame from that frame alone, so a render equals its play; "steady" needs the frames before, so a render that starts partway through differs from its play for its first few frames |
+| `steady` | `{ still?: number; moving?: number; px?: number }` | "steady"'s rates: the frames a still pixel's history averages (32), a moving one's (8), and the motion in pixels at which a pixel counts as moving (4). Fewer frames follow change sooner and settle less |
### `AtmosphereProps`
@@ -2018,6 +2019,7 @@ type ModelScreens = Record<string, ReactElement>
| --- | --- | --- |
| `shutterAngle` | `number` | the fraction of a frame the shutter is open (0.5 by default, a 180-degree shutter); above 1 smears further |
| `samples` | `number` | samples each way per pixel (4 by default) |
+| `kind` | `"shutter" \| "bevy"` | "shutter" (the default: raea's, two taps a pixel for each sample each way) or "bevy" (Bevy's MotionBlur, to compare against) |
| `animate` | `Animate3d` | declared animation of its numbers |
### `OutlineProps`
diff --git a/docs/manual/reference/sdk/light.md b/docs/manual/reference/sdk/light.md
index fa94692a..775cbead 100644
--- a/docs/manual/reference/sdk/light.md
+++ b/docs/manual/reference/sdk/light.md
@@ -127,6 +127,8 @@ view holds still. For stills to check a look against, not for motion. Same GPU n
| Prop | Type | What it does |
| --- | --- | --- |
| `reset` | `boolean` | start the accumulation again |
+| `samples` | `number` | how many times a render draws each frame, each draw one more sample a pixel, the last kept (1 by default): 256 or more converges a reference still. Its accumulation starts afresh each frame, so a moved part isn't smeared |
+| `media` | `boolean` | whether its rays walk the fog volumes, scattering in the air (true by default); false for a frame without the air |
### `PointLight`
@@ -194,7 +196,7 @@ Ray-traced direct and indirect light for the <Camera3d> it's inside (Bevy's Sola
light and reflections traced against the scene, in place of shadow maps. Needs a GPU with ray queries (Apple
silicon on Metal, RTX on Vulkan); elsewhere the scene draws raster-lit and raea says so. On the Mac MetalFX's
temporal denoiser cleans it up (RT4; denoise={false} shows the raw noise). A <Character> (skinned, morphed) stays
-raster-lit: Bevy 0.20's Solari can't trace it.
+raster-lit: Bevy 0.20's Solari can't trace it, unless `dynamic` gives a skinned one a traced twin.
| Prop | Type | What it does |
| --- | --- | --- |
@@ -217,6 +219,7 @@ raster-lit: Bevy 0.20's Solari can't trace it.
| `jitter` | `"denoiser" \| "scaler" \| "both" \| "flip" \| "none"` | which of MetalFX's passes is told the camera's jitter: "denoiser", "scaler", "both", "flip" (the denoiser, negated), "none" (and the view isn't jittered). For A/Bs of RT9; default "denoiser"; RAEA_SOLARI_JITTER ("" the denoiser, "0" none) overrides it |
| `emissiveSharpness` | `number` | how fast a sample's weight falls with its distance from a pixel's centre in the emission's history, exp(-k d²) in output pixels: lower is softer. Default 6; RAEA_EMIT_TAA_SHARP overrides it |
| `jitterFrames` | `number` | the jitter's cycle at the full size, in frames: a view drawn at s of its size a side cycles through jitterFrames / s² offsets, and an emissive twig glimpsed through it may stay away that long. Default 8 (DLSS's) |
+| `dynamic` | `boolean` | the traced scene follows what moves (a trial, false by default): a skinned character's traced twin is posed each frame, so it casts traced shadows and bounces light, and a hidden part leaves the traced scene. Decided as each mesh is first traced, so set it from the first frame |
| `constants` | `{ /** how far ReSTIR looks for a neighbour's light samples, pixels (30): smaller keeps …` | constants in Solari's and the denoiser's shaders, compiled in when the scene loads (a value changed later in the composition isn't drawn); each left out keeps the shader's own, given in brackets. <ShaderConstants> reaches the rest |
### `SpotLight`
diff --git a/docs/manual/reference/sdk/post_process.md b/docs/manual/reference/sdk/post_process.md
index 8da7d5f6..e5338684 100644
--- a/docs/manual/reference/sdk/post_process.md
+++ b/docs/manual/reference/sdk/post_process.md
@@ -141,6 +141,7 @@ Takes [`ToneMappingProps`](3d.md#tonemappingprops)'s props.
| Field | Type | What it is |
| --- | --- | --- |
| `mode` (required) | `"msaa" \| "smaa" \| "fxaa" \| "none" \| "steady"` | "msaa" (4x multisampling, the default), "smaa" (morphological, high preset: the default with AmbientOcclusion, which can't multisample), "fxaa" (cheapest, softest), "none", or "steady": raea's temporal filter, each frame drawn from a slightly different place inside its pixels and blended with the frames before it, so what one frame can only draw as a pattern of pixels (levels cross-fading by distance, far detail a pixel wide, noisy light) settles to its true share; single-sampled, with depth and motion prepasses (on Berlin's fly, faster than msaa). The others draw a frame from that frame alone, so a render equals its play; "steady" needs the frames before, so a render that starts partway through differs from its play for its first few frames |
+| `steady` | `{ still?: number; moving?: number; px?: number }` | "steady"'s rates: the frames a still pixel's history averages (32), a moving one's (8), and the motion in pixels at which a pixel counts as moving (4). Fewer frames follow change sooner and settle less |
### `BloomProps`
@@ -264,6 +265,7 @@ A shader over the whole frame. Its source defines
| --- | --- | --- |
| `shutterAngle` | `number` | the fraction of a frame the shutter is open (0.5 by default, a 180-degree shutter); above 1 smears further |
| `samples` | `number` | samples each way per pixel (4 by default) |
+| `kind` | `"shutter" \| "bevy"` | "shutter" (the default: raea's, two taps a pixel for each sample each way) or "bevy" (Bevy's MotionBlur, to compare against) |
| `animate` | `Animate3d` | declared animation of its numbers |
### `OutlineProps`
diff --git a/engine/render/raytrace/src/lib.rs b/engine/render/raytrace/src/lib.rs
index b2ae2446..c49adff4 100644
--- a/engine/render/raytrace/src/lib.rs
+++ b/engine/render/raytrace/src/lib.rs
@@ -71,6 +71,9 @@ pub struct SolariSettings {
/// the jitter's cycle at the full size, in frames: a view drawn at s of its size a side cycles through
/// `jitter_frames / s²` offsets (DLSS's 8), and emit_taa lets a twig glimpsed through it stay away that long
pub jitter_frames: f32,
+ /// the traced scene follows what moves: a skinned mesh's traced twin posed each frame, a hidden part taken out
+ /// (RT5, a trial; RAEA_SOLARI_DYNAMIC)
+ pub dynamic: bool,
}
impl Default for SolariSettings {
@@ -86,14 +89,16 @@ impl Default for SolariSettings {
jitter: String::new(),
emissive_sharpness: 6.0,
jitter_frames: 8.0,
+ dynamic: false,
}
}
}
/// Solari's plugins, and RAEA_LIGHT's camera override when it names a path.
pub fn add(app: &mut App) {
- app.register_type::<RenderScale>().register_type::<SolariSettings>();
+ app.register_type::<RenderScale>().register_type::<SolariSettings>().register_type::<raea_sys_frame::pathtracer::PathtracerSettings>();
app.add_plugins(bevy::render::extract_component::ExtractComponentPlugin::<SolariSettings>::default());
+ app.add_plugins(bevy::render::extract_component::ExtractComponentPlugin::<raea_sys_frame::pathtracer::PathtracerSettings>::default());
// the denoiser's own shaders, read from a project's engine-shaders/ or the checkout as its pipelines are made
#[cfg(target_os = "macos")]
raea_sys_frame::engine_shaders::declare(&[("raea_render_raytrace/metalfx_guides.wgsl", metalfx::DECODE_WGSL), ("raea_render_raytrace/emit_taa.wgsl", emit_taa::WGSL)]);
diff --git a/engine/render/raytrace/src/settings.rs b/engine/render/raytrace/src/settings.rs
index d94f8809..1b53706d 100644
--- a/engine/render/raytrace/src/settings.rs
+++ b/engine/render/raytrace/src/settings.rs
@@ -16,6 +16,7 @@ struct Overrides {
aa: Option<bool>,
jitter: Option<String>,
emissive_sharpness: Option<f32>,
+ dynamic: Option<bool>,
}
fn overrides() -> &'static Overrides {
@@ -35,6 +36,7 @@ fn overrides() -> &'static Overrides {
aa: switch("RAEA_SOLARI_AA"),
jitter: var("RAEA_SOLARI_JITTER"),
emissive_sharpness: num("RAEA_EMIT_TAA_SHARP"),
+ dynamic: switch("RAEA_SOLARI_DYNAMIC"),
}
})
}
@@ -52,6 +54,7 @@ pub(crate) fn of(s: Option<&SolariSettings>) -> SolariSettings {
if let Some(v) = o.aa { s.aa = v; }
if let Some(v) = &o.jitter { s.jitter = v.clone(); }
if let Some(v) = o.emissive_sharpness { s.emissive_sharpness = v; }
+ if let Some(v) = o.dynamic { s.dynamic = v; }
s
}
@@ -66,6 +69,7 @@ fn set() -> Vec<(&'static str, String, &'static str)> {
("RAEA_METALFX_PREEXPOSURE", "preexposure"),
("RAEA_SOLARI_AA", "aa"),
("RAEA_SOLARI_JITTER", "jitter"),
+ ("RAEA_SOLARI_DYNAMIC", "dynamic"),
("RAEA_EMIT_TAA_SHARP", "emissiveSharpness"),
("RAEA_SOLARI_SCALE", "scale"),
]
@@ -97,7 +101,7 @@ pub(crate) fn record(view: Entity, s: &SolariSettings, scale: f32, seen: &mut Ha
"view": view.to_bits(),
"denoise": s.denoise, "guides": s.guides, "reflection_depth": s.reflection_depth, "emissive": s.emissive,
"upscale": s.upscale, "preexposure": s.preexposure, "aa": s.aa, "jitter": s.jitter,
- "emissive_sharpness": s.emissive_sharpness, "jitter_frames": s.jitter_frames, "scale": (f64::from(scale) * 1000.0).round() / 1000.0,
+ "emissive_sharpness": s.emissive_sharpness, "jitter_frames": s.jitter_frames, "dynamic": s.dynamic, "scale": (f64::from(scale) * 1000.0).round() / 1000.0,
"env": env.iter().map(|(n, v, _)| format!("{n}={v}")).collect::<Vec<_>>(),
}),
);
diff --git a/engine/render/raytrace/src/solari.rs b/engine/render/raytrace/src/solari.rs
index 71e0769d..45f8b4fa 100644
--- a/engine/render/raytrace/src/solari.rs
+++ b/engine/render/raytrace/src/solari.rs
@@ -16,26 +16,35 @@ use bevy::solari::pathtracer::{Pathtracer, PathtracingPlugin};
use bevy::solari::prelude::{RaytracingMesh3d, SolariLighting, SolariPlugins};
pub fn add(app: &mut App) {
- app.add_plugins((SolariPlugins, PathtracingPlugin)).add_systems(PostUpdate, (cameras, meshes, deferred, shadow_maps).before(bevy::camera::CameraUpdateSystems));
- if dynamic() {
- // a twin posed after its joints are placed and before this frame's asset events go out, so the traced scene
- // gets the pose with the frame that draws it; a part's visibility read once it is propagated
- app.add_systems(
- PostUpdate,
- (
- skin_twins.after(bevy::transform::TransformSystems::Propagate).before(bevy::asset::AssetEventSystems),
- hidden.after(bevy::camera::visibility::VisibilitySystems::VisibilityPropagate),
- ),
- );
- }
+ app.add_plugins((SolariPlugins, PathtracingPlugin))
+ .init_resource::<Dynamic>()
+ .add_systems(PostUpdate, (cameras, meshes, deferred, shadow_maps).before(bevy::camera::CameraUpdateSystems))
+ .add_systems(PostUpdate, dynamic.before(meshes));
+ // a twin posed after its joints are placed and before this frame's asset events go out, so the traced scene gets
+ // the pose with the frame that draws it; a part's visibility read once it is propagated
+ app.add_systems(
+ PostUpdate,
+ (
+ skin_twins.after(bevy::transform::TransformSystems::Propagate).before(bevy::asset::AssetEventSystems),
+ hidden.after(bevy::camera::visibility::VisibilitySystems::VisibilityPropagate),
+ )
+ .run_if(|d: Res<Dynamic>| d.0),
+ );
}
-/// RAEA_SOLARI_DYNAMIC=1 (RT5, a trial; unset, everything is as before): the traced scene follows what moves. A skinned
-/// mesh gets a traced twin, posed on the CPU each frame as the GPU skins the drawn one (it casts traced shadows, stops
-/// and bounces light), and a hidden part leaves the traced scene until it is shown again (hidden, it still shadowed).
-fn dynamic() -> bool {
- static ON: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
- *ON.get_or_init(|| raea_io_home::env_on("RAEA_SOLARI_DYNAMIC"))
+/// Whether the traced scene follows what moves (RT5, a trial: <SolariLighting dynamic>, or RAEA_SOLARI_DYNAMIC on every
+/// camera; off, everything is as before): a skinned mesh gets a traced twin, posed on the CPU each frame as the GPU
+/// skins the drawn one (it casts traced shadows, stops and bounces light), and a hidden part leaves the traced scene
+/// until it is shown again (hidden, it still shadowed). On while any traced camera asks for it; a mesh is decided the
+/// first frame it is traced, so ask from the first frame.
+#[derive(Resource, Default)]
+struct Dynamic(bool);
+
+fn dynamic(mut d: ResMut<Dynamic>, cams: Query<Option<&super::SolariSettings>, Or<(With<SolariLighting>, With<Pathtracer>)>>) {
+ let on = cams.iter().any(|s| super::settings::of(s).dynamic);
+ if d.0 != on {
+ d.0 = on;
+ }
}
/// A skinned mesh's traced twin: the mesh's bind pose in Solari's layout and its skin, and the joints last posed from.
@@ -180,6 +189,7 @@ fn meshes(
mut assets: ResMut<Assets<Mesh>>,
mut copies: Local<HashMap<(AssetId<Mesh>, bool), Option<Handle<Mesh>>>>,
mut said: Local<bool>,
+ dynamic: Res<Dynamic>,
) {
if on.is_empty() {
return;
@@ -196,7 +206,7 @@ fn meshes(
None => continue,
Some(true) => {}
}
- if skinned && !morphed && dynamic() {
+ if skinned && !morphed && dynamic.0 {
let mapped = mats.get(&mat.0).is_some_and(|m| m.normal_map_texture.is_some());
let Some(twin) = assets.get(&m.0).map(|src| skin_twin(src, mapped)) else { continue };
match twin {
diff --git a/runtime/export/src/bevy_frame.rs b/runtime/export/src/bevy_frame.rs
index c71d601e..3542a565 100644
--- a/runtime/export/src/bevy_frame.rs
+++ b/runtime/export/src/bevy_frame.rs
@@ -86,12 +86,13 @@ pub(crate) fn bevy_over_3d(world: &mut World, page: &mut raea_runtime_page::Bevy
e.set_view_box(view);
let mats = page.set_ui_materials(e.world_mut())?;
// one draw a frame, as the fed render draws it (drawn again, a frame's auto exposure and temporal passes move on);
- // RAEA_LIGHT_SPP=N draws it N times, the last kept, so a path-traced reference converges (docs/realism.feature LT1),
+ // <Pathtracer samples={N}> (or RAEA_LIGHT_SPP=N) draws it N times, the last kept, so a path-traced reference converges (docs/realism.feature LT1),
// its accumulation started afresh so the frame before isn't in it
- if spp() > 1 {
+ let spp = raea_sys_frame::pathtracer::samples(e.world_mut());
+ if spp > 1 {
raea_render::restart_pathtracer(e.world_mut());
}
- for _ in 1..spp() {
+ for _ in 1..spp {
e.draw(cx.now);
}
e.draw(cx.now);
@@ -333,9 +334,3 @@ pub(crate) fn page_dump(frame: i64, px: &[u8], w: u32, h: u32, boxes: Option<Vec
}
Ok(())
}
-
-/// RAEA_LIGHT_SPP: how many times each frame's 3D is drawn (1 unset): a path tracer's samples a pixel, one a draw
-fn spp() -> u32 {
- static N: std::sync::OnceLock<u32> = std::sync::OnceLock::new();
- *N.get_or_init(|| std::env::var("RAEA_LIGHT_SPP").ok().and_then(|v| v.parse().ok()).filter(|n| *n >= 1).unwrap_or(1))
-}
diff --git a/runtime/look/src/camera.rs b/runtime/look/src/camera.rs
index 58537cfc..f00a9001 100644
--- a/runtime/look/src/camera.rs
+++ b/runtime/look/src/camera.rs
@@ -274,6 +274,9 @@ pub fn motion_blur(all: &[Vec<Item>], p: &mut Program, row: &mut BTreeMap<String
if let Some(s) = num(&its[0].props, "samples") {
row.insert("mb_samples".into(), V::N(s));
}
+ if its[0].props.get("kind").and_then(Value::as_str) == Some("bevy") {
+ row.insert("mb_bevy".into(), V::N(1.0));
+ }
}
/// a part's `rotation` as glam's Quat [x, y, z, w] (Bevy's identity when it has none)
diff --git a/runtime/look/src/post.rs b/runtime/look/src/post.rs
index 32b34c3e..5bf10843 100644
--- a/runtime/look/src/post.rs
+++ b/runtime/look/src/post.rs
@@ -157,6 +157,14 @@ pub fn frame_post(its: &[Item]) -> BTreeMap<String, V> {
}
}
let aa = first("aa").and_then(|a| a.get("mode")).and_then(Value::as_str);
+ // steady's rates (systems/post steady.rs)
+ if let Some(s) = first("aa").and_then(|a| a.get("steady")).and_then(Value::as_object) {
+ for (prop, col) in [("still", "aa_steady_still"), ("moving", "aa_steady_moving"), ("px", "aa_steady_px")] {
+ if let Some(x) = num(s, prop) {
+ row.insert(col.into(), V::N(x));
+ }
+ }
+ }
match (aa, ssao.is_some()) {
(Some("msaa") | None, true) => {
row.insert("aa".into(), V::S("smaa".into()));
diff --git a/sdk/guides/craft/bevy/post.md b/sdk/guides/craft/bevy/post.md
index e65e4991..71e61f49 100644
--- a/sdk/guides/craft/bevy/post.md
+++ b/sdk/guides/craft/bevy/post.md
@@ -155,7 +155,7 @@ of Bloom and Grade that skips something. A scene with no pass pays nothing.
- `<MotionBlur shutterAngle={0.5} samples={4} />`: fast moves smear (0.5 is a film camera's 180-degree shutter; 1 a
whole frame). It animates per frame, and a frame without the element has none, so `{fast ? <MotionBlur /> : null}`
- blurs only the whip.
+ blurs only the whip. `kind="bevy"` swaps raea's shutter for Bevy's own blur, to compare the two.
- It blurs inside moving parts and whole-frame camera moves; a part's silhouette over a still background, and toon ink
lines, stay sharp (Bevy's method).
- With it, each frame is drawn after the one before it, so a frame's blur is the same in a render, a seek and play.
diff --git a/sdk/guides/craft/bevy/solari.md b/sdk/guides/craft/bevy/solari.md
index 0be038f9..4653b881 100644
--- a/sdk/guides/craft/bevy/solari.md
+++ b/sdk/guides/craft/bevy/solari.md
@@ -21,7 +21,7 @@
the denoiser, 4 and 2 look the same in most rooms and save time.
- Every other choice the engine makes for the traced light is a prop too, so an A/B is two compositions, never a
build: `denoise`, `guides`, `reflectionDepth`, `emissive` ("taa", "split", "mask"), `upscale` ("one", "two"),
- `preexposure`, `aa`, `jitter`, `jitterFrames`, `emissiveSharpness`, `firstBounce`, `confidenceCap` and `cache` (the world cache's
+ `preexposure`, `aa`, `jitter`, `jitterFrames`, `emissiveSharpness`, `dynamic`, `firstBounce`, `confidenceCap` and `cache` (the world cache's
`frames`, `lightSamples`, `reach`, `updates`, `cellSize`, `lodScale`). Each prop's TSDoc says what it changes. The
defaults are the measured best, so leave them unless a test scene shows otherwise. A developer's environment
variable of the same setting (`RAEA_SOLARI_DENOISE=0`, `RAEA_METALFX_PREEXPOSURE=4`) overrides the prop on every
@@ -33,7 +33,8 @@
- Keep a look's settings as a TypeScript object and spread it: `const LIVE = { primarySamples: 4, scale: 0.67 }`,
then `<SolariLighting {...LIVE} />` or `<SolariLighting {...LIVE} preexposure={32} />`.
- For a still to judge the look against, use `<Pathtracer />` in its place: exact and slow, accumulating while the
- view holds still. It isn't for motion.
+ view holds still. It isn't for motion. `<Pathtracer samples={256} />` has a render draw each frame that many times,
+ so a reference still converges; `media={false}` leaves the fog volumes' air out.
- Light the scene with what Solari sees:
- a `DirectionalLight` (the sun);
- emissive surfaces: a `StandardMaterial` with `emissive`. A fluorescent tube is a thin glowing box, a bulb a small
diff --git a/sdk/render/src/3d/effects.tsx b/sdk/render/src/3d/effects.tsx
index 53db8f8c..e990f40b 100644
--- a/sdk/render/src/3d/effects.tsx
+++ b/sdk/render/src/3d/effects.tsx
@@ -392,6 +392,9 @@ export interface AntiAliasingProps {
* The others draw a frame from that frame alone, so a render equals its play; "steady" needs the frames before, so a
* render that starts partway through differs from its play for its first few frames */
mode: "msaa" | "smaa" | "fxaa" | "none" | "steady";
+ /** "steady"'s rates: the frames a still pixel's history averages (32), a moving one's (8), and the motion in pixels
+ * at which a pixel counts as moving (4). Fewer frames follow change sooner and settle less */
+ steady?: { still?: number; moving?: number; px?: number };
}
/** How the 3D's edges are smoothed. Put it inside the Canvas3D, once; each frame's is its own.
@@ -399,6 +402,7 @@ export interface AntiAliasingProps {
* @bevy bevy_anti_alias::fxaa::Fxaa */
export function AntiAliasing(props: AntiAliasingProps) {
if (!["msaa", "smaa", "fxaa", "none", "steady"].includes(props.mode)) throw new RangeError(`AntiAliasing: mode must be "msaa", "smaa", "fxaa", "none" or "steady", got ${JSON.stringify(props.mode)}`);
+ for (const [k, v] of Object.entries(props.steady ?? {})) if (!(typeof v === "number" && v > 0)) throw new RangeError(`AntiAliasing: steady.${k} must be a number over 0, got ${v}`);
return node3d("AntiAliasing", props as unknown as Record<string, unknown>);
}
diff --git a/sdk/render/src/3d/post.tsx b/sdk/render/src/3d/post.tsx
index 52493f96..eb9a7f3e 100644
--- a/sdk/render/src/3d/post.tsx
+++ b/sdk/render/src/3d/post.tsx
@@ -203,6 +203,9 @@ export interface MotionBlurProps {
shutterAngle?: number;
/** samples each way per pixel (4 by default) */
samples?: number;
+ /** "shutter" (the default: raea's, two taps a pixel for each sample each way) or "bevy" (Bevy's MotionBlur, to
+ * compare against) */
+ kind?: "shutter" | "bevy";
/** declared animation of its numbers */
animate?: Animate3d;
}
@@ -216,6 +219,7 @@ export function MotionBlur(props: MotionBlurProps) {
useSequenceFrames("MotionBlur", undefined, [["animate's first key", firstKey(props.animate)]]);
const anim = useAnimation3d(props.animate);
const p = apply3d({ ...props, animate: undefined } as Record<string, unknown>, anim.values);
+ if (p.kind !== undefined && p.kind !== "shutter" && p.kind !== "bevy") throw new RangeError(`${owner}: kind must be "shutter" or "bevy", got ${JSON.stringify(p.kind)}`);
for (const [k, lo, hi] of [["shutterAngle", 0, 4], ["samples", 1, 32]] as const) {
const v = p[k];
if (v !== undefined && !(typeof v === "number" && v >= lo && v <= hi)) throw new RangeError(`${owner}: ${k} must be in [${lo}, ${hi}], got ${v}`);
diff --git a/sdk/render/src/bevy3d/raytracing.tsx b/sdk/render/src/bevy3d/raytracing.tsx
index 9ab8a2ca..be1c797d 100644
--- a/sdk/render/src/bevy3d/raytracing.tsx
+++ b/sdk/render/src/bevy3d/raytracing.tsx
@@ -72,6 +72,10 @@ export interface SolariLightingProps {
/** the jitter's cycle at the full size, in frames: a view drawn at s of its size a side cycles through
* jitterFrames / s² offsets, and an emissive twig glimpsed through it may stay away that long. Default 8 (DLSS's) */
jitterFrames?: number;
+ /** the traced scene follows what moves (a trial, false by default): a skinned character's traced twin is posed each
+ * frame, so it casts traced shadows and bounces light, and a hidden part leaves the traced scene. Decided as each
+ * mesh is first traced, so set it from the first frame */
+ dynamic?: boolean;
/** constants in Solari's and the denoiser's shaders, compiled in when the scene loads (a value changed later in the
* composition isn't drawn); each left out keeps the shader's own, given in brackets. <ShaderConstants> reaches the
* rest */
@@ -188,6 +192,7 @@ export function solariSettings(p: SolariLightingProps): Record<string, unknown>
if (p.jitter !== undefined) v.jitter = p.jitter === "denoiser" ? "" : p.jitter === "none" ? "0" : p.jitter;
if (p.emissiveSharpness !== undefined) v.emissive_sharpness = p.emissiveSharpness;
if (p.jitterFrames !== undefined) v.jitter_frames = p.jitterFrames;
+ if (p.dynamic !== undefined) v.dynamic = p.dynamic;
return Object.keys(v).length ? v : undefined;
}
@@ -195,7 +200,7 @@ export function solariSettings(p: SolariLightingProps): Record<string, unknown>
* light and reflections traced against the scene, in place of shadow maps. Needs a GPU with ray queries (Apple
* silicon on Metal, RTX on Vulkan); elsewhere the scene draws raster-lit and raea says so. On the Mac MetalFX's
* temporal denoiser cleans it up (RT4; denoise={false} shows the raw noise). A <Character> (skinned, morphed) stays
- * raster-lit: Bevy 0.20's Solari can't trace it (RT5). */
+ * raster-lit: Bevy 0.20's Solari can't trace it (RT5), unless `dynamic` gives a skinned one a traced twin. */
export function SolariLighting(p: SolariLightingProps = {}) {
if (p.bounces !== undefined && !(Number.isInteger(p.bounces) && p.bounces >= 0)) throw new RangeError(`SolariLighting: bounces is a whole number, got ${p.bounces}`);
if (p.scale !== undefined && !(p.scale >= 1 / 3 && p.scale <= 1)) throw new RangeError(`SolariLighting: scale is a third to 1 (of the view's size a side), got ${p.scale}`);
@@ -238,10 +243,23 @@ export function SolariLighting(p: SolariLightingProps = {}) {
export interface PathtracerProps {
/** start the accumulation again */
reset?: boolean;
+ /** how many times a render draws each frame, each draw one more sample a pixel, the last kept (1 by default): 256 or
+ * more converges a reference still. Its accumulation starts afresh each frame, so a moved part isn't smeared */
+ samples?: number;
+ /** whether its rays walk the fog volumes, scattering in the air (true by default); false for a frame without the
+ * air */
+ media?: boolean;
}
/** Bevy's reference path tracer for the <Camera3d> it's inside: slow and exact, accumulating over frames while the
* view holds still. For stills to check a look against, not for motion. Same GPU needs as <SolariLighting>. */
export function Pathtracer(p: PathtracerProps = {}) {
- return <BevyComponent type="bevy_solari::pathtracer::Pathtracer" value={{ reset: p.reset ?? false }} />;
+ if (p.samples !== undefined && !(Number.isInteger(p.samples) && p.samples >= 1)) throw new RangeError(`Pathtracer: samples must be a whole number from 1, got ${p.samples}`);
+ const settings = p.samples !== undefined || p.media !== undefined;
+ return (
+ <>
+ <BevyComponent type="bevy_solari::pathtracer::Pathtracer" value={{ reset: p.reset ?? false }} />
+ {settings && <BevyComponent type="raea_sys_frame::pathtracer::PathtracerSettings" value={{ samples: p.samples ?? 1, media: p.media ?? true }} />}
+ </>
+ );
}
diff --git a/systems/fog/src/froxel.rs b/systems/fog/src/froxel.rs
index f65e4198..4f83b219 100644
--- a/systems/fog/src/froxel.rs
+++ b/systems/fog/src/froxel.rs
@@ -198,7 +198,7 @@ fn extract_volumes(mut volumes: ResMut<Volumes>, q: Extract<Query<(&FogVolume, &
volumes.corners = found.iter().map(|f| f.2).collect();
}
-fn prepare_volumes(mut volumes: ResMut<Volumes>, device: Res<RenderDevice>, queue: Res<RenderQueue>, media: Option<ResMut<PathtracerMedia>>) {
+fn prepare_volumes(mut volumes: ResMut<Volumes>, device: Res<RenderDevice>, queue: Res<RenderQueue>, media: Option<ResMut<PathtracerMedia>>, traced: Query<&raea_sys_frame::pathtracer::PathtracerSettings>) {
// never empty: a storage buffer needs a size
let mut list = volumes.list.clone();
if list.is_empty() {
@@ -206,12 +206,10 @@ fn prepare_volumes(mut volumes: ResMut<Volumes>, device: Res<RenderDevice>, queu
}
*volumes.buffer.get_mut() = list;
volumes.buffer.write_buffer(&device, &queue);
- // the reference path tracer walks the same volumes (bevy_solari pathtracer/media.wesl); RAEA_PT_MEDIA=0 leaves
- // them out of it, for a frame without its air
+ // the reference path tracer walks the same volumes (bevy_solari pathtracer/media.wesl); <Pathtracer media={false}>
+ // (or RAEA_PT_MEDIA=0) leaves them out of it, for a frame without its air
if let Some(mut media) = media {
- static OFF: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
- let off = *OFF.get_or_init(|| std::env::var("RAEA_PT_MEDIA").is_ok_and(|v| v == "0"));
- media.0 = if off { None } else { volumes.buffer.buffer().cloned() };
+ media.0 = if raea_sys_frame::pathtracer::media(&traced) { volumes.buffer.buffer().cloned() } else { None };
}
}
diff --git a/systems/frame/src/lib.rs b/systems/frame/src/lib.rs
index 5dae0cc1..cea928b7 100644
--- a/systems/frame/src/lib.rs
+++ b/systems/frame/src/lib.rs
@@ -12,6 +12,8 @@ use raea_core_program::ir::{Program, V};
pub mod bevy_api;
// the engine's shaders read from files at load: a project's engine-shaders/, RAEA_ENGINE_SHADERS (docs/nobuild.feature NB5b)
pub mod engine_shaders;
+// <Pathtracer>'s samples and media (docs/nobuild.feature NB1a)
+pub mod pathtracer;
/// a camera row's order, clear and viewport among the cameras on its target
pub mod camera;
/// a GPU error as the frame's error (#66), Bevy's RenderErrorHandler in the engine
diff --git a/systems/frame/src/pathtracer.rs b/systems/frame/src/pathtracer.rs
new file mode 100644
index 00000000..a3aedc05
--- /dev/null
+++ b/systems/frame/src/pathtracer.rs
@@ -0,0 +1,50 @@
+//! <Pathtracer>'s settings beside Bevy's Pathtracer (docs/nobuild.feature NB1a): how many times a render draws each
+//! frame, each draw one more sample a pixel (`samples`), and whether the traced air walks the fog volumes (`media`).
+//! Here, not in raea-render-raytrace, because raea-sys-fog reads `media` and a system can't use the runtime layer.
+//! RAEA_LIGHT_SPP and RAEA_PT_MEDIA=0 override them on every camera, said once.
+use bevy::prelude::*;
+use bevy::render::extract_component::ExtractComponent;
+
+#[derive(Component, Reflect, Clone, Copy, Debug, PartialEq, ExtractComponent)]
+#[extract_app(bevy::render::RenderApp)]
+#[reflect(Component, Default)]
+pub struct PathtracerSettings {
+ pub samples: u32,
+ pub media: bool,
+}
+
+impl Default for PathtracerSettings {
+ fn default() -> Self {
+ Self { samples: 1, media: true }
+ }
+}
+
+fn say(var: &str, v: &str, prop: &str) {
+ static SAID: std::sync::Mutex<Vec<String>> = std::sync::Mutex::new(Vec::new());
+ let mut said = SAID.lock().unwrap_or_else(|e| e.into_inner());
+ if !said.iter().any(|s| s == var) {
+ said.push(var.into());
+ eprintln!("raea: <Pathtracer> on every camera: {var}={v} over {prop} (docs/nobuild.feature NB1a)");
+ }
+}
+
+/// The draws a render takes of each frame: RAEA_LIGHT_SPP, else the most any 3D camera's <Pathtracer samples> asks
+/// for (1 with none).
+pub fn samples(world: &mut World) -> u32 {
+ if let Some(n) = std::env::var("RAEA_LIGHT_SPP").ok().and_then(|v| v.parse::<u32>().ok()).filter(|n| *n >= 1) {
+ say("RAEA_LIGHT_SPP", &n.to_string(), "samples");
+ return n;
+ }
+ let mut q = world.query_filtered::<&PathtracerSettings, With<Camera3d>>();
+ q.iter(world).map(|s| s.samples).max().unwrap_or(1).max(1)
+}
+
+/// Whether the path tracer walks the fog volumes: not with RAEA_PT_MEDIA=0, nor where a view's <Pathtracer media> is
+/// false (the volumes are one list for every view).
+pub fn media<'a>(views: impl IntoIterator<Item = &'a PathtracerSettings>) -> bool {
+ if std::env::var("RAEA_PT_MEDIA").is_ok_and(|v| v == "0") {
+ say("RAEA_PT_MEDIA", "0", "media");
+ return false;
+ }
+ views.into_iter().all(|s| s.media)
+}
diff --git a/systems/post/src/camera.rs b/systems/post/src/camera.rs
index 752f8273..4cc60936 100644
--- a/systems/post/src/camera.rs
+++ b/systems/post/src/camera.rs
@@ -25,7 +25,7 @@ const GROUPS: [Group; 11] = [
Group { keys: |k| k.starts_with("grade_"), on: on::grading, off: |w, e| { w.entity_mut(e).insert(bevy::render::view::ColorGrading::default()); } },
Group { keys: |k| k.starts_with("vignette"), on: on::vignette, off: remove::<bevy::post_process::effect_stack::Vignette> },
// the temporal filter goes with its jitter, which would otherwise keep moving the levels' dither with no filter
- Group { keys: |k| k.starts_with("ssao") || k == "aa", on: on::aa, off: remove::<(bevy::pbr::ScreenSpaceAmbientOcclusion, bevy::anti_alias::smaa::Smaa, bevy::anti_alias::fxaa::Fxaa, crate::steady::Steady, bevy::render::camera::TemporalJitter)> },
+ Group { keys: |k| k.starts_with("ssao") || k == "aa" || k.starts_with("aa_"), on: on::aa, off: remove::<(bevy::pbr::ScreenSpaceAmbientOcclusion, bevy::anti_alias::smaa::Smaa, bevy::anti_alias::fxaa::Fxaa, crate::steady::Steady, bevy::render::camera::TemporalJitter)> },
// depth of field: on with the frames that have one (their post set has dof_max), its aperture and focus following
// the frame in sync_camera (RR1: it went on once, with the camera, so a play opening on a shot without it had none)
Group { keys: |k| k == "dof_max" || k == "dof_mode", on: on::dof, off: remove::<bevy::post_process::dof::DepthOfField> },
diff --git a/systems/post/src/camera/on.rs b/systems/post/src/camera/on.rs
index d06a6250..5c9b268e 100644
--- a/systems/post/src/camera/on.rs
+++ b/systems/post/src/camera/on.rs
@@ -165,7 +165,7 @@ pub fn aa(world: &mut World, e: Entity, vals: &Vals) {
// scenes measured with it). Its depth and motion prepasses are read single-sampled (PrepassRead keeps MSAA off).
let steady = matches!(vals.get("aa"), Some(V::S(m)) if m == "steady") || std::env::var_os("RAEA_STEADY").is_some();
if steady && !preview() && world.get::<Camera3d>(e).is_some() {
- world.entity_mut(e).insert((crate::steady::Steady, raea_sys_compose::passes::PrepassRead, Msaa::Off));
+ world.entity_mut(e).insert((crate::steady::Steady::of(vals), raea_sys_compose::passes::PrepassRead, Msaa::Off));
}
match vals.get("aa") {
Some(V::S(m)) if m == "smaa" && !preview() => {
diff --git a/systems/post/src/motion_blur.rs b/systems/post/src/motion_blur.rs
index c51afd9b..c9ab7312 100644
--- a/systems/post/src/motion_blur.rs
+++ b/systems/post/src/motion_blur.rs
@@ -35,9 +35,17 @@ fn blur_of(v: &BTreeMap<String, V>) -> Option<MotionBlur> {
(num(v, "mb_on", 0.0) > 0.5 && b.shutter_angle > 0.0).then_some(b)
}
-/// Whether the camera's blur is Bevy's MotionBlur (RAEA_MOTION_BLUR=bevy) rather than raea's Shutter.
-fn bevy_blur() -> bool {
- std::env::var("RAEA_MOTION_BLUR").is_ok_and(|v| v == "bevy")
+/// Whether the camera's blur is Bevy's MotionBlur (<MotionBlur kind="bevy">) rather than raea's Shutter; RAEA_MOTION_BLUR
+/// (bevy or shutter) overrides it on every camera, said once (docs/nobuild.feature NB1a).
+fn bevy_blur(v: &BTreeMap<String, V>) -> bool {
+ match std::env::var("RAEA_MOTION_BLUR").as_deref() {
+ Ok(k @ ("bevy" | "shutter")) => {
+ static SAID: std::sync::Once = std::sync::Once::new();
+ SAID.call_once(|| eprintln!("raea: <MotionBlur> on every camera: RAEA_MOTION_BLUR={k} over kind (docs/nobuild.feature NB1a)"));
+ k == "bevy"
+ }
+ _ => num(v, "mb_bevy", 0.0) > 0.5,
+ }
}
/// raea's shutter for a frame's blur: as long open, two taps a pixel for each of Bevy's samples each way.
@@ -47,13 +55,12 @@ fn shutter_of(b: &MotionBlur) -> Shutter {
/// The frame's blur onto the camera: inserted, changed or removed as the frame's columns say.
pub fn sync_motion_blur(frame: Res<FrameRows>, mut commands: Commands, cams: Query<(Entity, Option<&MotionBlur>, Option<&Shutter>), With<Camera3d>>) {
- let bevy = bevy_blur();
for (e, mb, shutter) in &cams {
let Some(v) = frame.vals(e) else { continue };
if !has_blur(&v) {
continue;
}
- if !bevy {
+ if !bevy_blur(&v) {
match (blur_of(&v).map(|b| shutter_of(&b)), shutter) {
(Some(want), Some(s)) if *s == want => {}
(Some(want), _) => {
diff --git a/systems/post/src/steady.rs b/systems/post/src/steady.rs
index de947baa..4165c5ce 100644
--- a/systems/post/src/steady.rs
+++ b/systems/post/src/steady.rs
@@ -36,11 +36,32 @@ use bevy::{
},
};
-/// A camera whose frames are steadied over time (RAEA_STEADY). Brings the jitter and the prepasses it reads.
-#[derive(Component, Clone, Copy, Default, ExtractComponent)]
+/// A camera whose frames are steadied over time (<AntiAliasing mode="steady">, or RAEA_STEADY on every camera). Brings
+/// the jitter and the prepasses it reads. Its rates (<AntiAliasing steady>, docs/nobuild.feature NB1a): the frames a
+/// still pixel's history averages, a moving one's, and the motion in pixels at which a pixel counts as moving.
+#[derive(Component, Clone, Copy, PartialEq, Debug, ExtractComponent)]
#[extract_app(bevy::render::RenderApp)]
#[require(TemporalJitter, DepthPrepass, MotionVectorPrepass)]
-pub struct Steady;
+pub struct Steady {
+ pub still: f32,
+ pub moving: f32,
+ pub px: f32,
+}
+
+impl Default for Steady {
+ fn default() -> Self {
+ Self { still: 32.0, moving: 8.0, px: 4.0 }
+ }
+}
+
+impl Steady {
+ /// the camera row's rates (`aa_steady_*`), each RAEA_STEADY_* variable over its prop
+ pub fn of(vals: &std::collections::BTreeMap<String, raea_core_program::ir::V>) -> Self {
+ let d = Self::default();
+ let at = |col: &str, var: &str, d: f32| env(var).unwrap_or_else(|| raea_sys_frame::num(vals, col, d)).max(f32::MIN_POSITIVE);
+ Self { still: at("aa_steady_still", "RAEA_STEADY_STILL", d.still), moving: at("aa_steady_moving", "RAEA_STEADY_MOVING", d.moving), px: at("aa_steady_px", "RAEA_STEADY_PX", d.px) }
+ }
+}
/// the history's format: this frame blended with those before (rgb, linear), and how many frames the pixel
/// has been in view (a)
@@ -82,8 +103,8 @@ struct SteadyFrame {
params: Buffer,
}
-fn env(name: &str, default: f32) -> f32 {
- std::env::var(name).ok().and_then(|v| v.parse().ok()).filter(|v: &f32| *v > 0.0).unwrap_or(default)
+fn env(name: &str) -> Option<f32> {
+ std::env::var(name).ok().and_then(|v| v.parse().ok()).filter(|v: &f32| *v > 0.0)
}
/// Each steadied view's histories, swapped each frame, and its parameters: the slowest and fastest rates a frame, the
@@ -94,11 +115,11 @@ fn textures(
mut cache: ResMut<TextureCache>,
device: Res<RenderDevice>,
frame: Res<FrameCount>,
- views: Query<(Entity, &ExtractedCamera, Option<&crate::cut::CameraCut>), With<Steady>>,
+ views: Query<(Entity, &ExtractedCamera, Option<&crate::cut::CameraCut>, &Steady)>,
mut seen: Local<HashMap<Entity, UVec2>>,
) {
- let (still, moving, px) = (1.0 / env("RAEA_STEADY_STILL", 32.0), 1.0 / env("RAEA_STEADY_MOVING", 8.0), env("RAEA_STEADY_PX", 4.0));
- for (e, camera, cut) in &views {
+ for (e, camera, cut, st) in &views {
+ let (still, moving, px) = (1.0 / st.still, 1.0 / st.moving, st.px);
let Some(size) = camera.physical_target_size else { continue };
let desc = |label: &'static str| TextureDescriptor {
label: Some(label),
diff --git a/tools/nobuild.sh b/tools/nobuild.sh
index 371ae5a6..649469cb 100755
--- a/tools/nobuild.sh
+++ b/tools/nobuild.sh
@@ -151,7 +151,9 @@ diff_levels() {
}
# one render of a props.tsv scene: its composition on its light path with the variables given, into OUT; beside it
-# OUT.settings, the run's settings records (fog_settings, solari_settings) without what names the run
+# OUT.settings, the run's settings records (fog_settings, solari_settings) without what names the run. The light path:
+# raster (as the scene asks), solari (RAEA_LIGHT=solari on every camera), traced (the scene asks for Solari or the
+# path tracer itself)
props_render() {
local scene=$1 comp=$2 light=$3 out=$4; shift 4
local tdir=$out.trace l=()
@@ -167,34 +169,35 @@ props() {
local rows=$RAEA/tools/nobuild/props.tsv out=$DOCS/props.tsv
[ -x "$bin" ] || { echo "nobuild: no raea at $bin (RAEA_BIN)" >&2; exit 1; }
local dir; dir=$(mktemp -d "${TMPDIR:-/tmp}/nobuild-props.XXXXXX") || exit 1
- printf '# scene\tcomposition\tvariables\tlight\tframe\tprop vs variable (mean, max levels)\tnoise (base twice, mean)\tprop vs base (mean)\tsettings in the trace\tverdict\n' > "$out"
+ printf '# scene\tcomposition\tagainst\tvariables\tlight\tframe\tprop vs variable (mean, max levels)\tnoise (against twice, mean)\tprop vs against (mean)\tsettings in the trace\tverdict\n' > "$out"
local fails=0
- while IFS=$'\t' read -r scene comp vars light frame; do
+ while IFS=$'\t' read -r scene comp against vars light frame; do
case $scene in '#'* | '') continue ;; esac
local f; f=$(printf 'frame-%05d.png' "$frame")
- local b="$dir/${scene%.tsx}-$light-base"
- # the scene's base twice, once a scene and light path: their difference is the run-to-run noise
+ local b="$dir/${scene%.tsx}-$against-$light"
+ # the composition the variables go on, twice, once a scene and light path: their difference is the run-to-run noise
if [ ! -d "$b" ]; then
- props_render "$scene" base "$light" "$b"
- props_render "$scene" base "$light" "$b.2"
+ props_render "$scene" "$against" "$light" "$b"
+ props_render "$scene" "$against" "$light" "$b.2"
fi
- local p="$dir/$comp-prop" v="$dir/$comp-var"
+ local p="$dir/${scene%.tsx}-$comp-prop" v="$dir/${scene%.tsx}-$comp-var"
props_render "$scene" "$comp" "$light" "$p"
# shellcheck disable=SC2086 # the variables are words
- props_render "$scene" base "$light" "$v" $vars
+ props_render "$scene" "$against" "$light" "$v" $vars
local mae pae noise moved trace verdict
mae=$(diff_levels MAE "$p/$f" "$v/$f"); pae=$(diff_levels PAE "$p/$f" "$v/$f")
noise=$(diff_levels MAE "$b/$f" "$b.2/$f"); moved=$(diff_levels MAE "$p/$f" "$b/$f")
- if [ -s "$p.settings" ] && cmp -s "$p.settings" "$v.settings"; then trace=same; else trace=differ; fi
- # raster draws the same pixels twice: the prop and the variable must too; Solari's frames differ run to run, so
- # theirs must be as near as two base runs and the prop must move the frame well past that
+ # (a setting with no record of its own, as steady's or the blur's, is checked by its pixels alone)
+ if ! cmp -s "$p.settings" "$v.settings"; then trace=differ; elif [ -s "$p.settings" ]; then trace=same; else trace=none; fi
+ # raster draws the same pixels twice: the prop and the variable must too; a traced frame differs run to run, so
+ # theirs must be as near as two runs of the same and the prop must move the frame well past that
verdict=$(awk -v l="$light" -v mae="$mae" -v pae="$pae" -v n="$noise" -v m="$moved" -v t="$trace" -v img="$p/$f" 'BEGIN {
if (mae == "" || m == "") { print "no frame (" img ")"; exit }
same = l == "raster" ? pae == 0 : mae <= 2 * n + 0.002
moves = l == "raster" ? m > 0 : m > 4 * n + 0.01
- print (same && moves && t == "same") ? "pass" : "FAIL" (same ? "" : ": prop and variable differ") (moves ? "" : ": the prop changes nothing") (t == "same" ? "" : ": settings differ") }')
+ print (same && moves && t != "differ") ? "pass" : "FAIL" (same ? "" : ": prop and variable differ") (moves ? "" : ": the prop changes nothing") (t != "differ" ? "" : ": settings differ") }')
[ "$verdict" = pass ] || fails=$((fails + 1))
- printf '%s\t%s\t%s\t%s\t%s\t%s, %s\t%s\t%s\t%s\t%s\n' "$scene" "$comp" "$vars" "$light" "$frame" "$mae" "$pae" "$noise" "$moved" "$trace" "$verdict" | tee -a "$out"
+ printf '%s\t%s\t%s\t%s\t%s\t%s\t%s, %s\t%s\t%s\t%s\t%s\n' "$scene" "$comp" "$against" "$vars" "$light" "$frame" "$mae" "$pae" "$noise" "$moved" "$trace" "$verdict" | tee -a "$out"
done < "$rows"
echo "nobuild: $(grep -vc '^#' "$out") props against their variables in ${out#"$RAEA"/}, $fails failing, by $bin"
if [ "$fails" = 0 ]; then rm -rf -- "${dir:?}"; else echo "nobuild: renders kept in $dir"; exit 1; fi
diff --git a/tools/nobuild/blur.tsx b/tools/nobuild/blur.tsx
new file mode 100644
index 00000000..683a5a6c
--- /dev/null
+++ b/tools/nobuild/blur.tsx
@@ -0,0 +1,29 @@
+import { Composition, registerRoot, useCurrentFrame } from "raea";
+import { MotionBlur } from "raea/post_process";
+import { Camera3d } from "raea/camera";
+import { DirectionalLight } from "raea/light";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { Transform } from "raea/transform";
+
+// docs/nobuild.feature NB1a: <MotionBlur kind> against RAEA_MOTION_BLUR (tools/nobuild.sh props). A block whipping
+// across a still floor.
+function Scene({ kind }: { kind: "shutter" | "bevy" }) {
+ const f = useCurrentFrame();
+ return (
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 1.5, 5).lookingAt([0, 0.5, 0])} />
+ <MotionBlur shutterAngle={1} kind={kind} />
+ <DirectionalLight illuminance={6000} transform={Transform.fromXyz(3, 5, 2).lookingAt([0, 0, 0])} />
+ <Mesh3d><Cuboid half_size={[5, 0.02, 5]} /><StandardMaterial base_color="#3a3d44" /></Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(-3 + f * 0.6, 0.5, 0)}><Cuboid half_size={[0.4, 0.4, 0.4]} /><StandardMaterial base_color="#f1c40f" /></Mesh3d>
+ </>
+ );
+}
+
+registerRoot(() => (
+ <>
+ <Composition id="shutter" component={() => <Scene kind="shutter" />} width={320} height={180} fps={30} durationInFrames={8} />
+ <Composition id="bevy" component={() => <Scene kind="bevy" />} width={320} height={180} fps={30} durationInFrames={8} />
+ </>
+));
diff --git a/tools/nobuild/props.tsv b/tools/nobuild/props.tsv
index af1c6473..20d92b07 100644
--- a/tools/nobuild/props.tsv
+++ b/tools/nobuild/props.tsv
@@ -1,13 +1,20 @@
# Each knob's prop against the variable it replaced (tools/nobuild.sh props, docs/nobuild.feature NB1a): the scene, the
-# composition that sets the prop, the variables the scene's base composition is rendered with instead, the light path
-# (raster or solari) and the frame compared. Raster frames are compared exactly; Solari's against two base runs' noise.
-# scene composition variables light frame
-fog.tsx shadow RAEA_FOG_SHADOW=off raster 1
-fog.tsx exact RAEA_FOG_HERO_EXACT=1 raster 1
-fog.tsx tricubic RAEA_FOG_TRICUBIC_T=1 raster 1
-fog.tsx epi RAEA_FOG_EPI=16,6,4 raster 1
-fog.tsx grid RAEA_FOG_GRID=8,96,1 raster 1
-fog.tsx nohero RAEA_FOG_HERO=0 raster 1
-fog.tsx march RAEA_FOG_MODE=march raster 1
-fog.tsx solari RAEA_FOG_SOLARI_CANDIDATES=1 RAEA_FOG_SOLARI_FRAMES=1 RAEA_FOG_SOLARI_SKY=2 RAEA_FOG_SOLARI_PARTS=lamps RAEA_FOG_SOLARI_FILTER=0 RAEA_FOG_SOLARI_GUIDE=1 solari 23
-fog.tsx solarioff RAEA_FOG_SOLARI=0 solari 23
+# composition that sets the prop, the composition rendered with the variables instead, the variables, the light path
+# (raster; solari, RAEA_LIGHT=solari; traced, the scene's own Solari or path tracer) and the frame compared. Raster
+# frames are compared exactly; traced ones against two runs' noise.
+# scene composition against variables light frame
+fog.tsx shadow base RAEA_FOG_SHADOW=off raster 1
+fog.tsx exact base RAEA_FOG_HERO_EXACT=1 raster 1
+fog.tsx tricubic base RAEA_FOG_TRICUBIC_T=1 raster 1
+fog.tsx epi base RAEA_FOG_EPI=16,6,4 raster 1
+fog.tsx grid base RAEA_FOG_GRID=8,96,1 raster 1
+fog.tsx nohero base RAEA_FOG_HERO=0 raster 1
+fog.tsx march base RAEA_FOG_MODE=march raster 1
+fog.tsx solari base RAEA_FOG_SOLARI_CANDIDATES=1 RAEA_FOG_SOLARI_FRAMES=1 RAEA_FOG_SOLARI_SKY=2 RAEA_FOG_SOLARI_PARTS=lamps RAEA_FOG_SOLARI_FILTER=0 RAEA_FOG_SOLARI_GUIDE=1 solari 23
+fog.tsx solarioff base RAEA_FOG_SOLARI=0 solari 23
+steady.tsx steady plain RAEA_STEADY=1 raster 11
+steady.tsx rates steady RAEA_STEADY_STILL=8 RAEA_STEADY_MOVING=2 RAEA_STEADY_PX=1 raster 11
+blur.tsx bevy shutter RAEA_MOTION_BLUR=bevy raster 6
+traced.tsx spp trace RAEA_LIGHT_SPP=4 traced 2
+traced.tsx nomedia trace RAEA_PT_MEDIA=0 traced 2
+traced.tsx dynamic solari RAEA_SOLARI_DYNAMIC=1 traced 11
diff --git a/tools/nobuild/steady.tsx b/tools/nobuild/steady.tsx
new file mode 100644
index 00000000..7cdf9b32
--- /dev/null
+++ b/tools/nobuild/steady.tsx
@@ -0,0 +1,43 @@
+import { Composition, registerRoot, useCurrentFrame } from "raea";
+import { AntiAliasing, type AntiAliasingProps } from "raea/post_process";
+import { Camera3d } from "raea/camera";
+import { DirectionalLight } from "raea/light";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { Transform } from "raea/transform";
+
+// docs/nobuild.feature NB1a: <AntiAliasing mode="steady" steady> against RAEA_STEADY and RAEA_STEADY_* (tools/nobuild.sh
+// props). Thin bars receding into the distance (detail a pixel wide, which steady settles) and a block sliding past
+// (motion, which it follows).
+const MODES: Record<string, AntiAliasingProps | undefined> = {
+ plain: undefined,
+ steady: { mode: "steady" },
+ rates: { mode: "steady", steady: { still: 8, moving: 2, px: 1 } },
+};
+
+function Scene({ aa }: { aa?: AntiAliasingProps }) {
+ const f = useCurrentFrame();
+ return (
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 1.2, 6).lookingAt([0, 0.6, -10])} />
+ {aa && <AntiAliasing {...aa} />}
+ <DirectionalLight illuminance={6000} transform={Transform.fromXyz(3, 5, 2).lookingAt([0, 0, 0])} />
+ <Mesh3d><Cuboid half_size={[6, 0.02, 30]} /><StandardMaterial base_color="#3a3d44" /></Mesh3d>
+ {Array.from({ length: 24 }, (_, i) => (
+ <Mesh3d key={i} transform={Transform.fromXyz(-3 + (i % 2) * 6, 0.6, 4 - i * 1.6)}>
+ <Cuboid half_size={[0.015, 0.6, 0.015]} />
+ <StandardMaterial base_color="#f0e8d8" />
+ </Mesh3d>
+ ))}
+ <Mesh3d transform={Transform.fromXyz(-2.5 + f * 0.4, 0.5, 1)}><Cuboid half_size={[0.5, 0.5, 0.5]} /><StandardMaterial base_color="#c0392b" /></Mesh3d>
+ </>
+ );
+}
+
+registerRoot(() => (
+ <>
+ {Object.entries(MODES).map(([id, aa]) => (
+ <Composition key={id} id={id} component={() => <Scene aa={aa} />} width={320} height={180} fps={30} durationInFrames={12} />
+ ))}
+ </>
+));
diff --git a/tools/nobuild/traced.tsx b/tools/nobuild/traced.tsx
new file mode 100644
index 00000000..5e79e9a8
--- /dev/null
+++ b/tools/nobuild/traced.tsx
@@ -0,0 +1,44 @@
+import { Composition, registerRoot, useCurrentFrame } from "raea";
+import { Camera3d } from "raea/camera";
+import { LinearRgba, Srgba } from "raea/color";
+import { DirectionalLight, Pathtracer, type PathtracerProps, SolariLighting, type SolariLightingProps } from "raea/light";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { FogVolume, StandardMaterial } from "raea/pbr";
+import { Transform } from "raea/transform";
+
+// docs/nobuild.feature NB1a: <Pathtracer samples media> against RAEA_LIGHT_SPP and RAEA_PT_MEDIA, and <SolariLighting
+// dynamic> against RAEA_SOLARI_DYNAMIC (tools/nobuild.sh props). A floor, a glowing panel, a volume of air, and a slab
+// over the floor that is there on the first frame only: hidden after, it still shadows the floor unless the traced scene
+// follows what moves (dynamic).
+const TRACED: Record<string, { pt?: PathtracerProps; solari?: SolariLightingProps }> = {
+ trace: { pt: {} },
+ spp: { pt: { samples: 4 } },
+ nomedia: { pt: { media: false } },
+ solari: { solari: {} },
+ dynamic: { solari: { dynamic: true } },
+};
+
+function Scene({ pt, solari }: { pt?: PathtracerProps; solari?: SolariLightingProps }) {
+ const f = useCurrentFrame();
+ return (
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 2.4, 5.5).lookingAt([0, 0.4, 0])}>
+ {pt && <Pathtracer {...pt} />}
+ {solari && <SolariLighting {...solari} />}
+ </Camera3d>
+ <DirectionalLight illuminance={8000} transform={Transform.fromXyz(1, 6, 1).lookingAt([0, 0, 0])} />
+ <Mesh3d><Cuboid half_size={[4, 0.05, 4]} /><StandardMaterial base_color="#b0aaa0" /></Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(-1.8, 1.2, -1.5)}><Cuboid half_size={[0.6, 0.6, 0.05]} /><StandardMaterial base_color="#000000" emissive={LinearRgba.from(Srgba.hex("#8ac4ff")).mul(4000)} /></Mesh3d>
+ {f < 1 && <Mesh3d transform={Transform.fromXyz(0.4, 1.6, 0.4)}><Cuboid half_size={[1.2, 0.05, 1.2]} /><StandardMaterial base_color="#202020" /></Mesh3d>}
+ <FogVolume name="air" position={[0, 1.5, 0]} scale={[8, 3, 8]} density={0.08} />
+ </>
+ );
+}
+
+registerRoot(() => (
+ <>
+ {Object.entries(TRACED).map(([id, t]) => (
+ <Composition key={id} id={id} component={() => <Scene {...t} />} width={240} height={135} fps={30} durationInFrames={id === "solari" || id === "dynamic" ? 12 : 3} />
+ ))}
+ </>
+));