Different morph targets w/ setMorphAt()

how do you set different morph targets for individual instances?

say I export a :monkey_face: from Blender with 2 different morph targets. can you animate half the instances using the first morph target influence, and the other half by the second?

Wasn’t aware of this new feature!

From the morph target example, I’ve put together this animation with InstancedMesh and setMorph, the first half morph to a sphere the second half get twisted.

2 Likes

Thank you for spelling it out for me! passing in an object with a morphTargetInfluences array was the missing link for me.

Here is my R3F implementation:

https://different-morphtargets-instancedmesh.vercel.app/

1 Like

I find it strange that the setMorphAt(index, mesh) function requires an entire mesh as a parameter, when all it needs is the morphTargetInfluences array. It could be improved by directly accepting the array itself, something like: setMorphAt(index: number, morphTargetInfluences: number[]).

My best guess is that they did it that way because the Mesh class generates the morphTargetInfluences when initialized with Mesh.updateMorphTargets, or maybe to better fit some UI library.

Still, I think the current approach can lead to confusion. On the bright side, its a recent feature, it’s functional, and there’s always room for improvement.