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

[bug + fix idea] VrmSpringbone.cs The higher the fps, the more "weird bounces" it does, found a possible fix that may improve performance. #425

Closed
Csf91 opened this issue Jun 7, 2020 · 1 comment

Comments

@Csf91
Copy link

Csf91 commented Jun 7, 2020

Using Unity 2019.3.15f1

The issue and fix found are for this file:
https://github.com/vrm-c/UniVRM/blob/master/Assets/VRM/UniVRM/Scripts/SpringBone/VRMSpringBone.cs

Line 284 produces weird physics the higher the fps are:
void LateUpdate()

instead smooths the dynamic bones calculations, and stops the glitch for a more smooth movement, and i believe performance upgrade as well. (my project is a small one for now and the performance change goes unnoticed, but with multiple animated or moving characters in scene i believe would be far more noticeable in performance):
void FixedUpdate()

To Reproduce

Steps to reproduce the behavior:

  1. Requirements a .VRM model with hair and/or boob springbones.

  2. Go to your project in unity (preferably an empty/new one) and import a VRM model using the UniVRM tool.

  3. Set up your model like always and add the default standard assets (3rd person controller).
    2.1. Add a plane or terrain to your scene and the 3rd person controller from standard assets.

  4. Swap unity's default model (Ethan) for your VRM model/character prefab.

  5. On the 'Animator' component of the ''3rd person controller' swap default 'Avatar' for your 'VrmAvatar'.

  6. Run the scene and if your character was imported properly you can run, jump and walk using the default unity animations, and test the physics.

  7. Now, on the editor you will NOT notice it as much, so if everything runs okay i 100% recommend you to make a build, save it to your preferred folder, and run it. (remember the more the FPS, the easier it is to notice, but even if around 30FPS you WILL, 100%).

  8. Now edit that script mentioned above (VRMSpringBone.cs) and change the 'LateUpdate' for 'FixedUpdate'.

  9. Play the scene in the editor to check that it runs properly and build again to a different folder, so you have both builds to test. Close the unity editor now to improve fps if needed.

  10. Play the first build around, change direction, walk, jump and take a good look at the physics behaviour specially above 30fps. (first one is the build with the default script).

  11. Play the 2nd build with the 'FixedUpdate' instead of the 'LateUpdate'. You will now notice if >30FPS, below that happens but not as much.

Screenshots
Since screenshots will not work for showing this i'll try recording a video ASAP(sorry, some things that needed my attention first happen, i promise to update it with a video like originally said).

Environments (please complete the following information):

  • OS: Windows 10 Pro, x64, v1909
  • UniVRM version: 0.55.0

Additional context
-The higher the fps, the more noticable it is, it reminds me of when you put 2 rigidbodies together i.e a moving platform and the one resting on top kind of bounces instead of going smooth as it should.

-I've tried adding stiffness to the VRMSpringbones and while in average is less noticable (because of less movement), when the random bounce happens it's even more noticeable, so play with your settings a bit for specific parts, i guarantee you will notice it, and on the video i'll include my settings once i do it as well.

PS: It MAY sound like it does a small change but i really noticed a good improvement, also i'm new to GitHub even tho i did my account long ago, so please forgive any post or overall mistakes that i could've done. Thank you :)

@Csf91 Csf91 changed the title [bug + fix idea] VrmSpringbone.cs The higher the fps, the more "wird bounces" it does found a fix and i think it's working fine for me. [bug + fix idea] VrmSpringbone.cs The higher the fps, the more "weird bounces" it does found a fix and i think it's working fine for me. Jun 7, 2020
@Csf91 Csf91 changed the title [bug + fix idea] VrmSpringbone.cs The higher the fps, the more "weird bounces" it does found a fix and i think it's working fine for me. [bug + fix idea] VrmSpringbone.cs The higher the fps, the more "weird bounces" it does, found a possible fix thar may improve performance. Jun 7, 2020
@Csf91 Csf91 changed the title [bug + fix idea] VrmSpringbone.cs The higher the fps, the more "weird bounces" it does, found a possible fix thar may improve performance. [bug + fix idea] VrmSpringbone.cs The higher the fps, the more "weird bounces" it does, found a possible fix that may improve performance. Jun 7, 2020
@hiroj
Copy link
Contributor

hiroj commented Jun 22, 2020

From v0.56, Late Update and Fixed Update can be selected. The application should make the appropriate settings after loading the VRM.

@hiroj hiroj closed this as completed Jun 22, 2020
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