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

Enable jiggly bone chains that work with colliders by using existing work in Godot-VRM #5605

Open
sebastianrueckerai opened this issue Oct 17, 2022 · 2 comments

Comments

@sebastianrueckerai
Copy link

sebastianrueckerai commented Oct 17, 2022

Describe the project you are working on

A 3rd person 3D RPG (like the modern Zelda games or dark souls).
In the game mid-poly characters with clothing, hair and - in case of monsters - tails & tentacles move around in a 3D world.

Describe the problem or limitation you are having in your project

I have no good way of making bone chains jiggle and not have them intersect with other geometry.
A good example is a long pony tail: It may be rigged by a bone chain and should use IK.

  • Multiple bones should move in unison driven by physics when the character moves to make the pony tail bob and swing
  • The pony tail should not intersect with the rest of the model and ideally not intersect with other geometry. A a jiggle bone system should have the option to add a set of colliders which it uses to avoid intersecting with other meshes.

This project does some of what I need but does not support bone chains and does not support colliders to avoid intersecting with other meshes:
https://github.com/Bauxitedev/godot-jigglebones/blob/master/README.md

This proposal might be related: #5429 but it does not talk about the intersecting issue.

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

Godot-VRM already implements the feature I am describing: https://github.com/V-Sekai/godot-vrm

However, the core purpose of Godot-VRM is not jiggly bones but making VR avatars. If one wants to use it just for the jiggly bones it means converting ones 3D models to the special avatar VRM format. This is not only inconvenient, it also means non-human rigs will not work.

So my proposal would be to modularize the part of Godot-VRM which is responsible for the jiggly bones and making it part of core or at least making it into its own Independent plugin.

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

A good project to copy might be the unity tool "dynamic bone": https://assetstore.unity.com/packages/tools/animation/dynamic-bone-16743

How it can work:

  • We introduce a jiggly bone node which can be added to a leaf bone in a rig / skeleton
  • A jiggly bone can only be added to a "leaf" bone. So the bone this attribute is added to can not have children.
  • The jiggly bone node allows the user to define a chain length. This will determine how many bones in the chain are affected by physics (compare to how blender does IK chains).
  • The jiggly bone node should expose parameters to tune the amount of jiggle (dampen it or enhance it)
  • Optionally, it would be nice to have an influence of the node. This way bones could be partially driven by animation and partially driven by physics. Example: An influence of .5 would mean that a bones position is determined 50% by physics and 50% by the current animation.

There are probably other ways of defining bone chains (giving start and end bones or a compete list of affected bones instead of chain length).

Performance may be an issue since Godot-VRM is meant to drive one avatar, not potentially many game characters at once. However: Being able to have jiggly physics on one or two characters is preferable to having it on none! Also, once a nice interface to use this feature exists, optimizations can still be performed. This way we would have an immediate use case before diving into optimization.

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

No. Any solution requires a lot of performance intensive physics code that interacts with Godots bone system.

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

Skeletal animations are a core feature and dynamic bones are closely linked to how the skeletal system is done. So to my mind it would make sense to have this feature in core.
Ocarina of Time had cloth physics in 1998 https://www.youtube.com/watch?v=CQBRZ8xUomE.
Basically any 3D game that shoots for more realism than early 2000s-level will need something like this - be it for hair, cloth breasts, ropes of tails. So having this feature in core would make it possible for a huge group of developers to develop a previously impossible range of games.

On a personal note: I don't ever want to go back to unity, but someone coming from unity and being used to this feature will have a tough time coming over to Godot. Making this easy for them would greatly extend the value of Godot.

@nathanfranke
Copy link
Contributor

I haven't checked for duplicates, but the feature proposed is very realistic for games made today, whether VR or not. While Godot probably won't officially adopt a third party solution, it is good to have an official proposal for community members to share their creations.

@TokageItLab
Copy link
Member

TokageItLab commented Oct 17, 2022

I think VRM SpringBone and VRM Constraint can be packaged into future Godot-VRM as extended SkeletonModificationStack. This would allow us to ignore other unnecessary modules in Godot-VRM and just use their SkeletonModificationStack.

So I guess what we need to do as a first step now is to refactor the SkeletonModificationStack in godotengine/godot#63588. After that, we can discuss again about what is lacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants