Hi all,
In this tutorial, we are going to share with you on how to optimize your VR (Virtual Reality) game / app in Unity.
Before we start, what is VR?
Virtual reality (VR) is a computer-generated scenario that simulates a realistic experience. The current VR technology that we have now commonly uses virtual reality headsets to create realistic images, sounds to let the user have a physical presence in a virtual or imaginary environment.
To achieve the target frame rate for your platform is very important so that users can have a great and nausea-free VR experience. And that being said, optimization is a big part of VR development.
Unity Tools
Make use of Unity profiler to understand how much time is spent to render each frame of your game or app. It's important to examine the performance and solve the problem as early as possible.
You can also use the frame debugger to freeze playback on a frame and the draw calls is affecting your scene, from there, you would be able to identify what to optimize.
3D geometry
Remove unnecessary faces on your 3D models. If they cannot be seen in the game, remove them! Simplify your 3D meshes as much as possible. If you need to add details, try adding using textures.
Textures
Use texture atlas to optimize as much as you can. Having more number of textures and materials used means slower performance.
We recommend you to use MeshBaker to bake your textures, meshes, and materials to increase performance in your game.
Take note that you might want to avoid normal maps because usually they don't look good in VR.
LOD ( Level of detail)
Use LOD allows you to reduce the number of triangles render as the the distance of the camera increases. This is very useful and you have a lot of assets appearing on one screen and the camera distance is far from them.
Draw Call batching
Always batch draw calls whenever it's possible. Less draw calls = better performance.
Occlusion Culling
Occlusion Culling - objects will not be rendered if they are not seen. This will significantly increase the performance!
Baked lightmapping
Try to avoid dynamic lighting and realtime shadow as much as possible. Bake them if you can :)
Anti-Aliasing
Anti-Aliasing is highly recommended in VR development. It helps to smooth the image and reduce jagged edges. Take note that if you are using Forward Rendering, you may be able to enable MSAA in Quality Settings, and you should always look to enable this for Gear VR where possible.
Shaders
Always try to use the most basic shader if possible. For example: Mobile > Unlit.
Quality Settings
Try to adjust the quality settings to further optimize your game.
Scenes
You may want to consider separating your game or app into different scenes. It will help to increase the performance. But beware of freezing tracking of the head when loading next scene because it might cause nausea.
Basically, these are some of the things you can work on when optimizing your VR game / app. Hope this helps :)
Have a good day!
Leave a comment