Will this keep my VR experience from lagging?

The picture below shows a VR experience I am working on. You will be in the middle of a crowd of people who are listening to a speaker. During certain parts of the speech, the people will be triggered to do animations and play sounds (Basically they will be booing or cheering and have an animation to match their emotion). Without any animations going yet, the experience is already pretty laggy and I am running it on a GTX1080. An idea that came to mind is that I could simply make the entire experience an animation. I am still very new to this and don't yet have the lexicon to explain what I am trying to do but here is my best shot.

From what I understand, VR is so taxing on the GPU because it has to figure everything out in real time based on the angle you are looking from. If I locked the camera to only be able to rotate horizontally, would I then be able to turn the speech and everyone's reactions to it into one single animation? It seems that this would take care of all the processing before hand and make for a lag free experience. I am sorry if this is too vague. I am more than happy to elaborate on any parts that are unclear. Thank you for your help!



  • Bartosz Piłat(krajca) replied

    I will assume that player will be standing at scene. If it's VR experience then locking camera is bad idea, and VR is taxing GPU because of double render (render for both eyes)
    Can't say much about optimization in this scene with so many observer in there, but I give you some advices:

    -Try to lower number of watchers - try to populate front of the crowd more than back it gives you illusion of greater population
    -Try turning some of them into static meshes without animation - not everyone need to actively participate
    -Try to not use unity terrain it can be lagy as well.

  • Jonathan Gonzalez(jgonzalez) replied

    To add on to what was already said, it looks like you have "always animate" on the animator, I'd change that to cull completely or cull update transforms. With always animate you're animating the characters even when they are not being rendered (not seen in your field of view), which is just adding unnecessary animations being played regardless of whether you are viewing them.

    Taken from the Unity docs:

    Always animate don’t do culling even when offscreen.

    Cull Update Transforms Retarget, IK and write of Transforms are disabled when renderers are not visible.

    Cull Completely Animation is completely disabled when renderers are not visible.


    The only time I've used Always Animate is with a first person controller where the arms went off screen briefly while playing an animation. It kept culling it soon after so I had to change it to always animate so I could see the arms the entire time. In this case you wouldn't need that.

    On a similar note with animations, are these all coming from one set of animations? Meaning is it one character that you animated and applied that to all other characters? Are these the same character models? Also why is there an animator on the terrain?

    Since you have quite a few characters I would look at creating LODs (Level of Detail): https://docs.unity3d.com/Manual/LevelOfDetail.html

    Basically what this does is it allows you to use lower detailed objects based off the distance from the camera. Up close and you want full detail, further away, less detail which is better for performance. Since it looks like you'd be relatively close to everyone in that crowd, you could focus on having high detailed characters that play the animations and low detailed characters that are "fillers".

    Also agree about the terrain, it might not be a good idea to use a terrain which already looks too big for the scene. Create a much smaller environment, add walls or obstacles to obscure the view in the distance so you can have a smaller environment.

    I'm not sure how well occlusion culling works with VR, last time I tried it was with a Gear VR project and occlusion culling seemed to not want to work properly, or maybe that was the preview. Not sure if you've ever used occlusion culling with VR krajca but I'd be interested in knowing if you've used something similar to that for VR.  


  • Bartosz Piłat(krajca) replied

    jgonzalez  Sadly, I never did such a big project in VR to occlusion culling be actually an issue.

  • Jonathan Gonzalez(jgonzalez) replied

    No worries. Also Unity has a good article about VR optimization: https://unity3d.com/learn/tutorials/topics/virtual-reality/optimisation-vr-unity

    Also if you're willing to spend a bit you can get VR Panorama 360: https://www.assetstore.unity3d.com/en/#!/content/35102 Unity did a great tutorial on it which made me rethink how I could improve my VR scenes as well. Here is a quick tutorial on it: https://www.youtube.com/watch?v=f8cRmroz8TQ