When you add accessories, or change the pose of a VRM file using Blender,
if 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 a 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.)
My personal opinion is that if you use method①, it may be troublesome when there are any changes and you have to re-export the file from Blender, and import it to Unity again.
In this article, I will go through the steps for method②, how to link the VRM file with Unity, and how to bring the file to STYLY.?
Please refer to the article below to learn how to export a FBX file and import to Unity.↓↓↓
This article explains how to add accessories to a VRM file↓↓
Ok, let’s begin. In this tutorial, I am going to edit my cute character with this panda hairband.
First, open Unity. If you are planning to upload to STYLY, please use Unity version 2017.4.x.
Please close Blender for now.
In order to use VRM files with Unity, first import UniVRM.
Even when linking with Blender, material files change shaders so we need to create a new material file and set the texture.
That is troublesome, so I am going to use the original VRM file and use the material file of it.
That is the reason to use UniVRM. We will also use it to change the file to a VRM.
Please download the latest UniVRM .unitypackage from the URL below.
When you open the URL, a window as in the image below will popup. The one squared in red should do. 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 popups, as in the image below.
We can now use VRM files with Unity.
Next, let’s import the .blender file with the accessory added, and the original character file to Unity.
If you want to keep things tidy in the Unity project,
I 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.
We already imported the .blender file. Meaning, Unity and Blender are already linked.
The .blender file under Assets will be like when you put in the FBX file.
We can use the file as an object too. Drag and drop the file to the hierarchy window. Files will be displayed as normal objects. All the objects in Blender should be displayed.
Please select the files in the hierarchy window, and click Open in the inspector window.
This is the link setting with Blender. When you click Open, Blender will open up. This is the main goal for this tutorial.
If you click Open, then edit files within Blender, the file in Unity will directly change too. Try to add some objects within Blender.
How useful. I bet you are saying, why didn’t you tell that to me earlier. You don’t need to export files as FBX, then import to Unity… each time you edit objects in Blender from now on.
One thing to note is that the .blender file in the Unity project folder is a copied file of the original, and when you click Open, the file you are opening is the copied one.
I was really thrilled when I learned how to do this!
So, if you want to change or edit the accessory files you added in Blender, you can use Blender to change the settings.
Next, let’s edit the bone settings.
Select the FBX file, and go to the Inspector window, choose the Rig tab and change the Animation Type to Humanoid, click Apply.
Once you click Apply, you will become able to click the Configure…. button above it, so please click it too. You will jump to another scene.
We need to check the bones in this scene. 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, let’s edit the material settings.
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 now. 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. 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 colors, go to ③ and select Color from Unlit.
By the way, Unlit means that it is not affected by lights, but if you select MToon in ④, it will get affected by lights and look like a cartoon, so you can change the hair and body shaders according to your taste.
You can drag and drop materials to objects within the scene to apply them too.
That will be all for preparations!
Exporting as VRM and uploading to STYLY
Let’s upload it to STYLY then. Export the file as a VRM.
Please refer to the article below for how to export the file as a VRM and uploading to STYLY. Go through the steps after Other settings.
Select the .blender file in the hierarchy window which should look like a object.
That is all for today! Thank you!