Skip to content

Conversation

@WestLangley
Copy link
Collaborator

This PR modifies Quaternion.slerp() and Quaternion.slerpFlat() to use the same algorithm -- the one used by Unity and Filament.

//

True spherical linear interpolation is unnecessary for small angles. Instead, linear interpolation followed by a re-normalization is used for small angles.

I noticed in the FBX and Collada skinning examples, the small-angle case occurs less than 2% of the time.

When switching to the algorithm used by Unity, the same skinning examples execute the small-angle case about 75% of the time.

The lesson here is to avoid using Number.EPSILON indiscriminately.

@WestLangley WestLangley added this to the r181 milestone Sep 10, 2025
@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.24
79.14
338.24
79.14
+0 B
+0 B
WebGPU 580.27
160.28
580.27
160.28
+0 B
+0 B
WebGPU Nodes 578.88
160.04
578.88
160.04
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 469.88
113.85
469.7
113.74
-177 B
-104 B
WebGPU 649.98
175.93
649.8
175.85
-177 B
-85 B
WebGPU Nodes 604.09
165.11
603.91
165.01
-177 B
-97 B

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 10, 2025

Does that mean the new approach enables performance improvements (probably depending on the input data)?

@WestLangley
Copy link
Collaborator Author

Does that mean the new approach enables performance improvements (probably depending on the input data)?

Correct.

@mrdoob mrdoob merged commit 7085e35 into mrdoob:dev Sep 11, 2025
9 checks passed
@WestLangley WestLangley deleted the dev-quaternion branch September 11, 2025 05:27
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