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

Blend Shape / Morph Target Support #33

Merged
merged 8 commits into from
Nov 5, 2017
Merged

Blend Shape / Morph Target Support #33

merged 8 commits into from
Nov 5, 2017

Conversation

zellski
Copy link
Contributor

@zellski zellski commented Nov 5, 2017

This adds blend shape / morph target functionality.

At the FBX level, a mesh can have a number of deformers associated with it. One such deformer type is the blend shape. A blend shape is a collection of channels, which do all the work. A channel can consist of a single target shape (the simple case) or multiple (a progressive morph). In the latter case, the artist has created in-between shapes, the assumption being that linear interpolation between a beginning shape and an end shape would be too crude. Each such target shape contains a complete set of new positions for each vertex of the deformed base mesh.

(It's also supposed to be optionally a complete set of normals and tangents, but I've yet to see that work right; they always come through as zeroes. This is something to investigate in the future.)

So the number of glTF morph targets in a mesh is the total number of FBX target shapes associated with channels associated with blend shape deformers associated with that mesh! Yikes.

The per-vertex data of each such target shape is added to a vector in RawVertex. A side effect of this is that vertices that participate in blend shapes must be made unique to the mesh in question, as opposed to general vertices which are shared across multiple surfaces.

Blend Shape based animations become identical glTF morph target animations..

Par Winzell added 8 commits October 29, 2017 01:59
- This does not support progressive morphs. Still evaluating whether
  that's required functionality. It's really just a little bit of more
  work. An example implementation is available in the SDK samples.

- We're blithely ignoring NORMALs and TANGENTs. This almost certainly
  has to change.
Everything's in place to drop the progressive morph calculations into
readAnimations(). Shouldn't be hard.

Normals are proving trickier. I'm not convinced they make it into the
FBX at all. The SDK reports the existence of normals in the primary
layer, but they seems to consist exclusively of zeroes.

We may have to compute them.
It's always junk. I'm not sure they're ever exported.

We can explore this in greater detail another time.
@zellski zellski merged commit 9ae3608 into facebookincubator:master Nov 5, 2017
@zellski zellski deleted the feat-morph-targets branch November 5, 2017 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants