Skip to content

BufferGeometryUtils: Fix skinned normals in computeMorphedAttributes(). - #35413

Merged
Mugen87 merged 2 commits into
mrdoob:devfrom
Enesuygurs:fix/skinned-normals-compute-morphed-attributes
Nov 9, 2026
Merged

Mugen87 merged 2 commits into
mrdoob:devfrom
Enesuygurs:fix/skinned-normals-compute-morphed-attributes

Conversation

@Enesuygurs

Copy link
Copy Markdown
Contributor

Related issue: -

Description

BufferGeometryUtils.computeMorphedAttributes() skins positions and normals the same way. It passes both to SkinnedMesh.applyBoneTransform() as a Vector3, and a Vector3 is treated as a point. That means the bone translation gets added to the normals too, so morphedNormalAttribute is wrong for basically any skinned mesh whose bones move.

Here is a small example: one bone, every vertex fully weighted to it, normal (0, 1, 0). Moving the bone by (5, 0, 0) gives a morphed normal of (5, 1, 0) when it should stay (0, 1, 0).

Since #33091, applyBoneTransform() can take a Vector4, and w = 0 transforms a direction. This PR uses that for the normal attribute, which matches how the skinning shader handles normals (skinMatrix * vec4( objectNormal, 0.0 )). Positions are skinned exactly as before.

I added a unit test that translates and rotates a bone. It checks that the morphed position is moved and rotated, and that the morphed normal is only rotated.

@Mugen87 Mugen87 added this to the r188 milestone Nov 9, 2026
@Mugen87
Mugen87 merged commit 9eaf4eb into mrdoob:dev Nov 9, 2026
7 of 8 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.

2 participants