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

**URL:** <https://discourse.threejs.org/t/it-is-possibile-to-use-morphtargetinfluences-and-morphtargetdictionary-with-an-instancedmesh/31537>\
**Category:** Questions\
**Tags:** morph-targets, materials, instanced-mesh, geometry\
**Created:** [November 6, 2021, 11:34pm UTC](https://discourse.threejs.org/t/it-is-possibile-to-use-morphtargetinfluences-and-morphtargetdictionary-with-an-instancedmesh/31537 "2021-11-06T23:34:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dulre1591](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/dulre1591/32/22093_2.png) [@dulre1591](https://discourse.threejs.org/u/dulre1591)\
**Post date:** [November 6, 2021, 11:34pm UTC](https://discourse.threejs.org/t/it-is-possibile-to-use-morphtargetinfluences-and-morphtargetdictionary-with-an-instancedmesh/31537/1 "2021-11-06T23:34:03Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [November 7, 2021, 8:50am UTC](https://discourse.threejs.org/t/it-is-possibile-to-use-morphtargetinfluences-and-morphtargetdictionary-with-an-instancedmesh/31537/2 "2021-11-07T08:50:04Z")

</div>

see [Update 124 to r133 buffer geometry faces - #7 by Mugen87](https://discourse.threejs.org/t/update-124-to-r133-buffer-geometry-faces/31180/7)

---

<div class="post-metadata">

**Author:** ![dulre1591](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/dulre1591/32/22093_2.png) [@dulre1591](https://discourse.threejs.org/u/dulre1591)\
**Post date:** [November 7, 2021, 4:34pm UTC](https://discourse.threejs.org/t/it-is-possibile-to-use-morphtargetinfluences-and-morphtargetdictionary-with-an-instancedmesh/31537/4 "2021-11-07T16:34:11Z")

</div>

So InstancedMesh with morph attributes is not supported ☹

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`

---

<div class="post-metadata">

**Author:** ![dulre1591](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/dulre1591/32/22093_2.png) [@dulre1591](https://discourse.threejs.org/u/dulre1591)\
**Post date:** [November 7, 2021, 6:04pm UTC](https://discourse.threejs.org/t/it-is-possibile-to-use-morphtargetinfluences-and-morphtargetdictionary-with-an-instancedmesh/31537/5 "2021-11-07T18:04:48Z")

</div>

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

```javascript
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 ☹
