# Loading VRM Humanoid-based model

**URL:** <https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980>\
**Category:** Demos and projects\
**Created:** [August 8, 2019, 4:58am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980 "2019-08-08T04:58:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![il-m-yamagishi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/il-m-yamagishi/32/2378_2.png) [@il-m-yamagishi](https://forum.babylonjs.com/u/il-m-yamagishi)\
**Post date:** [August 8, 2019, 4:58am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/1 "2019-08-08T04:58:43Z")

</div>

> “VRM” is **a file format for handling 3D humanoid avatar (3D model) data for VR applications**. It is based on glTF 2.0. Anyone is free to use it. In addition, a standard implementation ([UniVRM](https://github.com/vrm-c/UniVRM)) in c# that can import and export VRM file in [Unity](https://unity3d.com/) is released as open source.  
> by [VRM.dev](https://vrm.dev/en/)

I’d just created UniVRM to TypeScript porting for babylon.js the amazing WebGL library!

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/4/49dd82f559bed150dd7f841a8e5353aac6b01339.jpeg)

Anyone can use [babylon-vrm-loader](https://badge.fury.io/js/babylon-vrm-loader) npm package.

```js
import * as BABYLON from '@babylonjs/core'

// this importing has side-effect
// ref. https://webpack.js.org/guides/tree-shaking#mark-the-file-as-side-effect-free
import 'babylon-vrm-loader'

// ... init and create Engine and Scene

// vrmFile is File object retrieved by <input type="file">.
// or you can use url too.
const scene = await BABYLON.SceneLoader.LoadAsync('file:', vrmFile, engine);
const vrmManager = scene.metadata.vrmManagers[0];

// Update secondary animation(Spring Bones)
scene.onBeforeRenderObservable.add(() => {
    vrmManager.update(scene.getEngine().getDeltaTime());
});

// Model Transformation
vrmManager.rootMesh.translate(new BABYLON.Vector3(1, 0, 0), 1);

// Work with HumanoidBone
vrmManager.humanoidBone.leftUpperArm.addRotation(0, 1, 0);

// Work with BlendShape(MorphTarget)
vrmManager.morphing('Joy', 1.0);

```

Codepen example is [here(you need VRM model file)](https://codepen.io/anon/pen/zQXyxL?editors=1010).

Also you can see example [here](https://virtual-cast.github.io/babylon-vrm-loader/) with sample model “Alicia Solid”.

Feel free to use and contribution! [virtual-cast/babylon-vrm-loader : GitHub](https://github.com/virtual-cast/babylon-vrm-loader)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 8, 2019, 8:02am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/2 "2019-08-08T08:02:07Z")

</div>

This is amazing !!! I think this would deserve an entry in the documentation so that ppl looking for loaders could find your great work.

I bet on @Deltakosh being pretty happy with that too.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [August 8, 2019, 3:05pm UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/3 "2019-08-08T15:05:40Z")

</div>

You rock!!! would you be ok to add a page for it in our documentation so people can easily find it? (with link to your demo)

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [August 8, 2019, 6:13pm UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/4 "2019-08-08T18:13:16Z")

</div>

This is very nice! I’m glad you are using the glTF loader extension mechanism to do it.

---

<div class="post-metadata">

**Author:** ![il-m-yamagishi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/il-m-yamagishi/32/2378_2.png) [@il-m-yamagishi](https://forum.babylonjs.com/u/il-m-yamagishi)\
**Post date:** [August 9, 2019, 12:14am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/5 "2019-08-09T00:14:31Z")

</div>

Of course.

---

<div class="post-metadata">

**Author:** ![il-m-yamagishi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/il-m-yamagishi/32/2378_2.png) [@il-m-yamagishi](https://forum.babylonjs.com/u/il-m-yamagishi)\
**Post date:** [August 9, 2019, 12:40am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/6 "2019-08-09T00:40:48Z")

</div>

VRM has Unity Humanoid bone mapping data. And TransformNode is mapped to these bones(like LeftUpperLeg, Chest, Neck, …).

So **you can animate any VRM model with same code!**

![vrm-motion](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/4/4f2a3543210500b5d0bb40f045b86863523900e4.gif)

```auto
// example code
vrmManager.humanoidBone.leftShoulder.rotationQuaternion = Quaternion.FromEulerAngles(
    Math.sin(Math.PI / 4 * (elapsedTime / 200)),
    0,
    Math.PI / 3.5,
);
vrmManager.humanoidBone.rightShoulder.rotationQuaternion = Quaternion.FromEulerAngles(
    Math.sin(Math.PI + (Math.PI / 4 * (elapsedTime / 200))),
    0,
    -Math.PI / 3.5,
);
vrmManager.humanoidBone.leftUpperLeg.rotationQuaternion = Quaternion.FromEulerAngles(
    Math.sin(Math.PI / 4 * (elapsedTime / 200)),
    0,
    0,
);
vrmManager.humanoidBone.rightUpperLeg.rotationQuaternion = Quaternion.FromEulerAngles(
    Math.sin(Math.PI + (Math.PI / 4 * (elapsedTime / 200))),
    0,
    0,
);
vrmManager.humanoidBone.leftLowerLeg.rotationQuaternion = Quaternion.FromEulerAngles(
    -Math.PI / 6,
    0,
    0,
);
vrmManager.humanoidBone.rightLowerLeg.rotationQuaternion = Quaternion.FromEulerAngles(
    -Math.PI / 6,
    0,
    0,
);

```

Left model is [IL-tan](http://www.infiniteloop.co.jp/special/iltan/3d-dl.php) which is my company’s image character.

[Here is VRM applications list almost in Japan](https://vrm.dev/en/vrm_applications/).

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [August 9, 2019, 2:40pm UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/7 "2019-08-09T14:40:07Z")

</div>

This is excellent:D

---

<div class="post-metadata">

**Author:** ![il-m-yamagishi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/il-m-yamagishi/32/2378_2.png) [@il-m-yamagishi](https://forum.babylonjs.com/u/il-m-yamagishi)\
**Post date:** [January 16, 2020, 10:32am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/8 "2020-01-16T10:32:33Z")

</div>

[https://playground.babylonjs.com/#K5W35Y#8](https://playground.babylonjs.com/#K5W35Y#8)

Playground example is here!

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [January 16, 2020, 3:41pm UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/9 "2020-01-16T15:41:31Z")

</div>

Haha this is really cool!! Do you want to add a page about VRM in our doc?

---

<div class="post-metadata">

**Author:** ![il-m-yamagishi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/il-m-yamagishi/32/2378_2.png) [@il-m-yamagishi](https://forum.babylonjs.com/u/il-m-yamagishi)\
**Post date:** [January 17, 2020, 4:29am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/10 "2020-01-17T04:29:01Z")

</div>

> <https://github.com/BabylonJS/Documentation/pull/1844>

I made it!

---

<div class="post-metadata">

**Author:** ![sibbsnb](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sibbsnb/32/9547_2.png) [@sibbsnb](https://forum.babylonjs.com/u/sibbsnb)\
**Post date:** [July 6, 2020, 6:25am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/11 "2020-07-06T06:25:31Z")

</div>

Is there an example with react.js loading VRM

---

<div class="post-metadata">

**Author:** ![ozRocker](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ozrocker/32/186_2.png) [@ozRocker](https://forum.babylonjs.com/u/ozRocker)\
**Post date:** [July 9, 2020, 4:30am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/12 "2020-07-09T04:30:27Z")

</div>

Is it possible to use animation groups on the VRM model?  
I tried loading animations from a GLB file (using Asset Containers) then copying the animation to the VRM model but I could not locate the skeleton object.

Also, if I create an avatar in Babylon.js can this library export the avatar as a VRM model?

---

<div class="post-metadata">

**Author:** ![il-m-yamagishi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/il-m-yamagishi/32/2378_2.png) [@il-m-yamagishi](https://forum.babylonjs.com/u/il-m-yamagishi)\
**Post date:** [July 9, 2020, 5:19am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/13 "2020-07-09T05:19:26Z")

</div>

You can apply the animation groups to `TransformNode` using `VRMManager.humanoidBone` reference.

(I don’t know how to use `Skeleton` in animation 😐)

Sample code is here.

```auto
    const baseAnimGroup = assetContainer.animationGroups[0]
    const animGroup = new AnimationGroup(`${baseAnimGroup.name}_`, scene)
    animGroup.speedRatio = baseAnimGroup.speedRatio

    baseAnimGroup.targetedAnimations.forEach(targetedAnimation => {
      // refer animation name correspond to humanoidBone. example: head, leftUpperArm, ...
      const boneName: string | undefined = targetedAnimation.target.name
      if (!boneName || !targetVRMManager.humanoidBone[boneName]) {
        return
      }
      animGroup.addTargetedAnimation(
        // clone from original animation
        targetedAnimation.animation.clone(),
        // attach animation to TransformNode.
        targetVRMManager.humanoidBone[boneName],
      )
    })

```

Currently, you cannot export VRM Model using babylon.js. You need to use UniVRM for example.

---

<div class="post-metadata">

**Author:** ![ozRocker](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ozrocker/32/186_2.png) [@ozRocker](https://forum.babylonjs.com/u/ozRocker)\
**Post date:** [February 22, 2022, 5:36am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/14 "2022-02-22T05:36:19Z")

</div>

When I try this method of copying an animation to the VRM avatar the bones become warped. One of the problems with VRM is that the hip bone is rotated 180 so none of the Mixamo animations work properly. Is there a workaround for this? I even tried adjusting the local matrix to rotate hip 180 but there is still warping. Here is a picture of the Mixamo rig on the left and same animation applied to VRM rig on the right.

 ![warping_problem](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/4/4413d4f2aa08f3fc81f817f51d2de737acaa142a.jpeg)

---

<div class="post-metadata">

**Author:** ![il-m-yamagishi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/il-m-yamagishi/32/2378_2.png) [@il-m-yamagishi](https://forum.babylonjs.com/u/il-m-yamagishi)\
**Post date:** [February 24, 2022, 8:35am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/15 "2022-02-24T08:35:37Z")

</div>

Incompatibility with Mixamo and VRM is a difficult problem.

Sorry but I couldn’t make a solution about them. 🤔

---

<div class="post-metadata">

**Author:** ![Julius\_Kong](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/julius_kong/32/25018_2.png) [@Julius\_Kong](https://forum.babylonjs.com/u/Julius_Kong)\
**Post date:** [June 14, 2022, 12:58pm UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/16 "2022-06-14T12:58:31Z")

</div>

Hi i’ve been trying to make vrm models in model change costumes (by using the append function inside blender, getting objects e.g. hair from another model made also in vroid studio) but when i do this, the spring bones on the new hair loads in unity (i can see that the gizmos sway when i move the model in unity play mode) but the actual mesh doesn’t move.

Any suggestions ?

---

<div class="post-metadata">

**Author:** ![Spencer17x](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/spencer17x/32/32500_2.png) [@Spencer17x](https://forum.babylonjs.com/u/Spencer17x)\
**Post date:** [June 15, 2023, 8:24am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/17 "2023-06-15T08:24:36Z")

</div>

When will 6.x be supported

---

<div class="post-metadata">

**Author:** ![Spencer17x](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/spencer17x/32/32500_2.png) [@Spencer17x](https://forum.babylonjs.com/u/Spencer17x)\
**Post date:** [June 28, 2023, 8:05am UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/18 "2023-06-28T08:05:17Z")

</div>

I upgraded it based on babylon-vrm-loader and sent the package as babylonjs-vrm-loader.  
Now he has endorsed babylon.js 6.x.

This is the repo address：

> **[arca/packages/awesome-babylonjs/babylonjs-vrm-loader at main · Spencer17x/arca](https://github.com/Spencer17x/arca/tree/main/packages/awesome-babylonjs/babylonjs-vrm-loader)**
>
> main/packages/awesome-babylonjs/babylonjs-vrm-loader

playgroud：

- [https://playground.babylonjs.com/#K5W35Y#229](https://playground.babylonjs.com/#K5W35Y#229)
- [https://playground.babylonjs.com/#K5W35Y#230](https://playground.babylonjs.com/#K5W35Y#230)

---

<div class="post-metadata">

**Author:** ![Benjythebee](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/benjythebee/32/13587_2.png) [@Benjythebee](https://forum.babylonjs.com/u/Benjythebee)\
**Post date:** [July 19, 2023, 6:10pm UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/19 "2023-07-19T18:10:21Z")

</div>

Man I can’t wait for someone to work with this and make animationGroups work, it’d be a dream come true

---

<div class="post-metadata">

**Author:** ![il-m-yamagishi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/il-m-yamagishi/32/2378_2.png) [@il-m-yamagishi](https://forum.babylonjs.com/u/il-m-yamagishi)\
**Post date:** [July 21, 2023, 6:30pm UTC](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980/20 "2023-07-21T18:30:53Z")

</div>

Hey @Spencer17x . Thank you for forking!

Could you tell me the difference of my [master branch](https://github.com/virtual-cast/babylon-vrm-loader/tree/master/src)? I want to merge this feature.

[Next page](https://forum.babylonjs.com/t/loading-vrm-humanoid-based-model/4980.md?page=2)
