Up and Coming
August 8, 2014
Scale adjuster to help maintain framerate
- 6 replies
- 2154 views
I have been playing with adjusting the scale of the the render target to maintain frame rate and thought others would find the script helpful. This was discussed in a GDC talk (at about 49 min in) and is working in the Unity integration.
I did have to change the OVRCamera script to make the ScaleRenderTarget work properly. I am not sure if this is mistake or an incomplete implementation that I am hacking. Anyway, first you need to adjust these two lines in OVRCamera.cs
After that just download the scale adjuster and add it as another script on your OVRCameraController in your instance in the scene (this is under the OVRPlayerController with the standard prefab) .
It doesn't work very well for me when running in the editor since it is just a huge judder fest running at 60 fps. When running builds however I get good results on some of my scenes that have more complex areas or certain vantage points where the framerate will drop down below 75fps. This would usually cause all kinds of judder and motion blur would kick in as the low persistence isn't working. Now, everything stays solid and the view gets slightly blurry in these cases. I now have a solid experience throughout the scene and have a solid framerate which makes everything more comfortable.
With my testing getting below a scale of 0.75 starts to get too blurry and becomes uncomfortable. I limit the scale to 0.5. If the performance is so bad and it needs to go below this then the quality level needs to change. I am thinking of incorporating a quality level adjuster into this so that if there is enough time below 0.75 or it is hitting up against 0.5 then the Unity quality level will be bumped down a notch. I don't think that it would make sense to ever adjust it back up. Someone could set what they want/think their system can handle and then it will be adjusted down as they start to play.
I am sure there are better ways to drive the adjustments than the simple approach I made. Please try it out and post any improvements you make. Happy world building!
I did have to change the OVRCamera script to make the ScaleRenderTarget work properly. I am not sure if this is mistake or an incomplete implementation that I am hacking. Anyway, first you need to adjust these two lines in OVRCamera.cs
NeedsSetTexture = NeedsSetTexture || ((CameraController.ScaleRenderTarget != OldScale) || (Screen.fullScreen != wasFullScreen) || OVR_UnityGetModeChange());
to
NeedsSetTexture = NeedsSetTexture || ((Screen.fullScreen != wasFullScreen) || OVR_UnityGetModeChange());
and
OVR_SetTexture(EyeId, CameraTexture[EyeId].GetNativeTexturePtr(), CameraController.ScaleRenderTarget);
to
OVR_SetTexture(EyeId, CameraTexture[EyeId].GetNativeTexturePtr(), 1.0f);
After that just download the scale adjuster and add it as another script on your OVRCameraController in your instance in the scene (this is under the OVRPlayerController with the standard prefab) .
It doesn't work very well for me when running in the editor since it is just a huge judder fest running at 60 fps. When running builds however I get good results on some of my scenes that have more complex areas or certain vantage points where the framerate will drop down below 75fps. This would usually cause all kinds of judder and motion blur would kick in as the low persistence isn't working. Now, everything stays solid and the view gets slightly blurry in these cases. I now have a solid experience throughout the scene and have a solid framerate which makes everything more comfortable.
With my testing getting below a scale of 0.75 starts to get too blurry and becomes uncomfortable. I limit the scale to 0.5. If the performance is so bad and it needs to go below this then the quality level needs to change. I am thinking of incorporating a quality level adjuster into this so that if there is enough time below 0.75 or it is hitting up against 0.5 then the Unity quality level will be bumped down a notch. I don't think that it would make sense to ever adjust it back up. Someone could set what they want/think their system can handle and then it will be adjusted down as they start to play.
I am sure there are better ways to drive the adjustments than the simple approach I made. Please try it out and post any improvements you make. Happy world building!
