Wednesday, June 17, 2020

Unity Oculus Quest VR anti-aliasing workaround, MSAA


For some reason MSAA antialiasing doesn't seem to work when attempting to develop for the Oculus Quest. The setting simply has no effect. A workaround is to apply a very slight scaling effect via a little code. This really does work and softens those jaggy lines!

Just add a game object to your scene, add a custom C# script named "VRRenderScale" to it and replace it's contents with this code.


using UnityEngine;
using UnityEngine.XR;

public class VRRenderScale : MonoBehaviour {
    void Start () {
        XRSettings.eyeTextureResolutionScale = 1.5f;
    }
}



It will effect performance if we increase it a lot. In my experience 1.5f was a pretty subtle effect. 2.5f was definitely noticeable but did decrease performance. In the end for the project I left it at 2.5f even though the frame rate descreased it still worked fine for my application.