Converting an avatar to VRM format
In this guide, I assume you already know the basics of Unity and probably have previously uploaded an avatar to VRChat. If you haven't, you can still try to follow along, but some descriptions might be a bit too brief.
A more in-depth guide with screenshots can be found here.
If you know Japanese, you can also read the official the UniVRM documentation.
Preparing your avatar
I assume you have your rigged, humanoid avatar in FBX format already imported into Unity. Make sure the rig is set to humanoid and it is placed in a T-pose.
In VRM format, shape keys are a big contributor to file size. If your model's file size is too big, try splitting off the parts with shape keys into their own mesh and deleting the shapekeys on the other mesh objects in Blender.
On importing your avatar to Unity, you will want to set up the materials to use the shaders compatible with VRM. These shaders, according to the UniVRM documentation are:
If you cannot find the materials for your imported avatar, you can export them on the materials tab of the prefab.
Creating a base VRM file
Put your prefab into a scene, do any further basic setup you might need and then select the
export humanoid option from the VRM menu on the menu bar. Enter your name as the author, make sure the two checkboxes are ticked and export the base VRM file.
After doing this, create a new folder in your Unity project and drag the VRM file there to reimport your avatar with all the VRM components applied.
If importing the VRM file fails with a JSON error, try to set your Windows region in such a way that floating numbers use the dot as a decimal symbol.
Customizing the VRM file
Open a new scene and drag the prefab created from the VRM file into it. On the avatar, there will be a number of components that can be customized. In the following, I will mention the components that are useful for customization.
VRM Meta: This component contains information about the model and the creator, as well as what types of content the model may be used for and under what license.
VRM Blend Shape Proxy: Double click on the
BlendShape (BlendShapeAvatar) and you will be taken to an overview of blend shape clips. For each you want to set up (probably A, I, U, E, O, BLINK, JOY, ANGRY, SORROW, FUN), select it, then open the mesh at the bottom to adjust the blend shape values. When they are adjusted appropriately, press apply and work on the next one. After setting everything up, you can play the scene and test your blendshape clips using the component on the avatar.
VRM First Person: The first person offset is probably similar to what has to be setup for a VRChat avatar and specifies the camera position. I'm not sure if the offset is from the ground or from the specified bone. The renderer settings can be used to render different parts (e.g. with or without head) depending on how the avatar is viewed.
VRM Look At Head: I'm not sure if this usually needs to be customized. Probably not. However, it is useful for setting up the next component. To do this, add a small object to the scene, in front of your character's head and enter it as a target in this component. Also enable
VRM Look At Bone Applyer: This component lets you customize the movement range of your avatar's eyes. After setting a target for the previous component, enable
Draw Gizmo here and play the scene. By moving the target, you will be able to see your avatar's eyes following it. You can adjust the sliders of this component to adjust the range of movement, mainly by using the
Curve Y Range Degrees sliders. When you are happy with your settings, right click the component, select copy component and stop the scene. The values will have reset, but you can put them back in by right clicking on the component name again and pasting the copied values.
You can add a
Blinker script to preview the blinking animation of your avatar. There is also an
AIUEO component you can add to preview the mouth animations.
VRM offers its own alternative to dynamic bones called spring bones. They are less flexible, but can work alright. Spring bones components can be added to the
secondary object inside your avatar. Add the root bones of parts of your armature you want to animate to root bones and play with the values until you are happy with it. You can also have multiple components if you need different settings for different root bones. You can also add
VRM Spring Bone Collider Group components to your skeleton, to prevent spring bones from clipping into your body.
Once everything is set up, you can export your final VRM file. You do this once again by selecting the
export humanoid entry from the VRM menu. This time, make sure the two check boxes are unchecked.
That should be all.