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

Implement morph targets #32

Merged
merged 0 commits into from
Oct 17, 2018
Merged

Implement morph targets #32

merged 0 commits into from
Oct 17, 2018

Conversation

scurest
Copy link
Collaborator

@scurest scurest commented Jul 26, 2018

A somewhat hacky implementation of morph targets

  • In glTF, morph target weights are associated with the mesh instance, not the mesh (ie. in Blender, that means they would be associated with the object, not the mesh). But in Blender, they are part of the shape key which is attached directly to the mesh. So two different objects cannot share a mesh that has morph targets (because you couldn't set their weights independently, for eg. animation). Therefore mesh instances that shared a mesh with morph targets in the glTF do not share their mesh after importing into Blender.
  • Despite this, there is no API I could find that would let me set the shape key on a mesh and, amusingly, the only way I find to do it was actually by first attaching the mesh to an object and using an API on the object (yes, really!). So the code for this is rather ugly. OTOH, the code for animations, being free of the vicissitudes of coordinate changes that plagued animating TRS properties, is comparatively simple.

Are morph targets the last major feature we're missing? I think this will make everything in base glTF implemented in some form, though not necessarily implemented without any bugs ;)

(This is implemented on top of #31 and its history should look better if that is merged).

@scurest
Copy link
Collaborator Author

scurest commented Aug 11, 2018

The latest commit is slightly less hacky (or rather, the hack is now contained in a single function). There is now one bmesh that we use throughout all mesh creation and no more round-tripping. This requires re-labelling the vertex indices, but after the fix for #29 we already do that. As a bonus, it shaves about 2-3 seconds off the import time for MetalRoughSpheres for me.

@ksons
Copy link
Owner

ksons commented Aug 15, 2018

@scurest Looks amazing! Could you please fix the conflicts or base the changes on the previous merge?

@scurest
Copy link
Collaborator Author

scurest commented Aug 15, 2018

If you had done a regular merge of #31 like I asked it wouldn't need to be rebased. I don't see why I should have to rebase after every single PR.

@ksons ksons merged commit 5ca94a2 into ksons:master Oct 17, 2018
@scurest scurest deleted the morph-targets branch October 23, 2018 19:42
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

Successfully merging this pull request may close these issues.

2 participants