Skip to content

TSL: Fix pass() build during sample() call using Mesh#31431

Merged
sunag merged 1 commit into
mrdoob:devfrom
sunag:dev-fix-pass
Jul 16, 2025
Merged

TSL: Fix pass() build during sample() call using Mesh#31431
sunag merged 1 commit into
mrdoob:devfrom
sunag:dev-fix-pass

Conversation

@sunag

@sunag sunag commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator

Related issue: https://discourse.threejs.org/t/tsl-using-the-output-of-pass-in-colornode-in-screen-space/85178/4

Description

Fix pass() build during sample() call using Mesh.

// material
const material = new THREE.NodeMaterial();

const maskScenePass = pass( maskScene, camera );

material.colorNode = Fn( () => {

	const maskTexture = maskScenePass.getTextureNode();

	const maskVal = maskTexture.sample( screenUV ).r

	return mix( color( 1, 0, 0 ), color( 0, 1, 0 ), maskVal );

} )();

// mesh
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );

@sunag sunag added this to the r179 milestone Jul 16, 2025
@sunag sunag marked this pull request as ready for review July 16, 2025 15:45
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.01
78.83
338.01
78.83
+0 B
+0 B
WebGPU 557.94
154.37
557.92
154.36
-21 B
-3 B
WebGPU Nodes 556.86
154.17
556.84
154.16
-21 B
-10 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 469.26
113.53
469.26
113.53
+0 B
+0 B
WebGPU 633.24
171.4
633.22
171.39
-21 B
-5 B
WebGPU Nodes 588.38
160.72
588.35
160.71
-21 B
-5 B

@sunag sunag merged commit 0fbaef0 into mrdoob:dev Jul 16, 2025
13 of 14 checks passed
@sunag sunag deleted the dev-fix-pass branch July 16, 2025 16:11
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