When you add accessories or change the pose of a VRM file using Blender, and you export the file as a VRM, the changes will not be applied.
So, even if you want to use that avatar as a VRM file, you need to export the file as a different type, such as FBX, and edit the file in Unity to change it into VRM.
There are two ways to do this. ① Export as a FBX, and edit it in Unity, or ② Do not export the object, and import the .blender file with the edited VRM file, and use it as a model.
When you import a .blender file to Unity, you can use it as an object just like a FBX file, but if you edit it, the change will directly be applied to Unity too. (This may not be true If you are using old versions.)
Method ①, can often prove troublesome when there are any changes, and you will have to re-export the file from Blender, and import it to Unity again.
In this article, we will go through the steps for method ①, and how to bring the file to STYLY.
How to use VRM files with Blender↓↓↓
How to link Blender and Unity without exporting objects as FBXs. (This is the method ② I mentioned above.)
Please check out this article too↓↓↓
How to add accessories↓↓↓
Exporting as a VRM
So, let’s begin by exporting the file. For this tutorial, we will export a very cute character with this new accessory.
Go to the menu, and select File > Export > FBX.
Please check the Export settings. The settings should be as in the image below.
Main： Apply Scalings should be FBX All. Select Armature and Mesh.
Geometries： Select Apply Modifiers.
Armatures： Select Only Deform Bones.
Animation： Select Baked Animation.
Once you are done with the settings, press Export.
Using In Unity
Open Unity. If you are planning to upload to STYLY, please use Unity version 2017.4.x.
In order to use VRM files with Unity, first import UniVRM.
You may be puzzled as we just exported the file as a FBX. We will explain why:
When you export a FBX file and import to Unity, you need to recreate material and set the texture files. That is very tiring, and since we are using a FBX file that was originally a VRM file we can import the original VRM file to Unity and use the material from there.
Please download the latest UniVRM .unitypackage from the URL below.
When you open the URL, a window like the one shown in the image below will appear. The one squared in red should be downloaded. NOTE: please use the latest version.
Once the download is complete, please create a new project in Unity.
Double click the UniVRM unitypackage you just downloaded, and select all then click Import when a window appears like the one shown below.
We can now use VRM files with Unity.
Importing the Files
Next, we need to import the FBX file we exported, and the original VRM file to Unity.
If you want to keep things tidy in the Unity project, we advise you to create a folder under Assets, and place the VRM file inside it.
You can add files to Unity by the drag and drop action.
If you have texture files for the accessory you added to the VRM file, please add the file to Unity too.
Next, we need to set the bones.
Select the FBX model you imported, go to the Rig tab in the Inspector window, and select Humanoid as a Animation Type, then click Apply.
Once you click Apply, you will be able to click the Configure… button above it, so please click it. You will jump to another screen.
We need to check the bones in this screen. If they are all green, we are set, so please click done.
We are using a file that was originally a VRM, so normally there will be no errors here.
Next, we need to change the material settings. Place the FBX model inside the scene. Drag and drop to the Hierarchy window.
Go to the Hierarchy window, and you will be able to find Body, Face, Hair, Skeleton inside the object. Check the inspector of Body, Face, and Hair, and you will find Materials are applied within Skinned Mesh Renderer.
Change the material files here to those of the original VRM file.
Look at the VRM file in the Project window. There should be a Materials file within the many files. Please open this.
There should be material files for Body, Face, and Hair, so swap these files with that of the FBX file. You can just drag and drop again.
We are done with the avatar material settings. Next, we check the accessory material settings.
Right-click inside the project window, and Create > Material to create a material file.
If you have any texture files, set them to the red squared place (see image below). You can drag and drop, or click the square and select the file from the popup window.
Next, we need to set material shaders. Click ① Material , then click ②, ③ move the cursor to VRM, and select from ④.
It will be better if it matches the material files you just used. If there are any texture files, it is probably UnlitTexture.
If there are any transparent parts in the texture, you should use UnlitCutout or UnlitTransparent options.
If there are no textures and just colours, go to ③ and select Color from Unlit.
By the way, Unlit means that it is not affected by lights. However, if you select MToon in ④, it will become affected by lights and look like a cartoon, so you can change the hair and body shaders according to your taste.
Also, you can drag and drop materials to objects within the scene to apply them.
Exporting as VRM and Uploading to STYLY
You cannot directly upload to STYLY. Doing so will result in certain objects not being recognised. In the example we are using for this article, eyebrows and eyelashes were not imported with the model.
Export the file as a VRM first, then upload it to STYLY. This way, there is no trouble at all.
So, please refer to the article below and go through the steps after Other Settings.
That’s all for this article! Thank you!