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

Animation Import for RealityKit #30

Open
kaustubh-seachange opened this issue Aug 25, 2023 · 7 comments
Open

Animation Import for RealityKit #30

kaustubh-seachange opened this issue Aug 25, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@kaustubh-seachange
Copy link

Is there any timeline to implement the animation in RealityKit version of project

@warrenm
Copy link
Owner

warrenm commented Aug 25, 2023

There is currently no timeline for animation import for RealityKit, and it's unlikely to happen this year without external support.

@warrenm warrenm changed the title Animation Animation Import for RealityKit Aug 25, 2023
@warrenm
Copy link
Owner

warrenm commented Sep 14, 2023

The chief impediment to implementing this feature is RealityKit's lack of support for keyframed animations with arbitrary time values. RealityKit's SampledAnimation type insists on using a shared frame interval for all keyframes, so to import glTF animations into the system, we either need to resample (expensive and error-prone) or come up with a workaround, such as reimagining glTF keyframe animations as sequences of from-to-by animations (expensive and problematic in other ways).

@warrenm warrenm added the enhancement New feature or request label Jan 12, 2024
@issacclee
Copy link

issacclee commented Apr 26, 2024

One way to look at it is to maybe delegate the obligation of "Resampling GLTF animation data" to whatever gltf exporter the user were using. Someday it might just become a standard option on those exporters to export a "flavor" of gltf specifically for using gltf in Realitykit.
For this project, we could just go ahead and implement based on the existing restrain of Realitykit's SampledAnimation data class. Maybe throw an error when the importing gltf file does not share the same time frame interval across its animation channels.

@warrenm
Copy link
Owner

warrenm commented Apr 27, 2024

I'm not interested in implementing half-measures that I know won't work with a significant number of existing assets. The practical outcome of your suggestion would be that people would assume animation support for RealityKit "just works," and then complain when it breaks.

Any user of the framework is, of course, welcome to implement whatever hacks they want to in their own forks and clones.

@giln
Copy link

giln commented May 1, 2024

Aren't animationResources in RealityKit a sequence of fromToByAnimations ?
Why would it be problematic?

@warrenm
Copy link
Owner

warrenm commented May 1, 2024

It is possible to generate an AnimationResource from a sequence of animation resources generated from FromToByAnimations, sure. This approach has at least two issues:

  1. As far as I can tell, it is not possible to construct a BindTarget that targets a single component of a Transform, such as its rotation, while preserving the existing scale and translation. It's perfectly valid in glTF to have an animation only affect one part of the transform, but if we just blindly use from-to animations that target the transform, we lose information and probably corrupt a small percentage of animations in the wild.

  2. AnimationTimingFunction isn't expressive enough to implement the cubic spline interpolation mode, so we'd either need to approximate it or fall back on resampling.

@giln
Copy link

giln commented May 1, 2024

Ok, thank you for the detailed answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants