Skip to main content
Inspiring
December 17, 2014

[0.4.3+] Changing MSAA at runtime?

Right now, if I change QualitySettings.antiAliasing at runtime, nothing happens. If I make small modifications to OVRDisplay.cs to allow reconfiguring the eye textures by releasing the existing rendertextures and then creating them as usual via ConfigureEyeTexture(), I get a black screen and no errors to look at.

Is there a recommended approach to accomplishing this? Any help is appreciated!

----

Details of what I tried:

New method added to OVRDisplay.cs (logic taken from bottom of OVRDisplay()):
	public void ReconfigureEyeTextures()
{
for (int i = 0; i < eyeTextureCount; i += 2)
{
ConfigureEyeTexture(i, OVREye.Left, OVRManager.instance.nativeTextureScale);
ConfigureEyeTexture(i, OVREye.Right, OVRManager.instance.nativeTextureScale);
}
}


Calling new method at bottom of OVRDisplay() in place of the old logic:
		ReconfigureEyeTextures();
}


In ConfigureEyeTexture(), inserted the following just prior to newing up the RenderTextures:
		if(eyeTextures[eyeIndex] != null)
{
eyeTextures[eyeIndex].Release();
eyeTextures[eyeIndex] = null;
}


A test script to try cycling MSAA:
		if(Input.GetKeyDown(KeyCode.J))
{
if(QualitySettings.antiAliasing == 0)
QualitySettings.antiAliasing = 2;
else if(QualitySettings.antiAliasing == 2)
QualitySettings.antiAliasing = 4;
else if(QualitySettings.antiAliasing == 4)
QualitySettings.antiAliasing = 0;

if(OVRManager.display != null)
OVRManager.display.ReconfigureEyeTextures();

Debug.Log("QualitySettings.antiAliasing = " + QualitySettings.antiAliasing.ToString());
}
    This topic has been closed for replies.

    3 replies

    Inspiring
    December 17, 2014
    You're right, we currently don't watch for changes in the AA level (or format or sRGB mode) after start-up. I've filed a bug and we will get this fixed in a future release.

    The changes will probably be similar to what you've shared. Watch out for the timing of the "eyeTextures[eyeIndex].Release()" call. It may not be retiring early enough to trigger the "if (!eyeTextures.IsCreated())" check in UpdateTextures().

    You might also try simply checking if QualitySettings.antiAliasing has changed. If it has, try setting eyeTextures[eyeIndex].antiAliasing to the same value and then call OVR_SetTexture(..).
    drashAuthor
    Inspiring
    December 18, 2014
    Thanks Dave, I appreciate the response.

    I fiddled with this a bit more, and found that a) antiAliasing can't be changed for existing RenderTextures, and b) even with proper Release -> OVR_SetTexture logic when antiAliasing is changed, I'm still getting a black screen. This isn't terribly urgent, just would be nice to give users another way to tweak performance at runtime. I think I'll leave it to Oculus to figure this one out.

    Thanks!
    Titans of Space PLUS for Quest is now available on DrashVR.com
    Up and Coming
    February 19, 2015
    I should be able to change QualitySettings.antiAliasing, then add the Oculus prefab to the scene, and it should work correctly, right?

    I'd like to change the antiAliasing settings for some scenes while leaving others alone.