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

Migrate to Spring Bone Modifier #119

Open
fire opened this issue Jan 6, 2025 · 20 comments
Open

Migrate to Spring Bone Modifier #119

fire opened this issue Jan 6, 2025 · 20 comments

Comments

@fire
Copy link
Member

fire commented Jan 6, 2025

@fire fire changed the title Use Tokage's Spring Bone Modifier (Work in progress) Migrate to Spring Bone Modifier Jan 6, 2025
@TokageItLab TokageItLab changed the title Migrate to Spring Bone Modifier [wip] Migrate to Spring Bone Modifier Jan 6, 2025
@TokageItLab TokageItLab changed the title [wip] Migrate to Spring Bone Modifier Migrate to Spring Bone Modifier Jan 11, 2025
@TokageItLab
Copy link
Member

godotengine/godot#101409

@TokageItLab
Copy link
Member

TokageItLab commented Jan 12, 2025

Note for importing/exporting VRM

VRM -> Godot

Joints

The first and last bones of the bone array in the VRM will be set as root_bone and end_bone in SpringBoneSimulator.

After the two bones are set, a static array is generated by SpringBoneSimulator, and the physics parameters must then be applied to each element in the SpringBoneSimulator array. At this time, the indivisual_config option in SpringBoneSimulator must be enabled in order to edit the elements directly.

For VRM0, the extend_end_bone option must be enabled and extended by 0.07m.

Collisions

Disable are_all_child_collisions_enabled to use the allow list.


Godot -> VRM

Joints

Just export each element in the static array as is.

If the extend_end_bone option is enabled, you need to add the bone as entitie to the skeleton structure of the glTF.

The rotation_axis option is currently not supported by VRM, so it is discarded.

Collisions

If are_all_child_collisions_enabled is disabled, it just exports the collision list.

If are_all_child_collisions_enabled is enabled, it should export a list of all child collisions, filtered by the exclusion list.

In both cases, if no bone is assigned to the child collision, it is discarded since it is not following the VRM specification.

@fire
Copy link
Member Author

fire commented Jan 12, 2025

Comment seems to have been removed.

Edited:

Use the comment as the name of the node.

@fire
Copy link
Member Author

fire commented Jan 12, 2025

spring_bone.center_node does not exist.

@fire
Copy link
Member Author

fire commented Jan 12, 2025

There is an update error. If I set the bone root and the bone end by code it doesn't create the gizmos or move.

# works
spring_bone.set_root_bone(chain_i, root_bone)
spring_bone.set_end_bone(chain_i, end_bone)

The set_root_bone_name and set_end_bone_name variation doesn't work in code.

@TokageItLab
Copy link
Member

TokageItLab commented Jan 12, 2025

Isn’t center must be bone as VRM spec? SpringBoneSimulator allows you to set center bone per bone chain.

@fire
Copy link
Member Author

fire commented Jan 12, 2025

@TokageItLab Do you think we should allow a comment property per chain in SpringBoneSimulator3D
?

@fire
Copy link
Member Author

fire commented Jan 12, 2025

From Tokage:

I think capsule needs to be offset in the y direction because head is not the origin.

@fire
Copy link
Member Author

fire commented Jan 12, 2025

There are at least two three vrm girl avatar files.

We are not matching Blender vrm0 vs Godot

image

editor_screenshot_2025-01-12T101700

@TokageItLab
Copy link
Member

@fire The colliders looks like lacking offset from bone.

@fire
Copy link
Member Author

fire commented Jan 12, 2025

Progress.

editor_screenshot_2025-01-12T105006

@fire
Copy link
Member Author

fire commented Jan 12, 2025

When in motion the colliders are going the wrong way.

image

@fire
Copy link
Member Author

fire commented Jan 12, 2025

Test Error with animations not moving the colliders.

https://youtu.be/l1UA5wkaToY

V-Sekai-fire/godot-vrm-motion-checker@9bb9fa1

@fire
Copy link
Member Author

fire commented Jan 13, 2025

Performance problem. The playback goes slower and slower.

https://www.youtube.com/watch?v=0XLIFrK3SSQ

V-Sekai-fire/godot-vrm-motion-checker@d447494

@TokageItLab
Copy link
Member

The playback goes slower and slower.

Maybe not related with SpringBoneSimulator, so we separate issue as godotengine/godot#101474

@TokageItLab
Copy link
Member

I forgot to mention, when exporting, be sure to check that the same bone is not contained in more than one setting. This is not a problem in SpringBoneSimulator because the update order is guaranteed on Godot, but the VRM format does not allow it.

@fire
Copy link
Member Author

fire commented Jan 17, 2025

What happens when the same bone is contained in more than one setting? Like how do we do when this happens?

@TokageItLab
Copy link
Member

TokageItLab commented Jan 17, 2025

It only treats a transformation of the previous SkeletonModifier or previous setting like an FK animation. The result is a little larger movement, but nothing that will collapse. I don't know in external environments, such as UniVRM.

I think it would be fine to perform some kind of validation before exporting VRM and then suggest to the user to fix the problem with a popup or something.

@fire
Copy link
Member Author

fire commented Jan 18, 2025

The user is not expected to fix the problem manually, as it is not easy to repair many errors. I prefer a node tree warning; the user can export VRM anyway.

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

2 participants