Skip to content

TSL: Inline transform of normal and tangent - #33938

Merged
sunag merged 1 commit into
mrdoob:devfrom
WestLangley:dev-nodes_skinning
Jul 5, 2026
Merged

sunag merged 1 commit into
mrdoob:devfrom
WestLangley:dev-nodes_skinning

Conversation

@WestLangley

@WestLangley WestLangley commented Jul 3, 2026 •

Copy link
Copy Markdown
Collaborator

In skinning, by convention, the normal matrix is ignored when transforming normals. So the existing code is, in fact, correct.

But as a matter of policy, we avoid passing a normal into transformDirection(). So, in this PR, the proper computations are inlined.

Note that the normalization step is not needed, since normalization is implemented in the fragment shader.

@WestLangley WestLangley added this to the r186 milestone Jul 3, 2026
@WestLangley

Copy link
Copy Markdown
Collaborator Author

/ping @sunag If this is done in a compute shader, are we still OK skipping the normalization?

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

πŸ“¦ Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 365.57
86.87
365.57
86.87
+0 B
+0 B
WebGPU 674.88
187.18
674.85
187.18
-24 B
+2 B
WebGPU Nodes 672.92
186.87
672.89
186.87
-24 B
+2 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 508.09
123.82
508.09
123.82
+0 B
+0 B
WebGPU 754.6
203.87
754.57
203.87
-25 B
+3 B
WebGPU Nodes 704.94
191.49
704.92
191.49
-25 B
+0 B

@sunag

sunag commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

/ping @sunag If this is done in a compute shader, are we still OK skipping the normalization?

It's ok. The compute implementations still require custom TSL code, the normalization in the fragment stage should be the responsibility of that code.

@sunag
sunag merged commit 8bfadcf into mrdoob:dev Jul 5, 2026
14 of 15 checks passed
@WestLangley
WestLangley deleted the dev-nodes_skinning branch July 5, 2026 23:25
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