KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.5k stars 319 forks source link

Constant interpolation ignored, even with all keyframes using it #2365

Open Orso2p2n opened 2 months ago

Orso2p2n commented 2 months ago

Describe the bug When exporting a scene with actions that use only constant keyframes, the exported gltf still uses LINEAR interpolation.

To Reproduce Steps to reproduce the behavior:

  1. Download the example file.
  2. Observe that all the keyframes of the "idle" action use constant interpolation
  3. Export in GLTF with Animation mode on "Actions".
  4. Open model in gltf viewer.
  5. Observe that the animation still uses linear interpolation.

(Alternatively, export the model using glTF Separate, and open the .gltf in a text editor to see that it still uses "interpolation: LINEAR" for most of the samplers)

Expected behavior According to #2137, having all the keyframes use constant interpolation should export using STEP.

Screenshots The animation in Blender: blender_y55n067eUP

The animation in gltf viewer: firefox_Vf8NuxFWWK

.blend file/ .gltf (mandatory) character.zip

Version

julienduroure commented 2 months ago

Hello,

Most (didn't check every individual channels, but some of them) channels that become "LINEAR" are some bone channels that are not animated in your model.

CONSTANT are kept as STEP, but for not directly animated bones (like any deformation bones) are currently exported as LINEAR, as we don't have any interpolation information.

An enhancement that can be done is to let the user choose what interpolation should be used when sampling not animated bones

Orso2p2n commented 2 months ago

Thank you for your answer!

Is there a way for me to work around this problem, without having to replace all the instance of "LINEAR" by "STEP" in the gltf file every time i export?

I tried adding a keyframe with constant interpolation for every channel, and setting those channels' extrapolation mode to Constant Extrapolation, to no avail.