Skip to content

WGSLNodeBuilder: Fix grad() with unfilterable textures. - #35169

Merged
sunag merged 1 commit into
mrdoob:devfrom
sunag:dev-drawer-2
Oct 22, 2026
Merged

sunag merged 1 commit into
mrdoob:devfrom
sunag:dev-drawer-2

Conversation

@sunag

@sunag sunag commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Related issue: -

Description

Unfilterable textures have no sampler binding, but TextureNode.grad() generated textureSampleGrad() with a sampler, so the shader failed with unresolved value '*_sampler'. They now use the same texel lookup as regular sampling, which keeps wrapping and offsets.

import { texture, uv, dFdx, dFdy } from 'three/tsl';

const map = new THREE.TextureLoader().load( 'textures/minecraft/atlas.png' );
map.minFilter = THREE.NearestFilter;
map.magFilter = THREE.NearestFilter;

const material = new THREE.MeshBasicNodeMaterial();
material.colorNode = texture( map ).grad( dFdx( uv() ), dFdy( uv() ) );

@sunag sunag added this to the r187 milestone Oct 22, 2026
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build including core, minified and gzipped.

Before After Diff
Core 394.07
103.14
394.07
103.14
+0 B
+0 B
WebGL 780.45
194.68
780.45
194.68
+0 B
+0 B
WebGPU 1112.83
299.38
1112.89
299.39
+57 B
+10 B
WebGPU Nodes 1110.78
299.02
1110.84
299.03
+57 B
+11 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 518.90
124.65
518.90
124.65
+0 B
+0 B
WebGPU 788.62
211.17
788.67
211.19
+57 B
+12 B
WebGPU Nodes 734.72
197.62
734.78
197.63
+57 B
+14 B

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🖼️ E2E screenshot tests

❌ 1 example(s) failed (full artifacts).

Example Expected Actual Diff
physics_jolt_instancing

@sunag
sunag marked this pull request as ready for review October 22, 2026 22:23
@sunag
sunag merged commit 087f01f into mrdoob:dev Oct 22, 2026
15 of 16 checks passed
@sunag
sunag deleted the dev-drawer-2 branch October 22, 2026 22:42
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