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
R3F16: what three can't draw in raea is named and drawn, never refused. The R3F stand-in renderer answers coordinateSystem, an inert GL state, extensions and a full info, and takes compute/computeAsync into gl.__raea.computes (named once until R3F22 runs them); the TSL stand-in's WebGPU backend has a device with wgpu's limits, any Error building a node graph draws that material flat, and a graph reading an attribute the drawn mesh can't carry (an InstancedMesh past 1,024 copies) is refused in tsl.ts instead of by the engine; a sampler2D the material never sets reads opaque black; an http(s) picture is fetched through raea's cache. R3F17: a vertex put on three's far plane (X.z = X.w, gl_Position = X.xyww) is written on reverse-Z's (z = 0) in GLSL and in a node material's WGSL, so <Sky> is behind the scene: in-sky SSIM 0.9986. The audit's six refused probes render; test/errors.test.tsx 10/10; parity.sh takes R3F_CASES for a subset
shinyobjectz4259cd9c0111
diff --git a/docs/r3f.feature b/docs/r3f.featureindex e5fdfc7f..9a74be13 100644--- a/docs/r3f.feature+++ b/docs/r3f.feature@@ -269,6 +269,7 @@ Feature: React Three Fiber both ways: an R3F scene drawn by raea, a raea composimesh a copy, and the raea skill told agents R3F doesn't exist here. Each scenario below is one of those, held by acase in test/parity (SSIM against three.js in Chrome, R3F8) or a test that refuses the old behaviour.+ @doneScenario: R3F16. What three can't draw in raea is named and drawn, never refusedGiven an <R3F> scene with any of: a TSL node material on an InstancedMesh, a compute dispatched through `gl.compute`,drei's <MeshReflectorMaterial>, drei's <Environment> with children (Lightformers), drei's <Stars>, drei's <Clouds>@@ -280,13 +281,26 @@ Feature: React Three Fiber both ways: an R3F scene drawn by raea, a raea composiAnd a ShaderMaterial on Points (drei's <Stars>) draws its points with its shaderAnd a texture three loads from an http(s) URL is fetched through raea's cache, never read as a path in the projectAnd test/errors.test.tsx renders each of the six without a refusal+ Status (11-15): session.ts's stand-in WebGLRenderer answers coordinateSystem (WebGL's), `state` (an inert GL state:+ every call does nothing), `extensions`, a full `info`, and takes `compute`/`computeAsync` into gl.__raea.computes+ (warned once: R3F22 runs them); tsl.ts's stand-in WebGPURenderer has a backend device with wgpu's limits, any Error+ building a graph is named and the material drawn flat, and a graph reading an attribute the drawn mesh can't carry+ (an InstancedMesh's matrices past 1,024 copies, an InstancedBufferAttribute) is refused there, not by the engine;+ shader.ts gives a sampler2D the material never sets a 1x1 opaque black picture (WebGL's unbound read); texture.ts+ fetches an http(s) picture through raea's cache (`asset.load`). The six probes from the audit render (stars, clouds with the CDN's cloud.png, the+ reflector's plane as its base material, Environment+Lightformer without the cube map, TSL on 100 and 2,000+ copies, gl.compute), each named; test/errors.test.tsx 10/10+ @doneScenario: R3F17. A sky at three's far plane is drawn behind the sceneGiven a shader that puts its vertices on the far plane as three does (`gl_Position.z = gl_Position.w`, drei's andthree's <Sky>, any skybox ShaderMaterial), or a node material's WGSL doing the sameWhen raea translates it (Bevy's projection is reverse-Z: the far plane is z = 0)Then it is written onto reverse-Z's far plane, so the scene in front of it showsAnd in-sky (three's Sky behind a box): SSIM at least 0.92 against three.js+ Status (11-15): shader.ts farPlane() rewrites `X.z = X.w;` and `gl_Position = X.xyww;` to z = 0 in a ShaderMaterial's+ vertex GLSL and in a node material's vertex WGSL (material.ts, on the part tsl.ts makes); in-sky SSIM 0.9986 (in-shader 0.9935, in-drei 0.9932,+ in-approx 0.9848 unchanged); test/errors.test.tsx holds the rewriteScenario: R3F18. Agents are taught <R3F>Given the raea skill (raea-skills skills/raea) and its source guides (sdk/guides/craft/bevy)diff --git a/sdk/r3f/src/input/material.ts b/sdk/r3f/src/input/material.tsindex d6b6f43f..21bbc46f 100644--- a/sdk/r3f/src/input/material.ts+++ b/sdk/r3f/src/input/material.ts@@ -7,7 +7,7 @@import * as THREE from "three";import { placementOf, srcOf } from "./texture";import { classicOf, nodeMaterialOf, type NodeAt } from "./tsl";-import { builtinPart, isShader, shaderPart } from "./shader";+import { builtinPart, farPlane, isShader, shaderPart } from "./shader";export type Props = Record<string, unknown>;export interface Part {@@ -189,7 +189,12 @@ export function materialOf(m: THREE.Material, vertexColors: boolean, at?: NodeAt// (its `type` is three's accessor: defined on a view of it, not assigned)if (classic) return materialOf(Object.defineProperties(Object.create(m) as THREE.Material, { type: { value: classic }, isNodeMaterial: { value: false } }), vertexColors, at);const shader = at && nodeMaterialOf(m, at);- if (shader) return shader;+ if (shader) {+ // a TSL SkyMesh's `position.z.assign(position.w)` onto reverse-Z's far plane, as a GLSL sky's is (R3F17)+ const wgsl = shader.props.wgsl as { vertex?: string } | undefined;+ if (wgsl?.vertex) wgsl.vertex = farPlane(wgsl.vertex);+ return shader;+ }}// a ShaderMaterial or RawShaderMaterial: its GLSL run by raea's engine as three would run it (shader.ts)if (isShader(m)) return shaderPart(m);diff --git a/sdk/r3f/src/input/session.ts b/sdk/r3f/src/input/session.tsindex 49c9d5bd..5ef42652 100644--- a/sdk/r3f/src/input/session.ts+++ b/sdk/r3f/src/input/session.ts@@ -10,6 +10,13 @@ import { renderInto } from "./targets";extend(THREE as unknown as Parameters<typeof extend>[0]);+const warned = new Set<string>();+function warnOnce(k: string, why: string) {+ if (warned.has(k)) return;+ warned.add(k);+ console.warn(`raea/r3f: ${k} ${why}`);+}+/** the renderer R3F configures and never draws with: what it sets on it (shadows, tone mapping) is read back */export function standInRenderer(): THREE.WebGLRenderer {const noop = () => {};@@ -25,7 +32,26 @@ export function standInRenderer(): THREE.WebGLRenderer {// a pass an app draws into a render target itself (drei's <ContactShadows>) is done on the CPU (targets.ts)let target: THREE.RenderTarget | null = null;const clear: [number, number, number, number] = [0, 0, 0, 0];+ // WebGLRenderer's GL state, which a pass an app draws itself sets as it goes (drei's <MeshReflectorMaterial>:+ // state.buffers.depth.setMask): every call does nothing, every flag reads as off (docs/r3f.feature R3F16)+ const inert = (): unknown => new Proxy(noop, { get: (_, k) => (k === "then" || typeof k !== "string" ? undefined : inert()), apply: () => undefined });+ const state = { buffers: { color: inert(), depth: inert(), stencil: inert() }, enable: noop, disable: noop, reset: noop, bindTexture: noop, unbindTexture: noop, activeTexture: noop, setBlending: noop, setFlipSided: noop, setCullFace: noop, viewport: noop, scissor: noop, setScissorTest: noop, useProgram: () => false, bindFramebuffer: () => false, drawBuffers: noop, setPolygonOffset: noop, setLineWidth: noop, setMaterial: noop };+ // what an app dispatched with gl.compute this frame (TSL's compute nodes), in order: raea runs them as <Compute>s+ // once they can be (R3F22); until then each is named once and the scene drawn without it+ const dispatched: unknown[] = [];+ const compute = (node: unknown) => {+ dispatched.push(node);+ if (dispatched.length > 4096) dispatched.splice(0, dispatched.length - 4096);+ warnOnce("gl.compute", "dispatches a compute raea doesn't run yet: the scene is drawn without what it computes");+ };const own = {+ compute,+ computeAsync: async (node: unknown) => compute(node),+ __raea: { computes: dispatched },+ // three's WebGL clip space (a CubeCamera asks, drei's <Environment> with children): raea draws in Bevy's anyway+ coordinateSystem: THREE.WebGLCoordinateSystem,+ state,+ extensions: { has: () => false, get: () => null, init: noop },render: (scene: THREE.Object3D, camera: THREE.Camera) => {if (target) renderInto(target, scene, camera, clear);},@@ -45,7 +71,7 @@ export function standInRenderer(): THREE.WebGLRenderer {xr: { enabled: false, isPresenting: false, addEventListener: noop, removeEventListener: noop, setAnimationLoop: noop },shadowMap: { enabled: false, type: THREE.PCFShadowMap },outputColorSpace: THREE.SRGBColorSpace, toneMapping: THREE.NoToneMapping, toneMappingExposure: 1,- capabilities: { isWebGL2: true, maxTextureSize: 16384, maxSamples: 4, logarithmicDepthBuffer: false }, info: { autoReset: true, reset: noop }, properties: { get: () => ({}) },+ capabilities: { isWebGL2: true, maxTextureSize: 16384, maxSamples: 4, logarithmicDepthBuffer: false }, info: { autoReset: true, reset: noop, render: { calls: 0, triangles: 0, points: 0, lines: 0, frame: 0 }, memory: { geometries: 0, textures: 0 }, programs: [] }, properties: { get: () => ({}) },} as Record<string | symbol, unknown>;// any other of WebGLRenderer's methods (setRenderTarget, clear, readRenderTargetPixels ...) does nothing: raea draws// (verbs only: a catch-all would answer `then`, and the renderer would read as a promise)diff --git a/sdk/r3f/src/input/shader.ts b/sdk/r3f/src/input/shader.tsindex 0ecf58a2..24fc7629 100644--- a/sdk/r3f/src/input/shader.ts+++ b/sdk/r3f/src/input/shader.ts@@ -142,6 +142,8 @@ function valueOf(v: unknown): number | boolean | number[] | undefined {/** a picture three has no file for (a render target's): one white pixel, so the shader still runs */const WHITE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";+// a 1x1 opaque black PNG: what WebGL reads from a sampler with no texture bound+const BLACK = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQI12NgYGD4DwABBAEApOCsMQAAAABJRU5ErkJggg==";const warned = new Set<string>();function warnOnce(k: string, why: string) {@@ -191,6 +193,12 @@ export function shaderPart(m: THREE.ShaderMaterial, points = false): Part {}uniforms[name] = n;}+ // a sampler the shader declares and the material never gives (drei's <Stars> declares pointTexture): three binds no+ // texture there, and WebGL reads an unbound one as opaque black (R3F16)+ for (const [, name] of `${vertex}\n${fragment}`.matchAll(/^\s*uniform\s+(?:(?:lowp|mediump|highp)\s+)?sampler2D\s+(\w+)\s*;/gm)) {+ if (!(name in textures)) textures[name] = BLACK;+ }+ vertex = farPlane(vertex);const props: Props = {glsl: { vertex, fragment, raw, vertexColors: m.vertexColors === true, ...(points ? { points: true } : {}) },...(flipY.length ? { flipY } : {}),@@ -209,6 +217,18 @@ export function shaderPart(m: THREE.ShaderMaterial, points = false): Part {return { type: "ThreeShaderMaterial", props };}+/**+ * A vertex put on three's far plane as three puts it, `p.z = p.w` (three's <Sky>, its cube and backgroundCube+ * programs, a TSL SkyMesh's `position.z.assign(position.w)` in WGSL), on reverse-Z's far plane instead: Bevy's+ * projection maps the far plane (at infinity) to z = 0, so z = w there is the NEAR plane and the sky would cover the+ * scene (docs/r3f.feature R3F17). `gl_Position = p.xyww` is the same trick written whole.+ */+export function farPlane(src: string): string {+ return src+ .replace(/(\b[A-Za-z_][\w.]*)\.z\s*=\s*\1\.w\s*;/g, "$1.z = 0.0;")+ .replace(/\bgl_Position\s*=\s*([A-Za-z_][\w.]*)\.xyww\s*;/g, "gl_Position = vec4($1.xy, 0.0, $1.w);");+}+/** whether a material is a ShaderMaterial (or Raw), which shaderPart draws */export const isShader = (m: THREE.Material): m is THREE.ShaderMaterial => (m as THREE.ShaderMaterial).isShaderMaterial === true;diff --git a/sdk/r3f/src/input/texture.ts b/sdk/r3f/src/input/texture.tsindex ca4454bb..afb4f591 100644--- a/sdk/r3f/src/input/texture.ts+++ b/sdk/r3f/src/input/texture.ts@@ -7,14 +7,32 @@ import { targetPixels } from "./targets";const urls = new WeakMap<object, string>();+// a picture three loads from an http(s) URL (drei's <Clouds> fetches its cloud.png from a CDN): raea's engine reads paths,+// so the URL is fetched once through raea's cache and the cached file is the source (docs/r3f.feature R3F16). With no host+// to fetch with (a test, a browser) the URL itself.+const remote = new Map<string, string | undefined>();+function fetched(src: string): string | undefined {+ if (!/^https?:\/\//i.test(src) || typeof (globalThis as { __raea_call?: unknown }).__raea_call !== "function") return src;+ if (!remote.has(src)) {+ let path: string | undefined;+ try {+ path = native<{ path: string }>("asset.load", { path: src })?.path;+ } catch (e) {+ console.warn(`raea/r3f: texture ${src} couldn't be fetched (${(e as Error).message ?? e}): drawn without it`);+ }+ remote.set(src, path);+ }+ return remote.get(src);+}+/** three's ImageLoader without a DOM: the image is a stand-in carrying its url (raea loads the file) */export function standInImages() {const doc = (globalThis as { document?: { createElementNS?: unknown } }).document;if (doc && typeof doc.createElementNS === "function") return;const load = function (this: THREE.ImageLoader, url: string, onLoad?: (img: HTMLImageElement) => void) {const src = this.manager.resolveURL((this.path ?? "") + url);- const img = { src, width: 1, height: 1, naturalWidth: 1, naturalHeight: 1, complete: true } as unknown as HTMLImageElement;- urls.set(img, src);+ const img = { src: fetched(src) ?? src, width: 1, height: 1, naturalWidth: 1, naturalHeight: 1, complete: true } as unknown as HTMLImageElement;+ urls.set(img, fetched(src) ?? src);this.manager.itemStart(src);// at once: raea reads a frame's scene in the same turn its components render, so a picture handed over later// is missing from the frame (lettra's atlas, any TextureLoader.load). A callback that reads the variable its own@@ -265,7 +283,7 @@ export function srcOf(t: THREE.Texture | null | undefined): string | undefined {const img = t.image as { src?: string; toDataURL?: () => string; data?: unknown } | undefined;if (!img) return undefined;if (urls.has(img)) return urls.get(img);- if (typeof img.src === "string" && img.src !== "") return img.src;+ if (typeof img.src === "string" && img.src !== "") return fetched(img.src);if (typeof img.toDataURL === "function") {const s = img.toDataURL();urls.set(img, s);diff --git a/sdk/r3f/src/input/tsl.ts b/sdk/r3f/src/input/tsl.tsindex 00884840..4ed12b55 100644--- a/sdk/r3f/src/input/tsl.ts+++ b/sdk/r3f/src/input/tsl.ts@@ -87,6 +87,9 @@ function standIn(fresh = false): WebGPURenderer {own._initialized = true;own.hasFeature = () => false;own.hasCompatibility = () => true;+ // what three's WebGPU backend reads from its device while it builds: the uniform buffer size that decides whether an+ // InstancedMesh's matrices are a uniform array or attributes (wgpu's defaults), and compute's workgroup limits+ (own.backend as { device?: unknown }).device = { limits: { maxUniformBufferBindingSize: 65536, maxStorageBufferBindingSize: 134217728, maxComputeWorkgroupsPerDimension: 65535, maxComputeInvocationsPerWorkgroup: 256, maxComputeWorkgroupSizeX: 256, maxComputeWorkgroupSizeY: 256, maxComputeWorkgroupSizeZ: 64, maxBindGroups: 4, maxSampledTexturesPerShaderStage: 16, maxStorageBuffersPerShaderStage: 8 }, features: new Set<string>() };// no shadow maps: a shadow in three's graph would be a depth texture raea doesn't fill (raea's own lights cast)r.shadowMap.enabled = false;if (fresh) return r;@@ -340,6 +343,12 @@ function rewrite(b: Builder): Omit<Compiled, "key" | "builder" | "frame"> {const a = ATTRIBUTES[p.name];if (a) vlets.push(`\tlet ${p.name} = ${fit(`v.${a.field}`, a.type, p.type)};`);else {+ // an attribute three made itself or one a copy at a time (an InstancedMesh's matrices past a uniform buffer's+ // worth of copies, `nodeAttribute0`; an InstancedBufferAttribute): the mesh raea draws carries per-vertex+ // attributes only, so the graph can't run here yet (R3F16; R3F20/R3F22 bring instance data)+ const ga = (b as unknown as { geometry?: THREE.BufferGeometry }).geometry?.getAttribute(p.name) as (THREE.BufferAttribute & { isInstancedBufferAttribute?: boolean; isInterleavedBufferAttribute?: boolean; data?: { isInstancedInterleavedBuffer?: boolean } }) | undefined;+ if (!ga) throw new Unsupported(`it reads ${p.name}, an attribute three makes for itself (an InstancedMesh's copies past what a uniform buffer holds)`);+ if (ga.isInstancedBufferAttribute || ga.data?.isInstancedInterleavedBuffer) throw new Unsupported(`it reads ${p.name}, an attribute a copy at a time`);// one of the mesh's own (lettra's layoutX, glyphIndex, cellUv): a0..a3, four floats eachif (own.length === ATTRIBUTES_OWN) throw new Unsupported(`it reads more than ${ATTRIBUTES_OWN} vertex attributes of the mesh's own (${[...own, p.name].join(", ")})`);vlets.push(`\tlet ${p.name} = ${fit(`v.a${own.length}`, "vec4<f32>", p.type)};`);@@ -463,7 +472,9 @@ export function nodeMaterialOf(m: THREE.Material, at: NodeAt): Part | undefinedif (m.alphaTest > 0) props.alphaTest = m.alphaTest;return { type: "ThreeShaderMaterial", props };} catch (e) {- if (!(e instanceof Unsupported)) throw e;+ // a graph three itself can't build against the stand-in (what it asks of a GPU raea hasn't answered) is named and drawn+ // flat, as a refused one is: never the whole render refused for one material (docs/r3f.feature R3F16)+ if (!(e instanceof Error)) throw e;const k = `${m.type}:${e.message}`;if (!warned.has(k)) {warned.add(k);diff --git a/sdk/r3f/test/errors.test.tsx b/sdk/r3f/test/errors.test.tsxindex a4fdcfd1..106f9778 100644--- a/sdk/r3f/test/errors.test.tsx+++ b/sdk/r3f/test/errors.test.tsx@@ -85,3 +85,72 @@ describe("three's PMREMGenerator", () => {expect(env?.props.src).toBe("media/studio.hdr");});});++// docs/r3f.feature R3F16: what three asks of a renderer raea's stand-ins answer, so these draw (named where raea can't+// do all of it yet) instead of refusing the render; R3F17: a sky at three's far plane goes to reverse-Z's+describe("what the 11-15 audit found refused", () => {+ const quiet = <T,>(fn: () => T): { out: T; warned: string[] } => {+ const warned: string[] = [];+ const warn = console.warn;+ console.warn = (m: string) => void warned.push(String(m));+ try {+ return { out: fn(), warned };+ } finally {+ console.warn = warn;+ }+ };++ test("drei's <MeshReflectorMaterial> (it sets gl.state.buffers.depth) draws its plane", async () => {+ const { MeshReflectorMaterial } = await import("@react-three/drei");+ const { out } = quiet(() => partsOf(() => (<><Box /><mesh rotation={[-Math.PI / 2, 0, 0]}><planeGeometry args={[4, 4]} /><MeshReflectorMaterial resolution={64} mirror={0.8} /></mesh></>)));+ expect(out.filter((p) => p.type === "Mesh").length).toBe(2);+ });++ test("drei's <Environment> with Lightformers (a CubeCamera reads the renderer's coordinate system) draws the scene", async () => {+ const { Environment, Lightformer } = await import("@react-three/drei");+ const { out } = quiet(() => partsOf(() => (<><Box /><Environment resolution={16}><Lightformer intensity={4} position={[0, 3, -3]} /></Environment></>)));+ expect(out.some((p) => p.type === "Mesh")).toBe(true);+ });++ test("a TSL node material on an InstancedMesh (three asks the backend's device for its limits) draws, flat past a uniform buffer", async () => {+ const { MeshBasicNodeMaterial } = await import("three/webgpu");+ const { color } = await import("three/tsl");+ for (const count of [100, 2000]) {+ const m = new MeshBasicNodeMaterial();+ m.colorNode = color(0.4, 0.8, 1);+ const { out } = quiet(() => partsOf(() => <instancedMesh args={[new THREE.BoxGeometry(0.1, 0.1, 0.1), m, count]} />));+ expect(out.some((p) => p.type === "Mesh" || p.type === "Instances")).toBe(true);+ }+ });++ test("gl.compute in useFrame is taken and named, not thrown", () => {+ const { useFrame } = require("@react-three/fiber") as typeof import("@react-three/fiber");+ const Dispatch = () => {+ useFrame(({ gl }) => (gl as unknown as { compute(n: unknown): void }).compute({ isComputeNode: true }));+ return <Box />;+ };+ const s = stepTo("compute", 0, 30, 400, 400, {}, () => <Dispatch />);+ const { warned } = quiet(() => stepTo("compute", 1, 30, 400, 400, {}, () => <Dispatch />));+ const gl = (s.state as unknown as { gl: { __raea: { computes: unknown[] } } }).gl;+ expect(gl.__raea.computes.length).toBeGreaterThan(0);+ expect(warned.every((w) => !/TypeError/.test(w))).toBe(true);+ end("compute");+ });++ test("drei's <Stars> (a ShaderMaterial on Points with a sampler it never sets) has that sampler read as opaque black", async () => {+ const { Stars } = await import("@react-three/drei");+ const { out } = quiet(() => partsOf(() => <Stars count={50} />));+ const shader = out.find((p) => p.type === "ThreeShaderMaterial");+ expect(shader).toBeDefined();+ expect(String((shader!.props.textures as Record<string, string>).pointTexture)).toMatch(/^data:image\/png;base64,/);+ });++ test("three's <Sky> writes its far plane as reverse-Z's (z = 0), not z = w, which Bevy's projection puts on the near plane", async () => {+ const { Sky } = await import("@react-three/drei");+ const { out } = quiet(() => partsOf(() => <Sky sunPosition={[100, 10, 100]} />));+ const shader = out.find((p) => p.type === "ThreeShaderMaterial");+ const vertex = String((shader!.props.glsl as { vertex: string }).vertex);+ expect(vertex).toContain("gl_Position.z = 0.0;");+ expect(vertex).not.toMatch(/gl_Position\.z\s*=\s*gl_Position\.w/);+ });+});diff --git a/sdk/r3f/test/parity/fixtures.tsx b/sdk/r3f/test/parity/fixtures.tsxindex e7a6784a..f48671d3 100644--- a/sdk/r3f/test/parity/fixtures.tsx+++ b/sdk/r3f/test/parity/fixtures.tsx@@ -3,7 +3,7 @@// `out-*` are raea compositions, drawn in React Three Fiber by <Raea> (outputs.tsx).import { useFrame } from "@react-three/fiber";import * as PP from "@react-three/postprocessing";-import { ContactShadows, Environment, Float, Text, useGLTF } from "@react-three/drei";+import { ContactShadows, Environment, Float, Sky, Text, useGLTF } from "@react-three/drei";import { useMemo, useRef, type ReactNode } from "react";import * as THREE from "three";import { MeshBasicNodeMaterial } from "three/webgpu";@@ -283,6 +283,23 @@ export const INPUTS: Record<string, InputCase> = {</>),},+ // three's <Sky> (a ShaderMaterial that puts its box on the far plane, `gl_Position.z = gl_Position.w`) behind a box: raea writes+ // it on reverse-Z's far plane, so the box shows in front (R3F17; 0.1.4 drew the sky over everything)+ sky: {+ canvas: { camera: { position: [0, 1.2, 4], fov: 45 } },+ frame: 0,+ scene: () => (+ <>+ <Sky sunPosition={[100, 10, 100]} />+ <ambientLight intensity={0.4} />+ <directionalLight position={[3, 5, 2]} intensity={2.5} />+ <mesh position={[0, 0.2, 0]}>+ <boxGeometry />+ <meshStandardMaterial color="#4ea1ff" roughness={0.5} />+ </mesh>+ </>+ ),+ },// three.js ShaderMaterials (src/input/shader.ts): GLSL translated by naga and run by raea's engine with three's// built-ins. A sphere rippled by R3F's clock (a uniform set in useFrame) and points sized by an attribute of their ownshader: {diff --git a/sdk/r3f/tools/parity.sh b/sdk/r3f/tools/parity.shindex 3fd7f860..e325ad23 100755--- a/sdk/r3f/tools/parity.sh+++ b/sdk/r3f/tools/parity.sh@@ -9,13 +9,15 @@ OUT=${1:-$(mktemp -d)}URL=${R3F_PARITY_URL:-serve}[ -f wasm/raea_shape_web.js ] || tools/shape-wasm.shMIN=${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 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)+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)+[ -z "${R3F_CASES:-}" ] || read -ra CASES <<<"$R3F_CASES"mkdir -p "$OUT"for c in "${CASES[@]}"; do# a src-* case is its out-* composition, drawn from the R3F source the source export wrote for it(cd test/parity && raea render native.tsx --composition "$(echo "${c%%:*}" | sed 's/^src-/out-/')" --frame "${c##*:}" -o "$OUT/${c%%:*}-native.png" >/dev/null)done-bun tools/shoot.ts "$URL" "$OUT"+bun tools/shoot.ts "$URL" "$OUT" $([ -z "${R3F_CASES:-}" ] || for c in "${CASES[@]}"; do echo "${c%%:*}"; done)fail=0for c in "${CASES[@]}"; doid=${c%%:*}diff --git a/sdk/r3f/tools/shoot.ts b/sdk/r3f/tools/shoot.tsindex f718451d..4c5f5823 100644--- a/sdk/r3f/tools/shoot.ts+++ b/sdk/r3f/tools/shoot.ts@@ -8,7 +8,7 @@ const [baseArg, out, ...only] = process.argv.slice(2);if (!baseArg || !out) throw new Error("usage: bun tools/shoot.ts BASE_URL|serve OUT_DIR [in-basic ...]");const served = baseArg === "serve" ? await serve() : undefined;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", "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"];+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("-");