Search Unity

Unity Forcing on Vsync For Oculus Rift

Discussion in 'AR/VR (XR) Discussion' started by El Maxo, Jan 14, 2015.

  1. El Maxo

    El Maxo

    Joined:
    May 23, 2013
    Posts:
    177
    Hi everyone

    I am currently building a project for the oculus rift and Have come in to a issue. The oculus wants a FPS of 75+ where at the moment I am being forced to 60 FPS due to VSync. In the Quality Settings I have turned it off, but eveytime I press play, or build it, in enables VSync. (I know the game can run on more frames since you can disable vsync in playmode)

    I have tryed looking at this thread : http://www.reddit.com/r/oculus/comments/28cqk0/patch_tool_to_force_vsync_off_in_any_rift_app/
    but to no luck as his "patch" didnt work with my unity work.

    I would be very greatful if somebody could help me with this issue.


    Thanks

    Max
     
  2. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    Which version of Unity and which version of Oculus Plugin are you using? Also which renderer (DX11, DX9, OpenGL)? If windows, are you in Direct or Extended mode for the HMD?

    These are all of the variables that can break Vsync, first make sure you are on latest patch release of unity, and latest Oculus runtime + unity integration. If you're on windows, try DX11 + Direct mode.
     
  3. El Maxo

    El Maxo

    Joined:
    May 23, 2013
    Posts:
    177
    Thanks, I will try doing the steps as you said.

    I am currently Using Unity 5 Beta and the most recent Oculus Plugin, Using DX9 as I have had some issues with DX11, and I am running on direct mode.
     
  4. El Maxo

    El Maxo

    Joined:
    May 23, 2013
    Posts:
    177
    It could be a build issue as well, just tryed building int, where it runs at 80 plus FPS in Unity, it runs about 20ish FPS on its own build.
     
  5. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    I had this confusing also with the quality settings. The Oculus Rift documentation told me to set Every VBlank and 4x Anti-Aliasing in the quality settings. But as soon I ran the scene in the editor, the oculus forces VSync and turns off the 4x AA. I was confused, tried to force in all ways the quality settings as written down in the PDF but without luck. After all, building and testing the application directly on the rift itself, gave no problems and had AA. Why this is made that way.... no idea so I ignored the quality settings in the editor in play mode.

    Also I found out, you need DirectX 11 set in the build settings. If you don't, you will run into problems of which 1 is performance, camera stuttering and really bad Anti-Aliasing. Probebly, the DirectX 9 mode is your issue here.
     
  6. El Maxo

    El Maxo

    Joined:
    May 23, 2013
    Posts:
    177
    direct x 11 is the way I have gone, but my frame rate is now suffering alot
     
  7. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    Had the same with a couple of huge scenes. I had to go trough them and create a couple of custom scripts to hard camera clip objects with culling layers, optimize objects and so on. Since the scene is rendered twice instead of once, you have to reduce some quality. =(
     
  8. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    I seem to be having similar problems. I'm running Windows with Unity Beta 5 RC1. This is the first time I've seen the Rift fps go above 60. It's now capped at 75 for some reason and occasionally dumps down to half that (37) and stays there. If I switch back and forth between a scene once, the first time I go in it'll be 75. When I return to that scene it'll be exactly 37. With fantastic quality setting it drops down to the low 20's even though without the Rift the scene is something like 200 or 300 (I forget exactly now).

    I would expect a hit from Rift because it's rendering everything twice and doing all that distortion and fancy stuff, but something doesn't smell right here about this where the Rift sometimes is only around 10% FPS at times.

    I'm running Rift DK2 with 0.4.4 beta and firmware 2.12 in direct mode, my Unity app is in DX 11 mode. I'm not sure how much or which parts of this might be down to Unity verus Oculus, so I'm not sure whether I should be asking these types of questions here or in the Oculus forum. Ideas either way would be appreciated. It's tough to know whether I need to seriously cut back on my graphics or not. This difference between Rift and non-Rift appears excessive though at this point.

    I could be wrong, but the fact that it snaps to exactly half the 75Hz and gets stuck there suggests to me something isn't right somewhere. Any thoughts?

    I also can't seem to get vsynch to actually turn off on the Rift. I'd like to see numbers beyond 75Hz so I know how much room is left to play with graphics details yet.
     
  9. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    Altrough I'm not using Unity 5, I have also strange issues in Unity 4.x. An scene that is optimized to run just fine in First Person Mode, runs totally crap When checking out with the OVR Controller. The funny stuff is, that the GFX card in my machine is just having easy time rendering it all and not to mention my CPU it not even hitting the 20% useage and my total ram is about 32 GB of which not even 1GB is used. But in VR mode, the fps drops to about half.

    I don't know the exact tech behind VR, but it can't be possible that FPS drops a lot when a machine is not even hitting it's max capacity. I think it's a Unity limitation since nothing is optimized for VR. Even when your application runs 1k fps in First person, it will run 35fps in VR mode unless you reduce all objects and vertex count to a number where the Unity Engine can handle it. Your machine it not even the limit, the engine is as far as I know.

    A thread I started last week and haven't heard a think what causes this strange behaviour.
    http://forum.unity3d.com/threads/oculus-rift-limiting-gfx-card-and-increase-cpu-usage-bug.296092/
     
  10. El Maxo

    El Maxo

    Joined:
    May 23, 2013
    Posts:
    177
    yeah I have had this issue for a while now, I have had minor susses at time by running the game in dirext x 9 and then you can disable vsync when its running, then you can see your framerate fly high. but it wont let you build like that, as you will have a large amount of frame jutter. My best advice, which sounds bad, is we just have to wait till it gets better. I have had to shelf most of the stuff I have been doing with the rift as there isnt much support from either oculus or unity with matters like this.
     
  11. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    I just realized yesterday that turning off shadows puts it at 75 fps easily, so I'm not sunk. This is a boat sim I'm doing so shadows aren't really too important anyway. I guess we'll just have to wait to see what comes from Unity and friends if it's out of our hands.