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

2D blend space node, animation graph debugging tools #78

Merged
merged 12 commits into from
Feb 11, 2025

Conversation

mbrea-c
Copy link
Owner

@mbrea-c mbrea-c commented Jan 27, 2025

This PR adds a couple of things:

  • A 2D blend space node in the style of Godot's AnimationNodeBlendSpace2D. Inputs to this node are mapped to a 2D plane and triangulated. At runtime, a Vec2 parameter is passed in, and the output pose is the linear combination of the poses mapped to the vertices of the triangle that the input vector is contained in. If the input vector is outside all triangles, it is projected to the closest one.

    You may note that there is no such thing as a "linear combination of quaternions". Instead we treat them as a Vec4, compute the linear combination of the vectors and re-normalize the quaternions. This usually works reasonably well (see Gramkow 2001), is independent of the order of the quaternions and is reasonably fast. The main issue I've found with this is that, while quaternions q and -q may represent the same rotation, when converted to a vector they are quite different and mixing in some "negated" quaternions can result in nonsensical output animations. I'll need to do more research on if/how we should solve this.

  • Some debugging tools for animation graphs in the editor. This wasn't really in the original plan for the PR, but I found myself needing better tools to debug issues with the blend space node. In particular, you can now:

    • Play/pause/step frame by frame the active animated scene preview.
    • Inspect the node outputs of each node in the graph, including rendering a preview of a pose output. When combined with frame stepping, this was quite useful to me.
  • Scene and pose previews can now be rotated and zoomed in/out with the mouse.

@mbrea-c mbrea-c changed the title feat: add a blend space node to blend between multiple animations 2D blend space node Jan 27, 2025
@mbrea-c mbrea-c marked this pull request as ready for review February 11, 2025 23:39
@mbrea-c mbrea-c changed the title 2D blend space node 2D blend space node, animation graph debugging tools Feb 11, 2025
@mbrea-c mbrea-c merged commit d2674d9 into master Feb 11, 2025
3 checks passed
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

Successfully merging this pull request may close these issues.

1 participant