VR development – Lessons learned

I’ve developed VR games for Oculus Rift, Gear VR and Cardboard which are for windows and android platforms. Integrating Unity, Android and VR took longer than I expected for the first time as there were some compatibility issues with Unity and Android api packages.

There are some rendering standards when it comes to mobile VR such as maintaining 50-100 drawcalls per frame, 10- 200k polycount per frame etc. For my first android VR game I did not pay attention to these standards and as a result I overloaded my Samsung device and the game was very slow with a frame rate less than 50fps. I discovered a lot of optimization methods and bottleneck areas in the game that caused low performances. I followed developer blogs from popular games and Oculus forums and realized how important it is to learn from experience.  Here are a few integration and optimization lessons learned while working on VR games specifically.

  1. Unity fails to build your apk file with the error – failed to repackage resources in apk – this is because the latest version of android api package (api 26) is not compatible with Unity.  So I always stick to api 23.
  2. Oculus utilities need Unity 4.6 – this is a common error and the solution is to use Oculus_utilities package instead of the Oculus_mobile_sdk package (even for android builds) and then enable Virtual-Reality-Supported option in the project settings.
  3. If you are importing models from Maya, make sure that the polygon count of the model is below 100k. I optimized some of the meshes using  the Reduce function and this did not always work out well, so it’s better to keep polycount in mind right from the beginning and avoid reduce function.
  4. Lighting plays an important role in game performance as your mobile device has to render every frame as two images for VR unlike regular games. So, it is always better to bake lightmaps for your static objects. Dynamic lighting  will affect the performance unless you have a single static scene.
  5. Bake your lightmaps after you’re done developing the scene as it is a long process if you have a lot of game objects and if you’re in the android platform. So I always uncheck the Auto bake option in the Lighting window and bake lightmaps towards the end.
  6. If the baking still takes a lot of time, switch platform to windows and bring up the shadow quality in your quality settings and bake the lightmaps. I learned this from a developer blog
  7. If you are using a camera space canvas(i.e if you want your UI to follow the camera), then use a distance of 1 to avoid the canvas from colliding with world space objects.
  8. Turn off the gravity modifier component of the OVR player controller (if you’re not using physics) . This avoids physics update processes in every frame.

Leave a comment