Hey and welcome!
Got a bit of an interesting one for you here today. I’ll be going about showing you how to import a model from VRoid into Unity and as a bonus I’ll also show you how to use animations from Mixamo with your 3D model.
There’s a lot that can go wrong here so I’ll try and keep this all concise, here’s a quick breakdown of the steps involved here:
- Export VRM model from VRoid
- Install VRM Importer and CATS plugins for Blender
- Import VRM model into Blender
- Fix model using CATS and export as FBX object
- Import FBX object into Mixamo
- Find animation and export as FBX for Unity
- Install UnityVRM package into Unity
- Import VRM and FBX model from Mixamo into Unity
- Add materials from the VRM model to your FBX model
- Test out your animation!
Even the quick breakdown is pretty long looking so I’ll structure all this as best as I can with minimal waffling.
Export Model From VRoid
Let’s get started with the easy part by opening up VRoid Studio, either through Steam or the exe you get from their website here. If you have your own model you’ve been working on in VRoid you can use that but if not go ahead and select one of the default models, I’m using the Rubin model as my example.
Once you’re happy head to the Camera/Exporter tab, click Export in the left hand menu and then Export again in the right.
Fill in the name and author boxes, click OK and save it somewhere on your computer that isn’t your Unity project and you’re done with step one!
Install VRM Importer and CATS Plugin in Blender
OK now here’s where thing can start to go wrong so I’d advise making sure you download the same versions for the following:
Blender 2.91.0 -
CATS Blender Plugin 0.18.0 -
VRM Add-on for Blender 1.10.0 - https://github.com/saturday06/VRM_Addon_for_Blender
If you’re unfamiliar with Github you just need to download a zip folder of these plugins by clicking on the green “Code ” box and then select the Download Zip option.
Now open up Blender and click on Edit > Preferences > Add-ons so that it brings up this window:
You’ll notice that there’s an Install option at the top there, go ahead and click on that and then install your plugins one at a time by clicking on their zip folders and choosing the Install Add-on option.
With those installed you’ll now need to enable them before they can be used. Click on the Community tab at the top and then search for your plugins, once you’ve found them go ahead and check the boxes to enable them and you’ll be done with the second step here.
Import VRM Model and Export as fbx in Blender
To start things off go ahead and create a fresh blender project and collect any default objects it creates, usually a Camera, Cube and Light object. Now if you click into File > Import you’ll find a new VRM option here as you can see at the side, click on that and select your VRM model you exported earlier.
That should be your model sitting inside Blender now, if your model has no colour don’t worry too much about that since we’re going to be adding materials to this manually in Unity.
It’s now time to use CATS to fix our model, the issue with it currently is that the skeleton VRoid uses isn’t compatible with Blender or Mixamo so getting it fixed is necessary for animating or posing our model. On the edge of your scene menu on the right hand side you should be able to spot a small arrow poking out. Click on that and drag it open to reveal a new menu where you can click on the CATS tab and then the Fix Model option.
That’s all you needed to do with Blender here! If you’re a wizard with Blender though you can stick around and use it to create your own animations now and play about with the multitude of options in the CATS plugin. Also if your model turns invisible after fixing it you just need to change the shading mode to solid by clicking the option in the top right of the scene view.
Let’s wrap things up here however, just above the fix model option you’ll see an Export tab, go ahead and click on that and OK the warning message if it gives you one about too many materials. Name your new fbx model something appropriate and you’re all set for this step. I recommend appending _FBX to the file name or similar so that you don’t mix up the models.
Alrighty, now it’s time to talk about Mixamo. If you have your own animation already or your own plans for the fbx model in Unity you can skip this part.
With those of you remaining though it’s time to open your eyes at the joy of mixamo. The short of it is that it’s an Adobe service that has hundreds of different animations you can use with any humanoid 3D Object that you’ve created which is exactly what we’re after here.
Start things off by going to the webpage and creating an Adobe account if you don’t have one already:
With you logged in, click on the Upload Character option and select the FBX model that you just exported from Blender, this may take a bit of time depending on your internet speed.
If you come across any issues here you may need to double back and try the Blender step again so that you have a fresh new fbx to try out. You’ll also need to make sure that the web browser you’re using has WebGL enabled in order to preview the animations.
The model you’ve exported should be compatible with the auto-rigger so you don’t actually have to worry about any extra steps here! Go ahead and find an appropriate gangster style walk or any other animation that you like the look of (definitely give the library a good look through, there’s a lot here!).
In each animation you’ll also notice a variety of options you can tweak, for this one I can change about the speed or arm space and even choose if I want the animation to play from one spot instead of moving forward like you see here.
Once you’re satisfied with your animation click on the download option and choose the FBX for Unity option as the format and make sure you have the With Skin option selected as well. That’s all for the Mixamo step here.
Preparing Your Model for use in Unity
Now we’re onto the meat and potatoes of all this, if you’ve made it this far without any errors you’re doing pretty good!
To get started with this section we’ll need to download and install another VRM importer, this time for Unity.
The above link is where you can download the package, if you’re not familiar with Github this page will be pretty confusing looking but all you need to do is find the version you want (I went for 0.74.0 which is the most recent at the time of this article) and then click on Assets and download the Unity Package.
Make sure to go for the one that doesn’t have “samples” in the title. This file is what we need to import into unity which is thankfully an easy process.
Open up unity and right-click the project view to find an Import Package > Custom Package… option and select the package you just downloaded for this.
A package importer window will pop up, once you click import here it will bring the package into your project ready to use!
In the top menu in the Unity editor you’ll notice a new option called VRM0, go ahead and click on that and choose the import option.
Select your model that you exported from VRoid and then choose where you want to import it into your project. I recommend creating a new folder just for your model as it will import several subfolders when you do this.
Now it’s time to import the FBX model we exported from Mixamo, right-click inside your project view where you want the FBX model to be and then choose the Import Assets option and select your model.
If you skipped the Mixamo step you can import the FBX model you exported from Blender instead.
You may notice that the FBX model looks horrifying currently:
The reason we went to the hassle of importing the original VRM model is so that we can transfer the materials from that onto our FBX model. Click on the FBX model and then navigate to the Materials tab in the inspector and you’ll see a list of the materials on the model as well as the option to add in new ones.
Navigate to the folder that contains your VRM model and you should see a folder here that has .Materials appended to the end of whatever you named your model, click into this and then drag and drop the materials into the relevant slots for the FBX model.
I recommend switching to the One Column Layout for this if you’re not already on it. You can change the layout by clicking on the three vertical dots in the top right of the project view and selecting it there.
With all that done you’ve now finished this part of the process, next part is just testing out the animation.
Here’s a quick side by side of the models, the left hand one is the original VRM model followed by the updated FBX and then the original FBX.
Using the Animation From Mixamo
Welcome to the last section, if you’ve made it this far then you’ve done all the hard bits and also the bits that are most likely to go wrong, now it’s just a case of testing out your animation.
In your project view go ahead and create a new Animator Controller which can be found in the Create section in the right click menu. Call it something appropriate such as the name of your model and then double click it to open the animator window.
If you have your own animation made you can drag it into this window, if you’re following along this article though you’ll need to grab the animation which is currently a child of our FBX object. Find the object and click on it and you should see the animation attached to it, click the animation and press CTRL + D this will move the animation out of the FBX object which lets you then drag and drop the animation in the animator window.
Done correctly your animator should be looking like the above. Now drag your FBX model into the game view and attach an Animator component to it using the inspector and choose the animator controller you created as the Controller that it’s looking for.
Then all you need to do is run the game and watch the animation!
If you’re happy with that you can now remove the animation from the FBX model altogether by going to the Animation tab in the inspector for the object and then uncheck the Import Animation option and Apply it.
Congrats, you’re all done! As I mentioned at the start here this is a pretty long process at first and there’s a lot that goes wrong so I’ve tried to cover as much as I can while trying to keep things concise.
If you want a bit more info on using animator controllers and animations in-game I recommend checking out my previous article where I go into a bit more detail on that.
I’ve been playing about with ways of making this whole ordeal shorter like using the VRM model directly and ignoring the need for Blender, however I haven’t been able to nail down anything that I can get to work consistently. Though for game development it will be better to use the FBX model in game since it’s over twice as small than the VRM model making it a bit more optimised, plus Unity recognises the FBX format better.
If you wanted to do animations or cutscenes though it could be better to use the VRM model as it has some more complex rigging along with a few built in components to help with animating inside Unity though I’ve not played about with those too much yet.
Last thing, if you’re wanting to add in more animations you just need to download them from Mixamo, import the model into Unity, grab the animation from the model and then delete the model afterwards.
Tomorrow will be back to the regularly scheduled daily Unity development. I had been working on this one for a while and figured now would be a good time to publish it now that it’s more relevant to the project we’re currently working on.