Maya2glTF icon indicating copy to clipboard operation
Maya2glTF copied to clipboard

Export scale keys with STEP interpolation instead of LINEAR

Open Damani2 opened this issue 3 years ago • 6 comments

I'm working with a sequence of meshes that I'm trying to animate in sequential order and export to glb. I've created a Maya scene with an .obj sequence using a script to assemble the sequence. As I understand it, glb doesn't support visibility keys. So I've added scale keys overtop the visibility keys.

Could someone explain to me how I can export this animated sequence as glb?

I'm attaching my Maya scene file without textures as a google drive link below. I used Maya 2018 as well. Maybe I just don't understand the animation options. Do I need to create an animation clip for this? What for? How do I ensure my scale keys are exported? If someone could go over the proper settings/parameters for this with me I'd really appreciate it. I also think I've had issues with the select all polygon meshes button. I got the sense that I have to actually select all my meshes from the outliner. The visible only box I checked to off, because I want to leave the visibility keys and just add the scale keys on top. I'm assuming the visibility keys are completely ignored.

Thank you

https://drive.google.com/file/d/1F-E-bqA9Ynh6S-2uLjJGy1dCarOmiFQ0/view?usp=sharing

Damani2 avatar Mar 11 '21 17:03 Damani2

For some reason my Maya's keep crashing on startup, so I can't test this right now... I'll get back to you when this is fixed.

Now, ccurrently Maya2glTF always uses linear interpolation between two sampled keys. When "abusing" scaling for visibility, one should use "STEP" interpolation...

Because Maya2glTF is a sampling exporter (e.g. it reconstructs all animation values from world space transformations), I can't just read the Maya curve interpolation value. What I could do, is add a custom attribute where one can specify the GLTF interpolation modes... I will need to experiment with that a bit.

https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animation-samplerinterpolation

ziriax avatar Mar 11 '21 19:03 ziriax

For some reason my Maya's keep crashing on startup, so I can't test this right now... I'll get back to you when this is fixed.

Now, ccurrently Maya2glTF always uses linear interpolation between two sampled keys. When "abusing" scaling for visibility, one should use "STEP" interpolation...

Because Maya2glTF is a sampling exporter (e.g. it reconstructs all animation values from world space transformations), I can't just read the Maya curve interpolation value. What I could do, is add a custom attribute where one can specify the GLTF interpolation modes... I will need to experiment with that a bit.

https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animation-samplerinterpolation

Damani2 avatar Mar 11 '21 20:03 Damani2

I was finally able to open your scene on another PC.

I'm not able to export animation at all, so I'll need to debug this. I'll report back if I have more news.

ziriax avatar Mar 12 '21 14:03 ziriax

I was finally able to open your scene on another PC.

I'm not able to export animation at all, so I'll need to debug this. I'll report back if I have more news.

I was actually able to get it working! The note on step interpolation helped. I redid all the keys as step and it worked. Attaching my file. I am still a bit bothered by the way the scale transition looks. It gives a bit of a "blippy" effect. I want to try maybe using houdini/voxels for shapekey transitions.

https://drive.google.com/drive/folders/1rY14xeltZwn4WR8BXA7Ebubf9aZHZmk_?usp=sharing

Damani2 avatar Mar 12 '21 17:03 Damani2

I'm preparing a new release that will allow exporting STEP animation (it will detect this after sampling).

So in the node editor, you can just connect the shape's visibility to the node's scale x,y and z, and then export with the -dsa 2 argument (-detectStepAnimations 2).

I also suggest you reduce the polygon count of your apples :)

ziriax avatar Mar 16 '21 08:03 ziriax

If you want, you can try this release. Feedback is welcome 😃

ziriax avatar Mar 16 '21 09:03 ziriax