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
R3F21: done: docs/r3f.feature tags R3F21 @done: in-tsl-lit SSIM 0.9906 against three.js in Chrome, where 0.1.4 drew the blob black. The lit entry's imports go at the fragment module's top (WESL takes them nowhere else; a test holds it); tools/parity.sh runs in-tsl-lit; tools/shoot.ts takes a case name with dashes
shinyobjectzbfbfc91d40a5
diff --git a/docs/r3f.feature b/docs/r3f.featureindex 32cf1949..ba6dc857 100644--- a/docs/r3f.feature+++ b/docs/r3f.feature@@ -329,6 +329,7 @@ Feature: React Three Fiber both ways: an R3F scene drawn by raea, a raea composiAnd 20,000 moving copies at 640x360 take at most 100 ms a frame (0.1.4: 1,220 ms), 2,000 at most 40 ms (0.1.4: 94)And in-instanced (2,000 moving copies with colours): SSIM at least 0.92 against three.js+ @doneScenario: R3F21. A lit TSL node material is lit by the scene's lightsGiven the plan| crate | file | lines | job |@@ -347,6 +348,12 @@ Feature: React Three Fiber both ways: an R3F scene drawn by raea, a raea composiAnd a Lambert surface is fully rough and Phong's shininess a roughness, neither metal; a basic, shadow or volumenode material, or one with a fragmentNode, keeps three's own outputAnd in-tsl-lit (a noise-displaced, noise-coloured icosahedron under a directional light): SSIM at least 0.92+ And the status, 2026-11-15: built as planned. in-tsl-lit SSIM 0.9906 against three.js (WebGPURenderer, its WebGL 2+ backend) in Chrome at frame 12, where 0.1.4 drew the same blob black (the 11-15 audit's tsl-displace). Proof:+ sdk/r3f test/tsl.test.ts (the lit contract: three_surface returns base, normal, emissive and world, no three+ light code in the graph, the instance carried flat; a Lambert surface rough and unmetallic) and+ raea-sys-three-shader's surface test; tools/parity.sh runs in-tsl-lit. A displaced mesh's shadow is still its+ undisplaced shape (three-shader's shadow pass is the standard one), and a fragmentNode keeps three's outputScenario: R3F22. TSL compute and storage buffersGiven TSL storage (`instancedArray`, `storage`, `attributeArray`), compute nodes (`Fn(...)().compute(n)`) run withdiff --git a/sdk/r3f/tools/parity.sh b/sdk/r3f/tools/parity.shindex e325ad23..0d6fd3ca 100755--- a/sdk/r3f/tools/parity.sh+++ b/sdk/r3f/tools/parity.sh@@ -11,6 +11,8 @@ URL=${R3F_PARITY_URL:-serve}MIN=${MIN:-0.92}CASES=(in-basic:24 in-lights:0 in-things:0 in-catch:0 in-lettra:12 in-lettrafx:12 in-shader:12 in-post:0 in-drei:12 in-approx:0 in-glass:0 in-sky:0 out-basic:24 out-tony:24 out-lights:0 out-bloom:0 out-grade:0 out-lens:0 out-catch:0 out-entities:10 src-basic:24 src-tony:24 src-lights:0 src-bloom:0 src-grade:0 src-lens:0 src-catch:0 src-entities:10)# R3F_CASES="in-sky:0 in-shader:12": just those (a lane checking its own cases)+# the TSL cases (test/parity/tsl.tsx): a lit node material (R3F21)+CASES+=(in-tsl-lit:12)[ -z "${R3F_CASES:-}" ] || read -ra CASES <<<"$R3F_CASES"mkdir -p "$OUT"for c in "${CASES[@]}"; dodiff --git a/sdk/r3f/tools/shoot.ts b/sdk/r3f/tools/shoot.tsindex 4c5f5823..f1f283c4 100644--- a/sdk/r3f/tools/shoot.ts+++ b/sdk/r3f/tools/shoot.ts@@ -11,7 +11,8 @@ const base = served?.url ?? baseArg;const cases = only.length ? only : ["in-basic", "in-lights", "in-things", "in-catch", "in-lettra", "in-lettrafx", "in-shader", "in-post", "in-drei", "in-approx", "in-glass", "in-sky", "out-basic", "out-tony", "out-lights", "out-bloom", "out-grade", "out-lens", "out-catch", "out-entities", "src-basic", "src-tony", "src-lights", "src-bloom", "src-grade", "src-lens", "src-catch", "src-entities"];let failed = 0;for (const c of cases) {- const [dir, name] = c.split("-");+ // the direction, then the case (a case name may hold dashes: in-tsl-lit)+ const dir = c.slice(0, c.indexOf("-")), name = c.slice(c.indexOf("-") + 1);const page = await openChrome(`${base}/#/r3f?dir=${dir}&case=${name}`, 640, 400, { scale: 1, mobile: false });try {let note = "";diff --git a/systems/three-shader/src/lib.rs b/systems/three-shader/src/lib.rsindex 50195cad..56c7905f 100644--- a/systems/three-shader/src/lib.rs+++ b/systems/three-shader/src/lib.rs@@ -157,8 +157,8 @@ pub fn modules(vertex: &str, fragment: &str, layout: &[Uniform], textures: Optioif lit {ve = ve.replace(" return three_vertex(v);\n", surface::VERTEX_TAIL);}- let fe = if lit { surface::fragment_entry() } else { module::fragment_entry() };- (format!("{pre}{vertex}\n{ve}"), format!("{pre}{fragment}\n{fe}"))+ let (fi, fe) = if lit { (surface::IMPORTS, surface::fragment_entry()) } else { ("", module::fragment_entry()) };+ (format!("{pre}{vertex}\n{ve}"), format!("{fi}{pre}{fragment}\n{fe}"))}/// A three shader's spec, as the SDK's ThreeShaderMaterial gives it:diff --git a/systems/three-shader/src/surface.rs b/systems/three-shader/src/surface.rsindex b2bba08e..f3a118d4 100644--- a/systems/three-shader/src/surface.rs+++ b/systems/three-shader/src/surface.rs@@ -15,13 +15,15 @@ use bevy::prelude::AlphaMode;/// The vertex entry's last line for a lit material: the varyings carry the instance to the fragment stage.pub const VERTEX_TAIL: &str = " var o = three_vertex(v);\n o.three_instance = v.instance;\n return o;\n";-/// The fragment entry of a lit material.+/// What the lit fragment entry imports, in front of the module (WESL takes imports only at its top).+pub const IMPORTS: &str = "import bevy_pbr::render::pbr_types::{pbr_input_new, STANDARD_MATERIAL_FLAGS_FOG_ENABLED_BIT};\n\+ import bevy_pbr::render::pbr_functions::{apply_pbr_lighting, main_pass_post_lighting_processing, calculate_view};\n\+ import bevy_pbr::render::mesh_bindings::mesh;\n";++/// The fragment entry of a lit material (its module starts with IMPORTS).pub fn fragment_entry() -> String {format!(- "import bevy_pbr::render::pbr_types::{{pbr_input_new, STANDARD_MATERIAL_FLAGS_FOG_ENABLED_BIT}};\n\- import bevy_pbr::render::pbr_functions::{{apply_pbr_lighting, main_pass_post_lighting_processing, calculate_view}};\n\- import bevy_pbr::render::mesh_bindings::mesh;\n\n\- @fragment\n\+ "@fragment\n\fn fragment(in: ThreeVaryings, @builtin(front_facing) front: bool) -> @location(0) vec4<f32> {{\n\\x20 let s = three_surface(in, front);\n\\x20 var pbr = pbr_input_new();\n\@@ -70,5 +72,9 @@ mod tests {assert!(f.contains("pbr.flags = mesh[in.three_instance].flags;"));assert!(f.contains(&format!("three_slots.s[{}]", super::DISPLAY_SLOT)));assert_eq!(super::alpha_code(bevy::prelude::AlphaMode::Add), 4.0);+ // WESL takes imports only at a module's top: a lit fragment module starts with the entry's+ let (v, m) = crate::modules("fn three_vertex(v: ThreeVertex) -> ThreeVaryings { var o: ThreeVaryings; return o; }", "fn three_surface(in: ThreeVaryings, front: bool) -> ThreeSurface { var s: ThreeSurface; return s; }", &[], Some(&[]), 0, true);+ assert!(m.starts_with(super::IMPORTS), "{m}");+ assert!(v.contains("o.three_instance = v.instance;"));}}