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

MotionMatchingDiscussionJul2023 #11

Open
5 tasks
GeorgeS2019 opened this issue Jul 19, 2023 · 0 comments
Open
5 tasks

MotionMatchingDiscussionJul2023 #11

GeorgeS2019 opened this issue Jul 19, 2023 · 0 comments

Comments

@GeorgeS2019
Copy link
Owner

GeorgeS2019 commented Jul 19, 2023

  • Demo or any explanation on how to setup it up.
  • Animations with root motion ( you have to provide them yourself.)
  • Character.
  • Inertialization or any method to blend the current animation to the result of the motionmatcher query.
  • Get the plugin working by docking the bottom Panel with MOCKUP data
    image
==================================================

Daniel Holden motion matching is being implemented in Unity3D and I think it may be prudent for us to with another perspective from another Game Engine e.g. Unity3D and then re-examine how best to do that in Godot.

The Original 2019 Godot Motion Matching UI was designed and implemented by Juan Linietsky @reduz

The key question is scalability of @Remi123 Godot4 Motion Matching solution by being flexible in incorporating new Motion by e.g. importing new BVH files.

Pre-processing to store

Pose => Motion Data

Features => Motion Features

image

image

@CBerry22

On behalf of many of us who care about the Godot community, I wonder if you could apply your experience with physics-based active ragdoll to motion matching

There are similarities between them

  • Motion Matching

Inertialization or any method to blend the current animation to the result of the motionmatcher query.

  • Active ragdoll

Some sort of blend to adjust the physic-based character to the result of query from the provided animation

To learn about Motion Matching

(provided by Readme)

Introduction video
O3DE implementation blog
Daniel Holden aka OrangeDuck's blog
Spring algorithm and controller
Motion Matching implementation
Fitting Motion with Animation

Discussion and elaboration provided by @Remi123

This project has scalability as one of its core foundation. Since many users will try to use it with very different quality of animation, from professional post-processed motion-captured animations to Mixamo animations to their own animations of varying quality, the system must be robust, easy to debug and easy to fix.

Nomenclature:

  • Features : Extract information, most of them time in the model local space relative to the root bone. Example include current velocity, bone positions and velocities, and trajectory point at x point in the future. Each features has a dimension size required for serializing the data. The sum of all the features dimensions is named K, because we will use a KDTree
  • Serialization : In MM term, we populate all the features information into an 1D array of size K.
  • Baking : The act of looking at each animations and extracting the features information at time T and adding those information to the KDTree.

Some comments about my project and some possibilities it allows.

  1. Animation Re-targeting make importing BVH, FBX and GLTF animation a non-issues for this project. My own project use a mix of motion captured and mixamo animations without trouble.
  2. Debugging is important. Each features is able to show on gizmo ( only in the editor for the moment) showing lines or meshes to show velocity, bone position, etc.
  3. The Kdtree implementation that we choose has three distinct advantages over using other methods : Weight, void* Data and a Predicate,
    • Weight allows to specify the importance of different features over others. The trajectory is usually the most important in locomotion.
    • Void* data allows me to reference some data at each node. I use it to store a bitfield representing the category ( Walk, run, etc)
    • Predicate allows to filter results. I use it for the categories, but I also have ideas in the editor.

What this project aims is to provide multiple type of features, ones more adapted for typical locomotion that are continuously updated, others would be better for Melee Combat similar to For Honor, or other better used for Parkour. Each would be hosted by it's own kdtree and the user can select which one are active by code. This is what we define as scalability in this project.

This project is still a WIP and as such some features were implemented as a prototype for now.

Additional background

Implement Motion Matching

Other FYI

Retool AnimationTree parameter system to use a blackboard-based approach

==================================================

@maximkulkin

With respect to your feedback on e.g. AnimationBlendTree node with parameters, I think this project needs to address this possibility too. value your input if you have time.

@SaracenOne

Retool AnimationTree parameter system to use a blackboard-based approach

In this project, we are also facing how to deal with AinmationTree parameter system to a blackboard that returns a motion-matched query. Value your feedback

@GeorgeS2019 @CBerry22 @maximkulkin @SaracenOne

I can share my inputs on each subject.

AnimationTree
My plugin is outside AnimationTree for now, it's only a node that find the best poses and output the name and timestamp of the animation that best match it. For example, "WalkForward" at time 0.4. This is all my plugin output, but I do it every 0.2 seconds.

Once this is known I need to blend to the desired pose. I have a simple setup in the animationtree that blend between two poses, but basically all I need is a node that blend between the current pose, and the poses at my desired animation timestamp.

I value the fact that my setup is technically just a slightly more complex AnimationNode, as the user can use all the things that AnimationTree is able to output.

Inertialization vs active ragdoll.
I remembered that he had a Youtube channel, and looked back at the active ragdoll at this link. Quite frankly I'm impressed and I think it's possible to implement the blending using active ragdoll, but I have some reservation.

Issues 1
First of all, he is using two skeletons, one physical using PhysicalBone3D and the other that is playing the animation. The physical skeleton is trying to match the position of the equivalent bone in the normal rig using some spring calculation. It is indeed very similar to inertialization which is also derived from springs, although the calculation isn't the same but for this discussion it's similar enough.

With my plugin, the animated rig would simply go to the desired poses, wait 0.X seconds that is configurable, and continue playing the rest of the animation and the physical bones would simply catch up with the rest of the animation.

I'll try to make it so that there is only one skeleton, but I have to test it if is possible.

Issues 2
For my purpose, it is still a workaround a proper node that blend realistically between poses very often. My setup that switch between the current and desired poses would just be replaced by an active ragdoll setup that still needs maintenance, but now with double the skeletons.

Inertialization
I've discussed with Tokage about a solution to the inertialization. In essence, the real problem that I have to workaround is that I cannot create an AnimationNode that manipulate the Skeleton3D directly. The animationtree has it's own structure to represent a blend of all the nodes and I want to keep it that way.

My current solution would be to have a node similar to an AnimationNode, and once it receive the signal to switch to a desired pose, create a temporary animation with the current bones positions and rotations. I then smoothly transitions to the desired pose by manipulating the animations tracks's key values instead of the skeleton bones positions. The animationTree only see an Animation and I'm free to manipulate the values however I see fit. Once the transition is done I simply remove the temporary animation and play the desired one.

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

1 participant