# Limit 8 BlendShapes on the FBXLoader

**URL:** <https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906>\
**Category:** Questions\
**Tags:** morph-targets, loaders\
**Created:** [August 27, 2018, 5:52am UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906 "2018-08-27T05:52:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@Tom](https://discourse.threejs.org/u/Tom)\
**Post date:** [August 27, 2018, 5:52am UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/1 "2018-08-27T05:52:34Z")

</div>

Hello everybody

Is there a way to run the FBXLoader with 12 instead of just 8 BlendShapes?

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [August 27, 2018, 7:39am UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/2 "2018-08-27T07:39:35Z")

</div>

This is a limitation of three.js, not the loader. See this post for more info:

> <https://stackoverflow.com/questions/29943639/increase-number-of-maximum-assigned-morph-targets-on-a-mesh>

---

<div class="post-metadata">

**Author:** ![Tom](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@Tom](https://discourse.threejs.org/u/Tom)\
**Post date:** [August 27, 2018, 7:48am UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/3 "2018-08-27T07:48:09Z")

</div>

@looeee, thanks for the information. It works with JSON, so I thought it was up to the loader itself.

---

<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:** [August 27, 2018, 10:08am UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/4 "2018-08-27T10:08:56Z")

</div>

> [@Tom](#):
>
> It works with JSON,

What do you mean by that? Just to be clear, loaders in general can parse an arbitrary amount of morph targets. The limitation is that maximal eight morph targets can influence the final position of a vertex at the same time.

---

<div class="post-metadata">

**Author:** ![Tom](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@Tom](https://discourse.threejs.org/u/Tom)\
**Post date:** [August 27, 2018, 4:42pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/5 "2018-08-27T16:42:39Z")

</div>

Yes, I realize that. In my JSON variant, I use up to 15 Shapes and it works. Maybe I’m lucky and only 8 will be used at the same time.

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [August 28, 2018, 3:58pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/6 "2018-08-28T15:58:16Z")

</div>

Depends on how you intend to use them, like temporary changes or realtime animation.

For character customization i’m using 24 different while the model uses only one morph target, i mix all on CPU into the GPU one.

---

<div class="post-metadata">

**Author:** ![jds580s](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jds580s/32/6852_2.png) [@jds580s](https://discourse.threejs.org/u/jds580s)\
**Post date:** [August 28, 2018, 4:22pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/7 "2018-08-28T16:22:20Z")

</div>

> [@Fyrestar](#):
>
> For character customization i’m using 24 different while the model uses only one morph target, i mix all on CPU into the GPU one.

Care to share your approach for using them for temporary changes that get pushed down into only one morph target? That is exactly what I am trying to accomplish but have run up against the limit of 8. Thanks!

---

<div class="post-metadata">

**Author:** ![Tom](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@Tom](https://discourse.threejs.org/u/Tom)\
**Post date:** [August 28, 2018, 5:41pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/8 "2018-08-28T17:41:39Z")

</div>

Hi, it’s a bit more complicated because I’m using something that does not actually exist. I have developed my own expression data recorder, which uses its own form of control data that I have specially designed for it. So I’m coping with a much smaller amount of data. The whole thing is based on the BVH, but is different in the ground, so that it still works. In addition, I also control with different combinations. There are quite a few, depending on the character. Now we are with JSON on the border whit the textures, so I hope more from FBX, but the thing with the control starts again from the beginning. At JSON you can see at least all shapes, at FBX only 8 (are displayed) @Mugen87, we have debated a lot about a recorder. He is now running whit an own control data concept.

At the moment I still have problems controlling the FBX character. That’s why I use the DatGui first, so I’m sure that it runs, before I connect with the other controller.

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [August 28, 2018, 6:33pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/9 "2018-08-28T18:33:32Z")

</div>

@Fyrestar this is something I’ve wondered about previously - currently in the `FBXloader` when more than 8 morph targets are found we just log a warning and ignore the rest of the targets. Would it be better to parse these targets as well? Does adding more than 8 morph targets to a buffer geometry cause problems?

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [August 28, 2018, 6:49pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/10 "2018-08-28T18:49:59Z")

</div>

I don’t know about the FBXLoader, but vertex attributes are limited (around 16 i guess depending on the card).

To avoid this limit on GPU the states can be stored in a float texture atlas instead vertex attributes. I just took a look at my implementation and i actually use a texture instead the attribute approach of THREE since for a composed morph target buffer attribute you would require a geometry per mesh.

For the composed approach this requires one composition texture per mesh (per character for example).

Edit: how many attributes are supported can be seen in `renderer.capabilities.maxAttributes`, on my TitanX it’s 16, low-end cards might have less, i suppose 8.

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [August 28, 2018, 6:54pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/11 "2018-08-28T18:54:25Z")

</div>

There are working examples with 30-50 morph targets using JSON and glTF in the three.js examples — everything on [https://mrdoob.github.io/rome-gltf/](https://mrdoob.github.io/rome-gltf/) works that way. The key thing is that only ~2 morph targets are active at a given time, the animation clips cycle through them gradually. So I don’t think there should be any reason for FBXLoader to drop morph targets, as the renderer will be smart about playing them back.

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [August 28, 2018, 7:00pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/12 "2018-08-28T19:00:26Z")

</div>

Animation clips?

Morph targets are composed of multiple states like [https://threejs.org/examples/webgl\_morphtargets.html](https://threejs.org/examples/webgl_morphtargets.html). It requires all states to be on the GPU if composed in realtime.

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [August 28, 2018, 7:16pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/13 "2018-08-28T19:16:35Z")

</div>

Yep! You can design an AnimationClip such that it cycles through the morph target states with only a few active at once, and there is some [logic in WebGLMorphTargets](https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLMorphtargets.js) to ensure that only active morph targets are taking up one of the 16 slots. I’m not sure how that is accomplished in WebGL APIs to be honest, but would be curious to learn… In any case, it works:

![866A7EBA-8A28-4F77-AEDC-387613EC5960-98372-0001004C82DF734F](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/threejs/original/2X/3/3c17ac23c19da8b4b01c3848fec19b98b1c85e00.gif)

[Horse.glb](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/threejs/original/2X/3/34d34a810a3c859c01a1e6b62d1617aae519e002.glb) (177.5 KB)

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [August 28, 2018, 7:33pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/14 "2018-08-28T19:33:11Z")

</div>

Switching the attributes doesn’t really solve the limitation in sense of using all at once. For animations of course this seems a good approach, even though it’s still limited for mixing between them.

But skeletal animations are rather suited for this kind of animation, morph targets are rather used for per-vertex animations such for facial expressions.

In my case the character customization uses a single human geometry mixing gender, age, size, weight and various body proportions, those doesn’t need to be animated (even though it still works smoothly composing on CPU with 24 on a 3-4k vertices geometry) so using 1 composition texture of the size for 1 set of positions isn’t too much. The composition has relative displacements, so if the precision allows it, a cheaper RGB8 instead RGB16 texture can be used (64x64 for up to 4096 vertices).

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [August 28, 2018, 7:48pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/15 "2018-08-28T19:48:05Z")

</div>

True, but I think it’s relevant to the point that FBXLoader shouldn’t _remove_ morph targets \>9. The loader doesn’t know whether the targets will be applied simultaneously.

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [August 28, 2018, 7:56pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/16 "2018-08-28T19:56:29Z")

</div>

Yes, if they are sequential animation frames there isn’t really an issue and as your example shows it already tries to use a few as possible. I don’t know about the FBX format internally right now, but if those morph targets somehow hint to be for vertex keyframe animations then it could skip the removal.

---

<div class="post-metadata">

**Author:** ![Tom](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@Tom](https://discourse.threejs.org/u/Tom)\
**Post date:** [August 28, 2018, 7:57pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/17 "2018-08-28T19:57:52Z")

</div>

It would also be much more comfortable to use the models because if you need to use certain morph targets that are not among the top 8, you do not need to rebuild your model, which is the case now.

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [August 28, 2018, 8:30pm UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/18 "2018-08-28T20:30:13Z")

</div>

@looeee wouldn’t it be better to optionally implement morph targets on a texture atlas like i described? Basically bones do just the same storing the matrices in an atlas, this is optionally too but used by default.

If more attributes such as normals are used per target it even cuts the possible slots by half, and the regular attributes already take up 4.

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [August 29, 2018, 11:36am UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/19 "2018-08-29T11:36:10Z")

</div>

OK, I’ll change the behaviour to return all the morph targets. Do you think it should still display a warning?

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [August 29, 2018, 11:38am UTC](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/20 "2018-08-29T11:38:09Z")

</div>

Perhaps, I’m not sure if there are any caveats to doing it that way. Perhaps you could open an issue on GH and suggest this? Or even better, make a PR so we can test both approaches.

[Next page](https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906.md?page=2)
