-
Hi, I have an animation exported from mixamo into fbx format, is it possible for me to merge the animation with my glb/tf file? so basically with AR-Core for augmentated reality, you need an animation within the glb/tf file for it to play, you cannot link an external animation. do I'd have to somehow import the animation into the glb file to have it played in AR. Secondly, is the node rotation not precise? I've imported the same model in blender and gltf transform document and while setting a node's rotation values in blender works fine however copying those set values from blender to gltf transform rotate method it works completely different, is there something I'm missing? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Everything is possible with enough work, however glTF Transform does not read FBX files. In general I would expect this to be complex. The biggest hurdle probably is that FBX and glTF are different formats with different representations of the skeletal and animation data, and different coordinate and scale conventions. You'll need all of those to match exactly between the glTF armature and the FBX animation data. In practice I think the best way to do this is to load both the glTF and FBX files into Blender, set up the armature, make sure it works there, and then export it to glTF. The FBX animation file will need to be built around the same armature as the glTF file uses.
It is lossless. glTF Transform's node.setRotation requires a Quaternion in XYZW order. Blender allows specifying rotations as Quaternions WXYZ, but uses Euler XYZ by default: node.setRotation([x, y, z, w]); |
Beta Was this translation helpful? Give feedback.
-
I'm looking into the same issue and these are my attempts so far: https://stackoverflow.com/questions/73175454/merge-a-gltf-model-with-gltf-animation-mixamo-into-one. I tried to merge a model GLTF file with an animation GLTF (exported and converted from Mixamo), but unfortunately the created output isn't animated. `import { Document, NodeIO } from '@gltf-transform/core'; const io = new NodeIO(); const buffer = outputDocument.getRoot().listBuffers()[0]; |
Beta Was this translation helpful? Give feedback.
-
it took me a while to understand what dom meant but I finally figured it out and had it working. // find the skin
const skin = root.listSkins()[0]
// get animation channels
const animationChannels = root.listAnimations()[0].listChannels()
animationChannels.forEach((channel) => {
const curTargetNode = channel.getTargetNode().getName()
const newTargetNode = skin.listJoints().find((node) => node.getName() === curTargetNode)
if (newTargetNode) channel.setTargetNode(newTargetNode)
}) |
Beta Was this translation helpful? Give feedback.
-
@iiLearner This was the missing piece, now it works. Awesome, thanks!!! |
Beta Was this translation helpful? Give feedback.
it took me a while to understand what dom meant but I finally figured it out and had it working.
Code below: