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

feature: VRMAnimation #1290

Merged
merged 13 commits into from
Dec 4, 2023
Merged

feature: VRMAnimation #1290

merged 13 commits into from
Dec 4, 2023

Conversation

0b5vr
Copy link
Contributor

@0b5vr 0b5vr commented Sep 15, 2023

Description

Add a new module @pixiv/three-vrm-animation which supports the VRMC_vrm_animation extension (which is still a draft).

The VRMAnimation code already existed for projects like "ChatVRM" or "bvh2vrma", but we updated several interfaces and doc comments for the OSS purpose.

There are two examples in the three-vrm-animation package, loader-plugin.html and dnd.html; the former is slightly easier to understand, while the latter is helpful in checking its behaviors.

APIs

  • @pixiv/types-vrmc-vrm-animation-1.0
    • The type definition of the VRMC_vrm_animation extension.
    • VRMCVRMAnimation represents the extension root of VRMC_vrm_animation.
  • @pixiv/three-vrm-animation
    • A module to load VRM Animation.
    • VRMAnimationLoaderPlugin, a plugin of THREE.GLTFLoader, loads a .vrma binary and creates VRMAnimations.
    • VRMAnimation can be converted to THREE.AnimationClip using createVRMAnimationClip. Since the animation clip depends on the target model's structure, VRM must also be specified.

Points need review

  • APIs. Do you think it looks good?
    • What do you think about the decision that separated createVRMAnimationClip from methods of VRMAnimation? I thought it would be safer to make it loose-coupled
  • Examples. Do you think it's good enough to convey how it should be used?
  • Is it able to build on your end?
  • Repository structure. Is it okay to make three-vrm-animation join this repository? Considering the maintenance cost, I think having it in this repository is better than making a separate repo.

The VRMAnimation code already existed for projects like "ChatVRM" or "bvh2vrma"
We updated several interfaces and doc comments for the OSS purpose

It uses the type package `@pixiv/types-vrmc-vrm-animation-1.0` we've created in the previous commit

There are two examples, `loader-plugin.html` and `dnd.html`; the former is slightly easier to understand while the latter is useful to check its behaviors
Top-level await is not supported natively in eslint v7 :(
https://eslint.vuejs.org/user-guide/#using-eslint-v8-x

also add missing `.editorconfig` and `.eslintrc`
@typescript-eslint/no-unused-vars doesn't consider doc comments
- test job should not call jest since there is no test
- it's dependant of `@pixiv/three-vrm-core`
@0b5vr 0b5vr added the enhancement New feature or request label Sep 15, 2023
@0b5vr 0b5vr added this to the next milestone Sep 15, 2023
@0b5vr 0b5vr self-assigned this Sep 15, 2023
…n `three-vrm-animation` build

add `@rollup/plugin-node-resolve` to rollup config of `three-vrm-animation`
@0b5vr 0b5vr removed this from the next milestone Oct 12, 2023
…lly if the target is not named

This emit a warning also

See: #1290 (comment)
…VRMAnimationExpressionTracks, createVRMAnimationLookAtTrack

- change the name of these functions to tolerate on the exposal of functions
- Change return type of these functions to make end developers able to filter out unnecessary tracks

See: #1290 (comment)
…nslation` for consistency with VRMAnimation
…not defined

There is a case that humanoid does not exist in the animation file when the file only have expressions for example
…model space translation

See: vrm-c/vrm-specification#456

transfer quaternion to VRMLookAt yaw-pitch using VRMLookAtQuaternionProxy (does it look good?)
Comment on lines +19 to +31
// See: https://github.com/mrdoob/three.js/blob/r158/src/core/Object3D.js#L65
const prevRotationOnChangeCallback = this.rotation._onChangeCallback;
this.rotation._onChange(() => {
prevRotationOnChangeCallback();
this._applyToLookAt();
});

const prevQuaternionOnChangeCallback = this.quaternion._onChangeCallback;
this.quaternion._onChange(() => {
prevQuaternionOnChangeCallback();
this._applyToLookAt();
});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@ke456-png ke456-png left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE! 👍

@0b5vr
Copy link
Contributor Author

0b5vr commented Dec 4, 2023

will release the @pixiv/three-vrm-animation as beta version

@0b5vr 0b5vr merged commit 54addfa into dev Dec 4, 2023
6 checks passed
@0b5vr 0b5vr deleted the vrm-animation branch December 4, 2023 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants