Search code examples
unity-game-enginevirtual-reality

Developing a VR game but it is so much laggy


I am developing an Android game which is based on VR, In game player is free to move around an amusement park which will be filled with stuff like stalls, toys, Ferris wheels, rails and other carnival rides. Now if I put a big mesh like rails and Ferris wheels which have around 400k+ polycount each and when I run it on my smartphone (galaxy s7 edge) I face hitching and lagg viewing the scean in VR. I also reduced polygons from some objects, fixed texture resolution but still no way near getting it close to run at 50-60fps.

enter image description here

enter image description here


Solution

  • If you are building it for Oculus platforms, here are some performance requirements:

    1. 60 frames per second
    2. 50-100 drawcalls per frame
    3. 50k – 100k polygons per frame
    4. 1 ~ 3 ms spent in script execution (Unity Update())

    To optimize your game:

    1. Use Lightmaps/baked lights instead of run-time/dynamic lighting.
    2. Mark stationary objects as static to use static/dynamic batching. This will reduce drawcalls.
    3. Use Oculusion culling to save rendering power. This will reduce tricount and drawcalls.
    4. Use fewer materials in your objects by putting separate textures into a larger texture atlas.
    5. Use Compressed textures to decrease the size of your textures.
    6. Use Generate MipMaps option on importing textures to save GPU power.

    Read More about optimization for VR.

    Read More about Graphic Optimization in Unity

    Hope this helps