-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
glTF 2.0 morph animation support #11350
Conversation
examples/js/loaders/GLTF2Loader.js
Outdated
// + weight1 * morphTarget1 | ||
// ... | ||
// then adding position to morphTarget. | ||
// motphTarget should depend on mesh, so cloning attribute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*morphTarget
These BufferAttributes aren't mutated while playing animation, are they? If not, what's the reason for cloning them? I'm not sure I follow the "should depend on mesh" part. Hmm never mind I see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've updated the comment to clarify more.
Nice! Does this work with both the sphere and cube examples? |
Yup! But we also need to merge #11351 for them. |
Ok cool! May also want to wait on this PR until #11285 is in. |
examples/js/loaders/GLTF2Loader.js
Outdated
@@ -2111,6 +2112,93 @@ THREE.GLTF2Loader = ( function () { | |||
meshNode = new THREE.Mesh( geometry, material ); | |||
meshNode.castShadow = true; | |||
|
|||
if ( primitive.targets !== undefined ) { | |||
|
|||
geometry.morphTargets = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If #11285 is merged, creating geometry.morphTargets = [];
should not be necessary anymore. Instead, you need to set the name of a morph target directly to a morphAttribute
, see https://github.com/Mugen87/three.js/blob/f375cf243b9214266e9d40d3bf0e5da7862b47bc/examples/js/loaders/MMDLoader.js#L789
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#11285 has been merged 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay 🎉 ! 😊
Updated! |
Updated for the case if some
|
@donmccurdy looks good? |
Looks good to me! |
Thanks! |
This PR lets
GLTF2Loader
support glTF 2.0 morph animation, excludingTANGENT
. #11326I'm not familiar with tangent yet.
How can we support tangent?
Converting tangent to normal?
Let's make another PR for
TANGENT
support.