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
R3F22: a TSL node material reads a render target raea draws on its GPU as a ShaderMaterial does (texture.ts flipsY, targets.ts onGpu): its samples turned over in v, since the camera's image counts rows from the top where three's target counts from the bottom, and the image read as it is drawn (sRGB) rather than as a raw linear copy taken before any pass drew
shinyobjectz24fadef05ea5
diff --git a/sdk/r3f/src/input/tsl.ts b/sdk/r3f/src/input/tsl.tsindex 0e600f4f..c7f27d07 100644--- a/sdk/r3f/src/input/tsl.ts+++ b/sdk/r3f/src/input/tsl.ts@@ -20,7 +20,8 @@import * as THREE from "three";import { ModelNode, NodeFrame, WebGPURenderer } from "three/webgpu";import type { Part, Props } from "./material";-import { srcOf } from "./texture";+import { onGpu } from "./targets";+import { flipsY, srcOf } from "./texture";import { isLit, litBuilder, litStages } from "./tsl-lit";import { MaterialStorage, declaration, elementType, isStorage, storageOfAttribute, type SharedBuffer, type StorageAttribute } from "./tsl-storage";import { ATTRIBUTES, ATTRIBUTES_OWN, ELEMENT, FLIP, STORED, Unsupported, fit, flipSamples, indexed, params, slotsOf, structs, word } from "./tsl-wgsl";@@ -227,7 +228,7 @@ function rewrite(b: Builder, copies?: THREE.InstancedMesh): Omit<Compiled, "key"const src = srcOf(t);if (!t || !src) throw new Unsupported(`texture ${x.name} has no picture raea can load (a render target, a video, a canvas it can't read)`);textures.push({ name: x.name, texture: t });- if (t.flipY) flipped.add(`tex_${x.name}`);+ if (flipsY(t)) flipped.add(`tex_${x.name}`);} else if (x.isSampler) {// its texture's: samp_NAME} else if (x.isBuffer && (x as unknown as { nodeUniform?: { array?: unknown[] } }).nodeUniform?.array) {@@ -414,7 +415,7 @@ export function nodeMaterialOf(m: THREE.Material, at: NodeAt): Part | undefinedwgsl: { vertex: c.vertex, fragment: c.fragment, uniforms: vals.map(({ name, type, array }) => ({ name, type, ...(array ? { array } : {}) })), ...(c.attributes.length ? { attributes: c.attributes } : {}), ...(c.storage.length ? { storage: c.storage } : {}), ...(c.lit ? { lit: true } : {}) },...(c.lit && (m as { fog?: boolean }).fog === false ? { fog: false } : {}),uniforms: Object.fromEntries(vals.map((u) => [u.name, u.value])),- textures: Object.fromEntries(c.textures.map(({ name, texture }) => [name, { src: srcOf(texture)!, colorSpace: texture.colorSpace === THREE.SRGBColorSpace ? "srgb" : "linear" }])),+ textures: Object.fromEntries(c.textures.map(({ name, texture }) => [name, { src: srcOf(texture)!, colorSpace: texture.colorSpace !== THREE.SRGBColorSpace && !onGpu(texture) ? "linear" : "srgb" }])),// three's node materials write linear colour (the renderer's output pass tone-maps and encodes), as raea's dooutput: "linear",transparent: m.transparent,