It is possibile to use morphTargetInfluences and morphTargetDictionary with an InstancedMesh?

Hi i have a gltf model with a flag and a sail animated using shapekeys that i want to replicate many times.
It is possibile to do this?
Can i use InstancedMesh in combination with morphTargetInfluences and morphTargetDictionary?
I have to play exactly the same animation for each instance.
If it can’t be done with InstancedMesh then can i do it in other ways?

Thanks :slight_smile:

see Update 124 to r133 buffer geometry faces - #7 by Mugen87

So InstancedMesh with morph attributes is not supported :frowning:

Anyway I have made a flag waving animation using ShaderMaterial but i need some help.

For the flag i would like to know how i can access the instance id in the fragment shader to be able to set a diffrent texture for diffrent instances.

For the sail i need to know how i can pin the 4 corner vertices of a plane and moving only the others.

https://codesandbox.io/s/waving-flag-with-shaders-8becb

To pin the corners of the plane i have tried this:

void main()	{
    vInstanceColor = instanceColor;
    float theta = sin( time + position.x ) * factor;
    vec3 transformed = position;
  
    transformed.z = theta;
    if(uv.x==0.0 && uv.y==0.0) {
    transformed.z = transformed.z*uv.y*uv.x;
    }
    if(uv.x==0.0 && uv.y==1.0) {
      transformed.z = transformed.z*uv.y*uv.x;
    }
    if(uv.x==1.0 && uv.y==0.0) {
      transformed.z = transformed.z*uv.y*uv.x;
    }
    if(uv.x==1.0 && uv.y==1.0) {
      transformed.z = transformed.z*uv.y*uv.x;
    }
    

    vUv = uv;
    gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix *vec4(transformed, 1.);
  }

The corner with uv (1,1) is still moves :frowning: