Forum Discussion
drash
11 years agoHeroic Explorer
[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()):
Calling new method at bottom of OVRDisplay() in place of the old logic:
In ConfigureEyeTexture(), inserted the following just prior to newing up the RenderTextures:
A test script to try cycling MSAA:
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());
}
3 Replies
Replies have been turned off for this discussion
- vrdavebOculus StaffYou'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(..). - drashHeroic ExplorerThanks 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! - jamesjExplorerI 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.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 4 years ago
- 1 month ago