Gltf-blender-io: Constant curve support for flipbooking

Created on 24 Apr 2020  路  5Comments  路  Source: KhronosGroup/glTF-Blender-IO

Is your feature request related to a problem? Please describe.
I am baking effects like fluids into gltf. I bake the simulation down into a low resolution mesh per frame and then animate it's visibility/scale on and off per frame, like a childs flipbook animation or caymations.

each frame has three keyframes and uses constant, or stepped curve interpolation.
i.e.
image

the results look like this in blender:
flipbook_constant_curve_test

however, in GLTF they look like this:
strobe

The problem is that the animation playblack is variable and the gltf baked curves are crossfading using the linear interpolation from the animation resample on export. the result is strobing. if the curve interpolation were stepped/constant, the animation would playback fine.

here's the source blender file if you want a look.
flipbook_constant_curve_test_blender.zip

Describe the solution you'd like
keyframes that are using constant interpolation type in blender should export through to GLTF, and the gltf sampler channels should use interpolation as constant. e.g. they hold the same value until the next keyframe.

I think "flipbooked" mesh animations like this for various effects not possible with skinning or blendshapes is worthwhile to support. to support it, if the

Describe alternatives you've considered
allembic support, but android hates allembic.

Additional context
more animators are going to ask for this.
https://vimeo.com/channels/1522686/379550189

Animation exporter question

Most helpful comment

I don't think this is related to flipbooking. You can turn off _Animation > Always Sample Animations_ to get curves with constant interpolation and see the same problem.

I think this has to do with the fact that your animation is getting exported as multiple glTF animations. All the animations have different lengths and loop independently in the viewer. You want all your actions to be one animation that only loops when the whole thing is over.

The exporter uses NLA tracks to organize actions into animations by default, but if you turn off the _Animation > NLA Strips_ option, it will put all the currently assigned actions into one glTF animation. If I do that and export (with or without _Always Sample Animations_), I get a glTF file that works like you expect.

When _NLA Strips_ is on, the exporter puts any actions that aren't in NLA tracks each into its own glTF animation. It might instead make sense to have it put all of them into one glTF animation, since they _are_ logically grouped in that they're playing together in Blender.


tl;dr turn off _Animation > NLA Strips_ in the export options.

All 5 comments

liner curve interpolation creates bad strobing artifacts because the render does not lineup with frames.

i.e.
flipbook_constant_curve_test.glb.zip

another solution is to lock the animation playback to the gltf framerate so that the subframe cross scaling frames don't strobe.

I don't think this is related to flipbooking. You can turn off _Animation > Always Sample Animations_ to get curves with constant interpolation and see the same problem.

I think this has to do with the fact that your animation is getting exported as multiple glTF animations. All the animations have different lengths and loop independently in the viewer. You want all your actions to be one animation that only loops when the whole thing is over.

The exporter uses NLA tracks to organize actions into animations by default, but if you turn off the _Animation > NLA Strips_ option, it will put all the currently assigned actions into one glTF animation. If I do that and export (with or without _Always Sample Animations_), I get a glTF file that works like you expect.

When _NLA Strips_ is on, the exporter puts any actions that aren't in NLA tracks each into its own glTF animation. It might instead make sense to have it put all of them into one glTF animation, since they _are_ logically grouped in that they're playing together in Blender.


tl;dr turn off _Animation > NLA Strips_ in the export options.

@spiraloid Can/did you retest this using last week's fixes from #1035?

Also, make sure every last keyframe on a track is "constant", and there's not even a single "linear" keyframe mixed anywhere in there. glTF sets interpolations on whole animations, not individual keys.

confirmed it's working! you guys are awesome! close the issue.

Thanks for your feedback!
Closing

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spiraloid picture spiraloid  路  3Comments

KannebTo picture KannebTo  路  3Comments

UX3D-nopper picture UX3D-nopper  路  3Comments

donmccurdy picture donmccurdy  路  3Comments

scurest picture scurest  路  4Comments