Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Samples that demonstrate complex animation interpolation #55

Open
zellski opened this issue Jul 7, 2017 · 12 comments
Open

Samples that demonstrate complex animation interpolation #55

zellski opened this issue Jul 7, 2017 · 12 comments

Comments

@zellski
Copy link

zellski commented Jul 7, 2017

All the skinned 2.0 models have LINEAR interpolation samplers. Wouldn't it be excellent to demonstrate the use of CUBICSPLINE and CATMULLROMSPLINE, for us folks implementing tools and renderers? <3

@pjcozzi
Copy link
Member

pjcozzi commented Jul 10, 2017

@zellski good idea!

@McNopper does the Blender glTF exporter use CUBICSPLINE and CATMULLROMSPLINE at all? Could be an easy way to get a sample for this.

@UX3D-nopper
Copy link

No, as Blender only supports Constant, Linear and Bezier.

As glTF 2.0 does not support Bezier, they are converted to a linear approximation.

@zellski
Copy link
Author

zellski commented Jul 10, 2017

It's admittedly been a couple of decades, but aren't cubic Bezier and cubic Hermite representations interchangeable, with a little bit of mathematics? This is drifting from the original post, though.

In addition to upgrading our use of GLTF on the client to 2.0, I'm also working on updating our FBX to GLTF tool to 2.0. Once I've got it outputting valid data, I'll see if I can dig into all the FBX animation complexity and work out how their stacks and layers work and which FbxAnimCurves might translate to cubic spline. It seems like FBX has much more (and more complex) expressive power and we can probably only convert a small subset of configurations without sampling.

Meanwhile, if anybody else has models to contribute, I'd still be very interested...

@UX3D-nopper
Copy link

As far as I know, the converison result is similar but not the same.
But if u can guide me to the math, I can have a look at it.

@zellski
Copy link
Author

zellski commented Jul 13, 2017

@UX3D-nopper OK, I scribbled a bit and Googled and bit, and it's an extremely simple transformation. If your cubic Bezier parameters are y0, y1, y2 and y3, and you want Hermite cubic parameters p0, m0, p1, m1, then:

p0 = y0
m0 = 3(y1-y0)
p1 = y2
m1 = 3(y3-y2)

Here's a concrete demonstration I hacked together in Desmos:
https://www.desmos.com/calculator/bgaikgwcfh (Bezier)
https://www.desmos.com/calculator/fs66j5b7db (Hermite)

And here's a PDF someone made with a bunch of the math in a very accessible format:
http://www.academia.edu/9781223/Matrix_Form_for_Cubic_B%C3%A9zier_Curves_Converting_Between_Cubic_Spline_Types

@UX3D-nopper
Copy link

Thank you very much for the math. Learned something :-)

Will add it:
KhronosGroup/glTF-Blender-Exporter#40

@UX3D-nopper
Copy link

I will check, how much code needs to be changed but we will probably implement after SIGGRAPH.
See the discussion here:
KhronosGroup/glTF-Blender-Exporter#39
I agree, that this one of the most important future features of the exporter, but before SIGGRAPH, we do not want to break code.

@zellski
Copy link
Author

zellski commented Jul 14, 2017

Totally understood. You're already ahead of the curve. For example, three.js GLTF2Loader can't even cope with these interpolation modes yet. Good luck at SIGGRAPH!

@UX3D-nopper
Copy link

Thank you.
I will not be personally at SIGGRAPH, but a lot of others from the glTF 2.0 working group.
The guys from three.js seem to use the exporter quite intensive, so we try to minimize the changes and focus more on the documentation and tests. Also regarding the feedback we get, other individuals and companies use it quite often as well.
Close before SIGGRAPH, we will tag a version and then the exporter is again a sandbox. E.g. I want the morph targets to use sparse accessors and implement the other listed enhancements.

@UX3D-nopper
Copy link

Okay, started with it:
KhronosGroup/glTF-Blender-Exporter@3180b08

Sample files can be found here:
https://github.com/KhronosGroup/glTF-Blender-Exporter/tree/master/scenes
01_cs_*.blend

You need Blender 2.79 RC for the files.

@prideout
Copy link

Also note that InterpolationTest.gltf in the conformance suite exercises CUBICSPLINE, but does not animate morph weights. I think it would be good to animate morph weights since the memory layout for animated morph weights is not obvious.

@DRx3D
Copy link
Contributor

DRx3D commented Oct 27, 2023

There has been no activity in over 3 years. It appears that there is still an open discussion. This can be moved to the new glTF-Sample-Assets repo if further discussion or consideration is desired. That is the default disposition for this issue.

@DRx3D DRx3D transferred this issue from KhronosGroup/glTF-Sample-Models Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants