Skip to content

MaterialNode: Fix clearcoat roughness texture channel. - #34564

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
needle-tools:fix/clearcoat-roughness-channel
Sep 15, 2026
Merged

Mugen87 merged 1 commit into
mrdoob:devfrom
needle-tools:fix/clearcoat-roughness-channel

Conversation

@hybridherbst

Copy link
Copy Markdown
Contributor

Description

Sample the green channel of clearcoatRoughnessMap instead of red, matching MeshPhysicalMaterial, WebGLRenderer and KHR_materials_clearcoat. Packed textures with different red and green values otherwise produce different clearcoat roughness in WebGPURenderer.

Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_clearcoat

This contribution is funded by Needle

Sample the green channel of clearcoatRoughnessMap instead of red, matching MeshPhysicalMaterial, WebGLRenderer and KHR_materials_clearcoat. Packed textures with different red and green values otherwise produce different clearcoat roughness in WebGPURenderer.

For example, with clearcoat and clearcoatRoughness set to 1, an RGBA texel of [255, 0, 0, 255] should produce a smooth coat. Sampling red instead produces a rough coat. Grayscale textures hide the mismatch.

Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_clearcoat
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
Core 389.51
102.17
389.51
102.17
+0 B
+0 B
WebGL 379.11
88.92
379.11
88.92
+0 B
+0 B
WebGPU 712.39
196.1
712.39
196.1
+0 B
+1 B
WebGPU Nodes 710.38
195.78
710.38
195.78
+0 B
+1 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 523.73
126.08
523.73
126.08
+0 B
+0 B
WebGPU 766.09
205.59
766.09
205.59
+0 B
+2 B
WebGPU Nodes 712.19
192.24
712.19
192.25
+0 B
+2 B

@hybridherbst

Copy link
Copy Markdown
Contributor Author

Curious that replacing one character with another character increases gzip size by 2 bytes 😄

@Mugen87
Mugen87 merged commit c48f827 into mrdoob:dev Sep 15, 2026
10 checks passed
@Mugen87 Mugen87 added this to the r187 milestone Sep 15, 2026
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.

2 participants