Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
gunair's avatar
gunair
Explorer
11 years ago

Frame rate too high = judder! How to force only 75 frames???

Hello from Germany.

I have an unusual problem. I worked hard in the last weeks to optimize the performance of my demo scene to get 75 frames. Now I was nearly successfull - the judder is nearly gone. But now, in some areas of the scene (I'm flying through) the performance is too good - I get frame rates up to 100 and above. Equal to a frame rate below 75, the Rift reacts with judder. So my question:

How can I force Unity or the Rift (or the Nvidia GPU) to show only 75 frames, even if there is enough performance to do more???

Thanks in advance!

Greets, Gunair

3 Replies

Replies have been turned off for this discussion
  • Proton's avatar
    Proton
    Honored Guest
    I get best results in DX11
    Edit > Project Settings > Player
    > Other Settings
    > Use Direct3D 11

    The Oculus driver seems to handle VSync. So you can use code like this to turn it on and off:
                     if (OVRDevice.HMD != null) {
    uint caps = OVRDevice.HMD.GetEnabledCaps();
    if (!useVsync)
    caps |= (uint)OVR.ovrHmdCaps.ovrHmdCap_NoVSync;
    else
    caps &= ~(uint)OVR.ovrHmdCaps.ovrHmdCap_NoVSync;

    OVRDevice.HMD.SetEnabledCaps(caps);
    }


    In DX9 mode, you could try going into:
    Edit > Project Settings > Quality
    Then for each Quality level you use, change VSync Count to Every VBlank. I think DX11 ignores it, not sure if DX9 uses it.
  • DX9 doesn't ignore the vsync, I had a weird problem with the frame rate being too high in directx9 it would get so hign in some cases (300fps) that it would throw off the Time.deltatime based calcualtions. I put the vblank every frame option on and it solved the problem.
  • "Proton" wrote:
    I get best results in DX11
    Edit > Project Settings > Player
    > Other Settings
    > Use Direct3D 11

    The Oculus driver seems to handle VSync. So you can use code like this to turn it on and off:
                     if (OVRDevice.HMD != null) {
    uint caps = OVRDevice.HMD.GetEnabledCaps();
    if (!useVsync)
    caps |= (uint)OVR.ovrHmdCaps.ovrHmdCap_NoVSync;
    else
    caps &= ~(uint)OVR.ovrHmdCaps.ovrHmdCap_NoVSync;

    OVRDevice.HMD.SetEnabledCaps(caps);
    }



    Thank you Proton! You've saved me twice in one day with these tips. Really appreciate it.

    When I use the above Unity loses its mind. I've probably implemented it incorrectly, but curious as to how it should be used as I'm not familiar with C#. Right now I'm defining a public class and using this in the start area, but that isn't working for me.

    And can confirm with Molton that DX9 requires every VBlank as well for best performance.