godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.08k stars 69 forks source link

Solve generalized skeleton poses with Many Bone IK #6039

Open fire opened 1 year ago

fire commented 1 year ago

Describe the project you are working on

A open source social vr game made with Godot Engine.

We wish to provide full body tracking with 3 body sensors and the ground or up and more than 10 body sensors.

We also want to solve for any other skeleton. Example skeletons like quadrupeds, birds, squid or octopus.

Describe the problem or limitation you are having in your project

Godot Engine 4's multiple ik systems are broken.

https://twitter.com/wojtekpil/status/1609667214998650883?s=20

Provide a general purpose full body inverse kinematic system that is suitable for full body tracking and in general.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Many Bone IK is a custom inverse kinematics system solver for multi-chain skeletons and with constraints.

This project is a port from a Java project by Eron https://github.com/EGjoni/Everything-Will-Be-IK

See here for the EWBIK demo

GitHub usernames are indicated in parentheses.

Additonal features

Many Bone IK has a use for animation retargeting.

Many Bone IK can implement a "look-at" in a way that can take the entire rest of the character into account.

Authors

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

DRAFT PROPOSAL as of 2022-01-03. Want a demostration video at some time.

EWBIK A Highly General, Fast, Constrainable, and Stable Inverse Kinematics algorithm.odt

image

image

See open office document.

Abstract

  1. provided IK COPY targets per bone via "QCP" solver
  2. provided KUSUDAMA IK LIMIT forward axial rotation per bone with vector3 and a angle
  3. provided KUSUDAMA IK LIMIT spherical (360) rotation per bone via 0 to 10 limit cones
  4. provided root motion solving
  5. included stabilization passes
  6. provided prioritization of rotation axes
  7. provided joint weights
  8. Per bone dampening
  9. provided spherical KUSUDAMA IK LIMIT shader visualization
  10. provided axial KUSUDAMA IK LIMIT visualization
  11. Avoids the modification stack problem mentioned in earlier pull requests in July. ManyBoneIK is a node3d.
  12. Allows arbitrary number of iterations per frame
  13. Provides a constraint mode than allows editing of constraints without the solve struggling
  14. Provides a filterable inspector with a bone tree.

Unfinished work

  1. Provide a better way to edit the twist constraint, orientiation constraint and the bone direction transforms while also resetting the solver representation BLOCKER
  2. provide a better ui for defining 360 spherical rotation like drilling from a sphere center point (vector3) and then adding a radius (euler angles)
  3. provide a pallete of presets for common humanoid joints
  4. provide draggable handles for spherical KUSUDAMA LIMIT similar to the spotlight3d set to a distance of 1 scaled by the bone length
  5. draggable handles for the axial limits
  6. the ui is too complicated needs ui work
  7. film an demonstration video
  8. Make ManyBoneIK a node? (trouble with gizmos.)
  9. Finish the demo https://github.com/V-Sekai-fire/TEST_many_bone_ik

If this enhancement will not be used often, can it be worked around with a few lines of script?

Technically speaking, the IK system only took a few months to develop. Most of the work has been in porting it.

Is there a reason why this should be core and not an add-on in the asset library?

Reduz asked me to write a proposal because I had working code for this in a c++ module at https://github.com/V-Sekai/many_bone_ik

ywmaa commented 9 months ago

I was going to open a whole issue with details for IK system, but this does it all.

Now as I understand this uses a Node approach which I think is perfect for Godot Engine.

About this point :

the ui is too complicated needs ui work

I don't think so, from the screenshots it looks pretty much clear, and familiar with the Bone Hierarchy, looks like Skeleton3D, maybe just adapt the UI to look exactly like it.

It just needs 3D handles for usability.

Make ManyBoneIK a node? (trouble with gizmos.)

Wait isn't it a Node already ?

Edit : Any Idea about the performance of many bone IK ?

fire commented 3 months ago

The https://github.com/godotengine/godot/pull/87888 enhancement improved the ik solver's stability so we're not stuck.