Using ThreeJs r164.1
How are related geometry.morphAttributes.position
arrays to geometry.attributes.position
.
I inspected 2 fbx loaded models and I observed that geometry.morphAttributes.position[n].count
is less than geometry.attributes.position.count
.
In the big picture I want to optimise the model and recreate meshes and skinned meshes around new geometry grouped by materialIndex.
I do that by iterating on groups for each mesh and extracting from attributes the vertices that are related for that group.materialIndex === mesh_material_index
Everything went fine until I tried to port the morphAttributes into new skinned meshes.
The issue is that if their length would be equal I could apply the same slicing method.
But since their count is different …
I found a comment in FBXLoader saying that: “Normal and position attributes only have data for the vertices that are affected by the morph”.
But if for example I check the ThreeJS code for Mesh.getVertexPosition I see it assumes their count is equal.
I am looking for a clue, some info that I miss that would map geometry.morphAttributes.position[n]
to
geometry.attributes.position
.
BTW: ChatGPT also assumes they are equal.
If I play around with morphTargetInfluences they work fine (I can see the character changing with meaning: like smile face expression)
Opening the model in Blender I can see the shape keys and that they are related to the base shape (same number of vertices).