Home > 10 Tips of Boosting VR Graphics and Performance in Unity
10 Tips of Boosting VR Graphics and Performance in Unity
Most of the times, high graphic quality is inversely proportional to performance in games. I have summarized 10 magics of boosting your VR games visual quality and performance.
Graphic Quality
-
Tip 1.
IncreaseVRSettings.RenderScaleXRSettings.eyeTextureResolutionScale for better graphics. RenderScale controls the texel: pixel ratio before lens correction, meaning that we trade performance for sharpness[1].
You can create a following script named VRRenderScale.cs and attach it to your VR camera. The higher render scale value, the better visual effect you get. However, Remember: This will tradeoff the performance. Usually, I set it to 1.5 because it could dramatically increase the graphic quality.
VRSettings.renderScalehas been deprecated. Use XRSettings.eyeTextureResolutionScale instead.using UnityEngine; using UnityEngine.VR; public class VRRenderScale : MonoBehaviour { void Start () { VRSettings.renderScale = 1.5f; } }
-
Tip 2.
Set your VR camera to Forward Rendering and Allow MSAA. Also, in Quality Setting, set 2x(or 4x) anti-aliasing for better visual quality. -
Tip 3.
Post Processing Stack. This is a must have for improving the visual of your game. Colour Correlation Curve and blah, blah is amazing. NOTE: VR does not support Motion Blur. -
Tip 4.
If you have any Text and you found it isn’t clear in VR, you can try either a). set a higher value(such as between 1.75f ~ 3f) of Dynamic Pixels Per Unit in Canvas Scaler or b). Use TextMesh Pro. -
Tip 5.
If your game involves switching to different scene, use SceneManager.LoadSceneAsync to avoid freezing tracking of the head when load the next scene. SceneManager.LoadSceneAsyn loads the scene asynchronously in the background. -
Extra Tip (Haven’t tried).
VR Graphic Booster asset NVIDIA® VRWorks. According to its description, it enables a new level of presence by bringing physically realistic visuals and simulated environments to virtual reality. I haven’t tried it yet but I will definitely check it out for my new VR project.
Performance
Using Unity Profiler to optimize your game, I always make sure profiler do not over 10ms.
-
Tip 1.
In your Quality Setting, turn VSync(Vertical Synchronization) off. Wait, what is VSync? Why tick off?OK, here is some background information about VSync.
First, you will need to know the difference between Frame rate and Refresh rate.- The frame rate is determined by how powerful your CPU or GPU is.
- Refresh rate is determined by your monitor, ie, the number of times per second your monitor can redraw the screen[2].
Say, for your Oculus VR game, you run 90FPS, while if your refresh rate is lower than your frame rate, you will experience screen tearing. Vertical Synchronization is helpful to prevent Screen Tearing because it forces your frame rate the same as the refresh rate.
The best practice is to turn VSync off and enable it only if you experience screen tearing. Because by ticking it off, your performance would dramatically change. -
Tip 2.
Occlusion Culling: Disable rendering of objects when they are not currently seen by the camera because they are occluded by other objects. -
Tip 3.
If your environment gameobjects are not going to change its position, set it to Static.
Static GameObject: Many optimisations need to know if an object can move during gameplay. Information about a Static (ie, non-moving) object can often be precomputed in the editor in the knowledge that it will not be invalidated by a change in the object’s position. -
Tip 4.
For GearVR games, Shaders: Choose Mobile > Unlit (It’s the fastest shader). Recommended readings -
Tip 5.
Bake your lightmap! Try not to heavily use real time lighting if you pursue high performance. -
Extra Tip.
Use Low Poly Asset if you can!
Google Poly is a great place to find low poly 3D objects for your projects.
Cheers!