Animation of Gltf model exported from blender not working

1,535 views
Skip to first unread message

Qandeel Abbassi

unread,
Feb 14, 2019, 8:42:16 AM2/14/19
to cesium-dev
Hello there, i am trying to animate a gltf model exported from blender using gltf-Blender-Exporter. The animation works in blender and some online model viewers too but i have failed to play it in cesium. Following is my code:
var viewer = new Cesium.Viewer('cesiumContainer', {
    infoBox
: false,
    selectionIndicator
: false,
    shadows
: true,
    shouldAnimate
: true
});
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
   
Cesium.Cartesian3.fromDegrees(101.70333333333,3.1527777777778,600));
var model = viewer.scene.primitives.add(Cesium.Model.fromGltf({
    url
: Cesium.buildModuleUrl('Assets/Textures/flame/gltf_file.gltf'),
    modelMatrix
: modelMatrix,
    scale
: 5000
}));
Cesium.when(model.readyPromise).then(function(model) {
  model
.activeAnimations.addAll({
    loop
: Cesium.ModelAnimationLoop.REPEAT
 
});
})

Can anyone help me finding the issue here? I have attached the gltf file for reference.

-Thanks!


Cesium version: 1.48
flame.gltf

Qandeel Abbassi

unread,
Feb 15, 2019, 5:38:44 AM2/15/19
to cesium-dev
I can see the animation names in model.activeAnimations which means they are being added to the model but for some reason they don't work. I have tried another model which only had simple scale animation and that didn't work too. Its strange.

Ed Mackey

unread,
Feb 15, 2019, 10:04:17 AM2/15/19
to cesium-dev
Cesium doesn't yet support the CUBICSPLINE animation type.

In the Blender glTF exporter, look for the export options panel, "Animation" tab (during export).  Try putting a checkmark on "Always Sample Animations."  That should convert everything to LINEAR.  Let us know if it works!

               --Ed.

Qandeel Abbassi

unread,
Feb 15, 2019, 11:22:35 AM2/15/19
to cesium-dev
Hello Ed,
I tried the "Always sample animation" option in blender gltf exporter but the animation is still not working. I have attached the newly exported file.
flame.gltf

Ed Mackey

unread,
Feb 15, 2019, 1:34:56 PM2/15/19
to cesiu...@googlegroups.com
The .gltf file by itself won't work without the .bin and textures.  Can you attach a .glb file instead?  The .glb form has the whole bundle.  Thanks,

            --Ed.


--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/G1A4mNQyFy4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Qandeel Abbassi

unread,
Feb 15, 2019, 2:48:26 PM2/15/19
to cesium-dev
Hello Ed,
Thanks for quick response, i appreciate your time. I have placed the .bin and texture file in the same folder the .gltf is placed and I think its working because I can see the texture on the model in cesium. I am not using .glb because sometimes it gives strange output i.e. objects are not placed at right positions and the scale is not right. I have attached a rar files which contains .glb, .gltf, .bin, texture, and my export settings screenshot. Both .glb and .gltf are exported with "Always sample animation" option now.  

-Thanks
Flame.zip

Ed Mackey

unread,
Feb 15, 2019, 3:58:43 PM2/15/19
to cesiu...@googlegroups.com
Well.  Looks like the sampled animations are using STEP, not LINEAR.  My general thoughts on this are (a) Cesium should add support for STEP animation, and (b) I'm disappointed the Blender exporter is producing STEP instead of LINEAR as an approximation for sampled spline curves, that seems incorrect.

Not sure what to tell you from here.  Either Cesium or the Blender exporter (or both) will need to change.

The only workaround you have left is to go into Blender's Graph Editor pane, select some keyframes and manually change the "interpolation type" to "linear".  This will remove all the curvature, so you'll need additional linear keyframes to break up the straight lines and make them look a little more as if they were curves.  I'm sorry I don't have anything better to tell you about this, but it would seem that some issues need to be filed.

            --Ed.

Qandeel Abbassi

unread,
Feb 15, 2019, 6:16:12 PM2/15/19
to cesium-dev
Thanks alot Ed! for pointing me in the right direction. I will experiment with graph editor and post my results here and I will also file an issue on git repo.

Qandeel Abbassi

unread,
Mar 4, 2019, 5:52:59 AM3/4/19
to cesium-dev
I exported the model to gltf using "Always Sample Animations" option. Then I opened .gltf file in text editor and replaced STEP with LINEAR manually. The animations are now working.  However, animations are behaving slightly different than original ones.

On Saturday, February 16, 2019 at 1:58:43 AM UTC+5, Ed Mackey wrote:

Ed Mackey

unread,
Apr 16, 2019, 9:50:41 AM4/16/19
to cesiu...@googlegroups.com
A fix was submitted to the Blender exporter in https://github.com/KhronosGroup/glTF-Blender-IO/pull/417.  I think it should have made it into last night's build of 2.80.

           --Ed.

Reply all
Reply to author
Forward
0 new messages