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
Layer pass conformance (docs/review.feature R2e): a flat <Screen> and a skinned character (RobotExpressive, CC0, walking) in bench/layers/conformance.tsx, each one layer. A Screen carries its source stamp (engine/bundle stamp.rs PART_NAMES), and an ImagePlane or Screen panel gets its LayerKey and RAEA_HIDE_LAYERS visibility like a mesh (runtime/scene lib.rs bevy_parts; models.rs panels_rows sends its components). A fifth mutant, bind (a skinned mesh drawn in its bind pose, systems/frame layer.rs posed), fails at IoU 0.80, so the oracle checks the pose. All 18 layers IoU >= 0.962; all five mutants fail.
shinyobjectzb85409d738c0
diff --git a/bench/layers/conformance.tsx b/bench/layers/conformance.tsxindex 15652d32..8bdf12e2 100644--- a/bench/layers/conformance.tsx+++ b/bench/layers/conformance.tsx@@ -1,8 +1,10 @@// docs/review.feature R2e: every layer kind in one frame, overlapping, so the layer pass is checked against the oracle// (hide one layer, render again, the pixels that change) where layers meet: a square drawn as a 3D mesh, as a React-// component (used twice) and as a page element, text, an image, a rotated element and a .map() list. The page is over+// component (used twice) and as a page element, text, an image, a video, a rotated element and a .map() list, with a+// flat Screen (a quad in the 3D) and a skinned character walking (RobotExpressive, CC0). The page is over// the 3D, as a composition's always is. bench/layers/oracle.sh renders it.-import { AbsoluteFill, Composition, Img, Video, registerRoot, useCurrentFrame } from "raea";+import { AbsoluteFill, Composition, Img, Video, registerRoot, staticFile, useCurrentFrame } from "raea";+import { Model, Screen } from "raea/3d";import { StandardMaterial } from "raea/pbr";import { Cuboid, Mesh3d } from "raea/mesh";import { DirectionalLight } from "raea/light";@@ -30,6 +32,12 @@ const Shot = () => {<Cuboid half_size={[0.5, 0.5, 0.5]} /><StandardMaterial base_color="#e0a82e" /></Mesh3d>+ {/* a quad in the 3D showing a page of its own: one layer, the quad (what it shows is drawn off the frame) */}+ <Screen name="panel" crt={false} resolution={[160, 100]} size={[1.3]} position={[1.7, 1.25, -0.5]} rotation={[0, -0.45, 0]} background="#ffffff">+ <AbsoluteFill style={{ background: "#d23c3c", color: "#fff", fontSize: 28, padding: 12 }}>screen</AbsoluteFill>+ </Screen>+ {/* skinned: its triangles where its joints put them on the frame, not its bind pose */}+ <Model name="walker" src={staticFile("RobotExpressive.glb")} animation="Walking" position={[-1.5, -2.5, 0.3]} rotation={[0, 0.6, 0]} scale={0.6} /><Badge x={150 + f} y={150} color="#3366ff" /><Badge x={300} y={60} color="#cc3377" /><div style={{ position: "absolute", left: 210, top: 210, width: 90, height: 90, background: "#ff6a00" }} />diff --git a/bench/layers/mutants.sh b/bench/layers/mutants.shindex c2532ca6..66d20dc1 100755--- a/bench/layers/mutants.sh+++ b/bench/layers/mutants.sh@@ -1,7 +1,8 @@#!/bin/bash-# The layer pass's mutants (docs/review.feature R2e): the pass broken four ways on purpose (RAEA_LAYERS_MUTANT, in+# The layer pass's mutants (docs/review.feature R2e): the pass broken five ways on purpose (RAEA_LAYERS_MUTANT, in# raea-sys-layers): two layers' keys swapped, the 3D 2 px to the right, the 3D's occlusion ignored, the page drawn-# under the 3D. Each must fail compare.sh against the oracle; the unbroken pass must pass. Exits 1 when one doesn't.+# under the 3D, a skinned mesh in its bind pose. Each must fail compare.sh against the oracle; the unbroken pass must+# pass. Exits 1 when one doesn't.# bench/layers/mutants.sh ORACLE OUT (ORACLE: oracle.sh's folder; RAEA_BIN: the raea to run)cd "$(dirname "$0")/../.." || exit 2ORACLE=${1:?ORACLE: oracle.sh OUT folder}@@ -10,8 +11,9 @@ BIN=${RAEA_BIN:-$PWD/target/release/raea}export RAEA_SIGN=0 RAEA_MARK=0 RAEA_EXPORT_CACHE=0 RAEA_SOURCE_STAMPS=1 RAEA_AUDIO_MUTE=1 RAEA_LAYERS=1mkdir -p "$OUT/src"cp bench/layers/conformance.tsx bench/layers/badge.tsx "$ORACLE/src/pic.png" "$ORACLE/src/clip.mp4" "$OUT/src/"+mkdir -p "$OUT/src/media" && cp "$ORACLE/src/media/RobotExpressive.glb" "$OUT/src/media/"status=0-for m in none swap shift occlusion under; do+for m in none swap shift occlusion under bind; dorm -rf "${OUT:?}/$m"RAEA_LAYERS_MUTANT=$m "$BIN" render "$OUT/src/conformance.tsx" --at 10,45,80 -o "$OUT/$m" > "$OUT/$m.log" 2>&1 || { echo "FAIL the render ($m) failed"; tail -3 "$OUT/$m.log"; exit 1; }bench/layers/compare.sh "$ORACLE" "$OUT/$m/conformance.layers" > "$OUT/$m.compare" 2>&1diff --git a/bench/layers/oracle.sh b/bench/layers/oracle.shindex 661902f5..8beb4dc3 100755--- a/bench/layers/oracle.sh+++ b/bench/layers/oracle.sh@@ -13,6 +13,7 @@ export RAEA_SIGN=0 RAEA_MARK=0 RAEA_EXPORT_CACHE=0 RAEA_SOURCE_STAMPS=1 RAEA_AUDMOMENTS=(10 45 80)mkdir -p "$OUT/src"cp bench/layers/conformance.tsx bench/layers/badge.tsx "$OUT/src/"+mkdir -p "$OUT/src/media" && cp sdk/raea/bench/bevy/character/media/RobotExpressive.glb "$OUT/src/media/"magick -size 96x64 gradient:'#ffd400-#ff2d55' "$OUT/src/pic.png"ffmpeg -v error -y -f lavfi -i testsrc=size=240x136:rate=30:duration=4 -pix_fmt yuv420p "$OUT/src/clip.mp4" || exit 2read -r W H <<< "$(sed -n 's/.*width={\([0-9]*\)} height={\([0-9]*\)}.*/\1 \2/p' bench/layers/conformance.tsx)"@@ -24,7 +25,7 @@ B1=$(at conformance.tsx Badge 1); B2=$(at conformance.tsx Badge 2); LI=$(at conf# not the AbsoluteFill: its background over 3D is the 3D's clear (raea-runtime-export program.rs), behind every layer# and none of them, so hiding it changes nothing and the layer pass gives no layer thereKEYS=(- "$(at conformance.tsx Mesh3d 1)" "$(at conformance.tsx Mesh3d 2)" "$(at conformance.tsx Mesh3d 3)"+ "$(at conformance.tsx Mesh3d 1)" "$(at conformance.tsx Mesh3d 2)" "$(at conformance.tsx Mesh3d 3)" "$(at conformance.tsx Screen 1)" "$(at conformance.tsx Model 1)""$(at badge.tsx div 1)|$B1" "$(at badge.tsx span 1)|$B1" "$(at badge.tsx div 1)|$B2" "$(at badge.tsx span 1)|$B2""$(at conformance.tsx div 1)" "$(at conformance.tsx h1 1)" "$(at conformance.tsx Img 1)" "$(at conformance.tsx Video 1)" "$(at conformance.tsx div 2)""$(at conformance.tsx ul 1)" "$LI#one" "$LI#two" "$LI#three"diff --git a/engine/bundle/src/stamp.rs b/engine/bundle/src/stamp.rsindex d6a0d769..98db05b0 100644--- a/engine/bundle/src/stamp.rs+++ b/engine/bundle/src/stamp.rs@@ -37,7 +37,7 @@ const PARTS3D: &[&str] = &["raea/3d", "raea/mesh", "raea/sprite", "raea"];/// inside one (a Mesh3d reads its <Cuboid> child's props, and an extra prop there made it no shape at all)./// raea's page parts too (an Img, a Video, an AbsoluteFill), whose element is written in the SDK, unstamped: their use/// is the layer's place in the code-const PART_NAMES: &[&str] = &["Mesh3d", "Model", "SceneRoot", "Entity", "Sprite", "Text3D", "Text2d", "ImagePlane", "ShaderMesh", "Plate", "Decal", "Splat", "Grass", "Mesh2d", "Img", "Video", "OffthreadVideo", "AbsoluteFill"];+const PART_NAMES: &[&str] = &["Mesh3d", "Model", "SceneRoot", "Entity", "Sprite", "Text3D", "Text2d", "ImagePlane", "ShaderMesh", "Plate", "Decal", "Splat", "Grass", "Mesh2d", "Screen", "Img", "Video", "OffthreadVideo", "AbsoluteFill"];/// Package components that read their children's types, whose children are left as written (a wrapper there would/// hide a <Series.Sequence> from its <Series>, a <Cuboid> from its <Mesh3d>): every component of raea's 3D, material,diff --git a/runtime/scene/src/lib.rs b/runtime/scene/src/lib.rsindex 10f6e45b..e53da61b 100644--- a/runtime/scene/src/lib.rs+++ b/runtime/scene/src/lib.rs@@ -128,11 +128,15 @@ fn walk(n: &Node3, parent: Mat4, out: &mut Vec<Item>) {bevy_parts(n, &mut it);out.push(it)}- "ImagePlane" => out.push(item("panel", parent * local(&n.props), None)),+ // a picture in space or a live picture on a quad (<Screen>, raea-render screen.rs: a panel with a `screen`+ // column), with its layer key (bevy_parts)+ "ImagePlane" | "Screen" => {+ let mut it = item("panel", parent * local(&n.props), None);+ bevy_parts(n, &mut it);+ out.push(it)+ }// a picture pressed onto whatever surface its box crosses (<Decal>: raea-render's forward decal, its +y out of the surface)"Decal" => out.push(item("decal", parent * local(&n.props), None)),- // a live picture on a quad (<Screen>): a panel with a `screen` column (raea-render's screen.rs)- "Screen" => out.push(item("panel", parent * local(&n.props), None)),// footage behind the 3D, filling the camera's view (<Plate>, <Matchmove>): not moved by groups"Plate" => out.push(item("plate", Mat4::IDENTITY, None)),"PerspectiveCamera" | "DirectionalLight" | "PointLight" | "SpotLight" | "RectAreaLight" => {diff --git a/runtime/scene/src/models.rs b/runtime/scene/src/models.rsindex 38924824..56e79daf 100644--- a/runtime/scene/src/models.rs+++ b/runtime/scene/src/models.rs@@ -171,6 +171,7 @@ pub(crate) fn panels_rows(tr: &Tracks, names: &[String], p: &mut Program) {visible(p, &mut row, &id, &track);pass_column(p, &mut row, &id, &its, &names);p.spawns.push(("panel".into(), vec![row]));+ components(p, &id, &its);}}diff --git a/systems/frame/src/layer.rs b/systems/frame/src/layer.rsindex 70cdb68d..50421a33 100644--- a/systems/frame/src/layer.rs+++ b/systems/frame/src/layer.rs@@ -58,6 +58,7 @@ pub fn record(world: &mut World, f: i64) {/// A mesh's vertices in the world: posed by its joints' matrices (a skin's, in place of its transform) or `place`.fn posed(mesh: &Mesh, pos: &[[f32; 3]], joints: Option<&[Mat4]>, place: Mat4) -> Vec<Vec3> {use bevy::mesh::VertexAttributeValues as A;+ let joints = joints.filter(|_| !raea_sys_layers::mutant("bind"));let skin = joints.zip(mesh.try_attribute_option(Mesh::ATTRIBUTE_JOINT_INDEX).ok().flatten()).zip(mesh.try_attribute_option(Mesh::ATTRIBUTE_JOINT_WEIGHT).ok().flatten());match skin {Some(((joints, A::Uint16x4(ix)), A::Float32x4(wt))) => pos.iter().zip(ix).zip(wt).map(|((p, i), w)| {diff --git a/systems/layers/src/lib.rs b/systems/layers/src/lib.rsindex f0ca2026..0e584fef 100644--- a/systems/layers/src/lib.rs+++ b/systems/layers/src/lib.rs@@ -126,7 +126,7 @@ mod tests;/// RAEA_LAYERS_MUTANT (bench/layers/mutants.sh): the pass broken on purpose, so the oracle is seen to catch it./// `swap` the first two layers' keys, `shift` the 3D 2 px right, `occlusion` the 3D's farthest triangle wins over its-/// nearest, `under` the 3D drawn over the page.-pub(crate) fn mutant(name: &str) -> bool {+/// nearest, `under` the 3D drawn over the page, `bind` a skinned mesh drawn in its bind pose (systems/frame layer.rs).+pub fn mutant(name: &str) -> bool {std::env::var("RAEA_LAYERS_MUTANT").is_ok_and(|m| m == name)}