Skip to content

Conversation

@shotamatsuda
Copy link
Contributor

Description

This PR changes the coordinate type for load() on 3D texture nodes from vec3 to ivec3.

This also changes TextureNode so that it does not use a sampler when hasSampler === false and levelNode is set, because the level can be specified without a sampler (i.e. texture(node).level(0).load(uv) was previously forced to use a sampler but it shouldn't be necessary), but it does change its behavior.

If agreed, we could give generateTextureLoad higher priority even when sampler-related options such as gradNode and biasNode are set (i.e. move the if ( this.sampler === false ) conditional to the beginning of generateSnippet), because sample()/load() can be considered actions and the others are options.

@github-actions
Copy link

github-actions bot commented Aug 28, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.91
79.11
338.91
79.11
+0 B
+0 B
WebGPU 579.36
159.65
579.44
159.67
+82 B
+23 B
WebGPU Nodes 577.97
159.4
578.05
159.43
+82 B
+23 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 470.78
113.9
470.78
113.9
+0 B
+0 B
WebGPU 649.51
175.52
649.59
175.54
+82 B
+24 B
WebGPU Nodes 603.6
164.66
603.69
164.69
+82 B
+30 B

@shotamatsuda shotamatsuda marked this pull request as draft August 28, 2025 19:58
@shotamatsuda shotamatsuda marked this pull request as ready for review August 28, 2025 20:16
@sunag sunag added this to the r181 milestone Aug 29, 2025
@shotamatsuda
Copy link
Contributor Author

because sample()/load() can be considered actions and the others are options.

compare() is a bit hard to classify here. Anyway, this should be addressed in another PR, but TextureNode is likely a frequently used node, so I'd like its behavior to be well-defined.

@Mugen87 Mugen87 merged commit 1e6ed3f into mrdoob:dev Sep 3, 2025
9 checks passed
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.

3 participants