godotengine / godot-proposals

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

Add 3D spring bone support for character hair physics simulation #8374

Open D3ZAX opened 8 months ago

D3ZAX commented 8 months ago

Describe the project you are working on

A 3D space action game with characters using toon shader like Guilty Gear

Describe the problem or limitation you are having in your project

For long hair characters, when they running, their hair need physics simulation to be more lively. PhysicsBone3D and other physics related node for 3D can't implement this effect naturely. If make hair swing effect in animations, it need a lot of work to not look mechanically.

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

Add spring bone effect node make a bone in Skeleton3D node can simulate hair swing, that make games looking good, and save time to adjust character animation.

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

User can add SpringBone3D node, select the Skeleton3D node and bone to use spring bone, physics simulation will take effect. When the Skeleton3D node moving, the bone will just act like swing spring.

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

Yes, but not so onvenient.

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

It's commonly used for simulate long hair characters and for other jiggle thing similar to soft body, this should be a standard feather for a good game engine.

AThousandShips commented 8 months ago

Please add some more details, this:

For long hair characters, when they running, their hair need physics simulation to be more lively.

Add spring bone effect can simulate hair swing, that make games looking good.

Doesn't quite describe the problem, like how the current system isn't enough, and what is needed more specifically, like what things it is supposed to do

Zireael07 commented 8 months ago

@AThousandShips There is NO current system for this...

AThousandShips commented 8 months ago

There is NO current system for this...

There is no dedicated system for this, which is why I am asking for details on how this would improve things and why the current physics systems aren't enough

This is what proposals need to contain, that's the process, so please don't treat asking for that as something unreasonable...

lyuma commented 8 months ago

Some questions of note:

  1. During the development of Godot 4.0, we started to consider this style of skeleton-affecting node to be deprecated since we want to make a more dedicated animation system for IK style nodes, which at the time was called SkeletonModification3D but we opted to cut from the release due to bugs and such. If we decide that this type of node is useful, we should perhaps reverse our decision to deprecate SkeletonIK3D. Just saying that logically speaking these two systems ought to take similar approaches.

  2. This feature implements a small subset of the properties used in multiple springbone systems in the wild. Is the idea that this should be an extremely barebones implementation that is extensible? If so, would it make sense to have a base class which offers no functionality and then have a single example implementation like what is in the PR?

  3. Alternatively, should we make this a more maximal feature integrated that derives functionality from several different springbone systems (including kusudama style or axis constraints, per-bone properties, multiple types of force/gravity and many more).

I think it would be nice for Godot's implementation to at a minimum cover the functionality in https://github.com/vrm-c/vrm-specification/tree/master/specification/VRMC_springBone-1.0

lyuma commented 8 months ago

Responding to @AThousandShips' questions, the proposal is written from the perspective of animation and missing some of the context, but there is a reason for this being a non-physics related proposal.

the current system

The previous SkeletonModification3DJiggle was actually removed during the development of Godot 4.0 beta, so there is no current system right now See previous proposals:

why the current physics systems aren't enough

Physics is considered too heavyweight for what is generally considered to be part of individual character animation. Whereas a character in a game generally has one physics node (the capsule collider), a hair and garment system with spring bone animation may have upwards of 1000. Furthermore, in many games (especially competitive or network synced game) you would not necessarily want a character's hair or style of clothing to impact gameplay.

AThousandShips commented 8 months ago

Then that exactly was what should have been in the proposal to clarify what it is and what it isn't, you can understand my confusion given the lacking information in the proposal

Especially when the title literally says physics 🙃

fire commented 8 months ago

The SpringBone3D node is a versatile tool in 3D character animation, capable of simulating various types of motion. Here are some potential applications:

Applications

1. Clothing Simulation

The SpringBone3D node can be used to simulate the movement of clothing on a character. For instance, it could be employed to make a character's coat flap as they run.

2. Body Motion Enhancement

The SpringBone3D node can also add more realism to a character's body motion. It could be used to simulate the bounce of a character's muscles or fat as they move.

3. Hair Animation

One of the most common uses for spring bones is to simulate hair. The SpringBone3D node could be used to make a character's hair sway as they move their head or as wind blows through it.

Implementation Strategies

The SpringBone3D node can be implemented using various strategies, each with its own advantages and considerations. Here are two potential approaches:

1. Extensible Barebones Implementation

Starting with a barebones implementation that is extensible makes sense. A base class offering no functionality but providing a framework for extensions, like the example in the PR, could be a good starting point. This allows for flexibility and customization based on specific needs.

2. Maximal Feature Integration

Alternatively, integrating functionality from various springbone systems could provide a more comprehensive solution. However, this should be balanced against potential complexity. It would be beneficial if Godot's implementation at least covers the functionality in VRMC_springBone-1.0.

There are more advanced features like multi limit cone constraints for bones (Kusudamas).

lyuma commented 8 months ago

Aside from the more high level design points listed in the AI summary, one of the specific concerns I have with the implementation (note the use of singular "bone" in the proposal) is that I think this should apply to a whole bone chain, at a minimum (the tail bone / offset could end the recursion at that bone and add all bones in between)

Godot has a bit higher per-node complexity, and a single character might have dozens of bone chains for hair nodes, so that might potentially be a lot of nodes needed just to animate hair or a single garment... Permitting multiple bone chains to be animated from one node might also be useful.

JekSun97 commented 2 months ago

I just can’t switch to a large 3D project, due to the lack of physics for clothes and hair (and terrain), we need this!

lyuma commented 2 months ago

There is a GDScript implementation of spring bone as part of the vrm asset: https://github.com/V-Sekai/godot-vrm My hope is that this will become an official feature for Godot, but we do not have time to finish this in time for Godot 4.3, so you will have to make do with an addon.

Godot 4.3 just got a new "skeleton modifier" system which will make these sorts of nodes easier to write. It is likely that we will be able to build a nice spring bone node in time for Godot 4.4

JekSun97 commented 2 months ago

There is a GDScript implementation of spring bone as part of the vrm asset: https://github.com/V-Sekai/godot-vrm My hope is that this will become an official feature for Godot, but we do not have time to finish this in time for Godot 4.3, so you will have to make do with an addon.

Godot 4.3 just got a new "skeleton modifier" system which will make these sorts of nodes easier to write. It is likely that we will be able to build a nice spring bone node in time for Godot 4.4

There is also this: https://github.com/detomon/wigglebone, if you play with the settings you can get something similar to fabric