Skip to content

Conversation

@sunag
Copy link
Collaborator

@sunag sunag commented Jun 19, 2025

Description

With the sample() callback interface, a procedural node can be "sampled" without necessarily being a texture, which is useful for customizing packaging and avoids code that previously had to be customized internally in the function for situations that can be resolved through an external interface.

A. I made a small demo on webgpu_postprocessing_ssr packing the normals.

const customNormal = sample( ( uv ) => {

	return colorToDirection( scenePassNormal.sample( uv ) );

} );

//...

ssrPass = ssr( scenePassColor, scenePassDepth, customNormal, scenePassMetalness, camera );

@sunag sunag changed the title TSL: Introduce sample TSL: Introduce sample() Jun 19, 2025
@sunag sunag added this to the r178 milestone Jun 19, 2025
@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.54
78.73
337.54
78.73
+0 B
+0 B
WebGPU 556.43
154.15
556.63
154.19
+209 B
+44 B
WebGPU Nodes 555.78
153.99
555.99
154.03
+209 B
+44 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 468.74
113.38
468.74
113.38
+0 B
+0 B
WebGPU 632.24
171.08
632.24
171.08
+0 B
+0 B
WebGPU Nodes 587.24
160.39
587.24
160.39
+0 B
+0 B

@sunag sunag marked this pull request as ready for review June 20, 2025 18:39
@sunag sunag merged commit 5f6ec60 into mrdoob:dev Jun 20, 2025
12 checks passed
@sunag sunag deleted the dev-sample branch June 20, 2025 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant