Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shape keys intermittently do not work when using more than 4 at once #959

Closed
j-conrad opened this issue Mar 4, 2020 · 3 comments
Closed

Comments

@j-conrad
Copy link

j-conrad commented Mar 4, 2020

An object with multiple shape keys (in this case, 10) intermittently doesn't respond as expected when mixing those morph shapes together. In the provided example, the cube has 9 shape keys where each of them only moves 1 vertex. The tenth shape twists the mesh, moving about 17 verts at once.
I am able to use the various glTF viewers to adjust the shape keys, however, when mixing beyond about 4 channels, the mesh begins to respond strangely. Sometimes there is no affect on the model until a slider reaches its limit. Other times, unrelated verts are affected when they shouldn't be. I assumed it was possibly related to an individual vertex being affected by multiple channels. But the first 9 are completely isolated verts.

To Reproduce
Steps to reproduce the behavior:

  1. Drop the provided .glb into a glTF viewer that supports shape keys (morph targets, whatever).
  2. Slide Keys 1, 3, 7, and 9 up to non-zero values. This should have four top corners sticking out.
  3. Now attempt to slide Key 5 up.
  4. Result: One of the other verts' position gets negated and the 5th vertex pops unexpectedly into position late in the slider's movement.

Expected behavior
I would expect each vertex to move individually as they do within Blender (with the obvious exception of the last twisty shape key).

Screenshots
https://gyazo.com/3f747db650c5f5bfbabc93312eaf67de

.blend file/ .gltf
MorphBug.zip

Version

  • OS: Windows
  • Blender Version 2.82.7

Additional context
Add any other context about the problem here.

@donmccurdy
Copy link
Contributor

donmccurdy commented Mar 4, 2020

This is a common limitation in realtime engines — when shape keys are applied on the GPU, each active shape key requires 1-3 vertex attributes, and there are only 16 vertex attributes available on most devices. Other features (skinning, vertex colors, UVs, ...) also require vertex attributes.

In three.js, specifically, no more than 8 vertex attributes can be used by shape keys. You're hitting a limit at 4 shape keys because each shape key has both position and normal attribute. If you disable the "Shape Key Normals" option, you'll likely see the limit increase from 4 shape keys to 8 shape keys in most engines, because each shape key then requires 1 vertex attribute instead of 2.

Screen Shot 2020-03-03 at 6 02 13 PM

Beyond that, an exporter can't increase these limits.

@donmccurdy
Copy link
Contributor

donmccurdy commented Mar 4, 2020

Related: https://discourse.threejs.org/t/limit-8-blendshapes-on-the-fbxloader/3906/8

EDIT: Fixed incorrect link.

@j-conrad
Copy link
Author

j-conrad commented Mar 4, 2020

Thank you for the information and clarification. This makes a lot of sense now that I understand it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants