Welcome to VR Me Up developer log number 7. After adding some new VRM VRoid Studio characters to VR Me Up, I decided to explain the process that I go through to optimize the models for WebXR use in a browser. I want to stress there’s nothing special that I have to do to get a VRM VRoid Studio character into VR Me Up, however, by default the models can be large and take up a lot of memory, and effect frame rates.
If you’re using these models in a desktop application with a dedicated GPU, this might be negligible, however, if you’re targeting a web browser then the large size of the models can have a noticeable impact on performance. For example this simple model has a file size of 17 megabytes, and that’s compressed data. The actual memory usage for the images and meshes can be a lot more. So let’s take a closer look at the file.
To view the detailed contents of the model file I’m using the Play Canvas Viewer. This web application will reveal some really useful metrics on the contents of the file, such as the memory usage and load times, etc. VRM files are actually GLTF binary files, so to load them into the viewer you will need to rename the file extension from “VRM” to “GLB” and then drag and drop it into the browser window.
Once the model has been loaded, model metrics will appear in the top left corner of the browser window. The metrics that are most interesting are the “Verts” count (or vertices), the “Mesh VRAM”, the “Texture VRAM” usage, and the total “Load Time”. From the original 17 megabyte model, the loaded model is actually taking up almost 11 megabytes of “Mesh VRAM” and 200 megabytes of “Texture VRAM”. That’s a total possible memory usage of 211 megabytes. That’s a lot of memory for one model.
There are settings in the export step of VRoid Studio, that can help reduce the memory usage of the model.
-
Make sure that the “Delete Transparent Meshes” option is checked. This will remove any triangles from the model that do not contain any visible texture data.
-
Reduce the quality count of the “Hair”, “Face”, “Body” and “Outfit” meshes. These settings will affect your model and it’s really up to personal preference and the complexity of the model as to the actual values, but keep an eye on the “Polygons” count in the export info box. A Meta Quest level device can draw about 1 million polygons per second. That sounds like a lot, but you need to aim for at least 60 frames per second. You’ll want to keep the count well below 16,000 polygons as there are still all the other polygons in the scene and other characters to draw.
-
Pay particular attention to the hair and shoes as you reduce the quality. You may see unwanted polygons poking through the different layers. In developer log #8 “Manual optimization” I’ll discuss using a tool like Blender to fix these errors.
-
Reduce the “Materials” count to 2 and the “Texture Quality” to 2048.
When finished, export your model again and use the Play Canvas Viewer to check the new metrics of the optimize model. The file size has been reduced, however, what’s really important is the amount of “Mesh VRAM” and “Texture VRAM” used.
Original | Optimized | |
---|---|---|
File Size (MB) | 17.7 | 7.9 |
Primitives | 160,350 | 42,021 |
Verts | 198,518 | 10,960 |
Mesh VRAM (MB) | 10.6 | 0.6 |
Texture VRAM (MB) | 199 | 130 |
Load Time | 428 | 241 |
The Primitives count (Polygons) is still a bit high, but it’s better than the original and we have almost halved the memory usage and load times. In my “next developer log”, I’ll discuss using a tool like Blender to reduce these even more.
See you in the Metaverse!
VR Me Up!