Search Unity

Oculus Rift limiting GFX card and increase CPU usage... bug?

Discussion in 'AR/VR (XR) Discussion' started by JDMulti, Feb 5, 2015.

  1. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    At our company we've created several full realtime environment that visualize a huge landschape. Recently we've tried to convert them to Oculus Rift. However we've hit a performance issue that seems to be a limit of the Oculus Rift software or the integration within Unity.

    We use MSI Afterburner to check the graphics card usage. When we run an application with a landschape that has a FPS controller, the gfx card useage is between 90% and 100%. Which seems right to us, since the scene it quite heavy and the computer can handle it perfectly. The cpu usage is about 3% / 5% and the inside application FPS is 60fps or higher.

    When we place a OVRController in the scene and remove the FPS controller and run the exact same application without any modification the MSI Afterburner shows a strange behaviour in gfx useage. The graphics card won't go higher then 35% and the cpu jump to 54%. The fps inside the application ( oculus fps counter spacebar ) it shows us 37fps. Which we find strange, since we have a FPS drop but the gfx card isn't even working hard, it's just sitting almost idle at 37% usage.

    My question is, why is the FPS version working fine and the Oculus Rift version limited in GFX card useage and has more CPU with exact same environment? I would say that the Oculus Rift runs 37fps, then the GFX card would work his ass off, but it's just almost idling and still the Unity application runs slow as hell.

    Could someone shed a light on this?

    Oculus Rift OVR version 0.4.44
    Unity 4.6.1
     
  2. El Maxo

    El Maxo

    Joined:
    May 23, 2013
    Posts:
    177
    I too have run into a similar issue, although I am not using MSI Afterburner, although it is expected to have a drop in frame rate when using the oculus rift.. I have seen some form of limitations imposed upon my GPU when using the OVRController. I have had a scene that with just the first person controller runs around 300 + FPS, but then you bung in a OVRContoller in and you end up struggling to get past 60, on a good day. Have you looked in your profiler to see if there is any infomation.

    If it is possible I would like to compare the GPU profiler screenshot, as I have a large amount of "Other"
     
  3. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    I've included Editor and Build screenshots with MSI Afterburner and CPU useage. All the screenshots render exact same 3D view for FPS as well OVR controller. So all information should be comparable.

    Editor screenshots

    FPS Controller
    https://www.dropbox.com/s/yzhuqud5l3hq8q1/FPS Editor.jpg?dl=0

    Runs steady 70+ fps ( unity fps display )
    GPU usage: 36% ( logical GPU usage, since it can render with ease the full scene )
    CPU usage: 8% ( logical, scene is easy on render and scripts )

    OVR Controller
    https://www.dropbox.com/s/oj9kh2ezrvswu7x/OVR Editor.jpg?dl=0

    Runs steady 59 fps ( unity fps display )
    Run instable 37 / 50 fps ( ovr fps display )
    CPU usage: 26% ( wait what? fps drops but GPU not even fully used, sitting idle nose picking? )
    CPU usage: 16% ( logical, scene render 2x 8% = 16% )

    Build screenshots

    FPS Controller
    https://www.dropbox.com/s/mbq2vetrpfuqbqm/FPS Build.jpg?dl=0

    Runs steady 59.8+ fps ( MSI Afterburner fps display, comparible with Unity Editor FPS )
    GPU usage: 38% ( logical, scene easy to render )
    CPU usage: 4% ( nice, saved 4% on CPU compared with Editor display )


    OVR Controller
    https://www.dropbox.com/s/saxmypgm34646p3/OVR Build.jpg?dl=0

    Runs stable 75+ fps ( MSI Afterburnder fps display )
    Runs instable 35 / 55 fps ( OVR Controller fps display, euh? 75+ fps overal but 37 fps per screen, 75 fps divided by 2?
    GPU usage: 28% ( not logical, scene render 75+ MSI Afterburner fps display, 37 fps per eye, so I hit my GFX card maximum capacity? No not true, because MSI Afterburner shows my GPU useage is 28% and not fully used, but I encounter fps drops? I don't get it )
    CPU usage: 12% ( wait.... 8% for FPS controller Editor, 4% FPS controller Build, so 2x4% would make 8%, but I get 12%? And when I run trough the scene, it increased with wooping 50% usage, I lost track here )


    I wonder if someone can tell me, why the OVR controller displays my scene with 37 fps while my PC has easy doing on render it all. I would understand that my fps was 37 when my pc had hard time rendering it all, but it's now doing nothing and the scene performance is incredible bad. Is this a bug or can the OVR controller not manage it correctly somehow? Doing this on a Laptop makes the difference even worse. On the Laptop I see the Build version CPU usage for FPS at 10% and OVR at 60% while GPU for FPS controller is around 37% and the OVR Controller 25%.

    This is were I lost track for optimizing my 3d scene for the OVR Controller. The FPS controller is as optimized as I can, while the OVR controller just doesn't make scene when I compare the usage of the GPU. I know the OVR controller renders the scene twice, but I don't see twice as much happing on the GPU while I still have fps drops.

    Could someone tell me how I have to read this information and get my scene run smooth with the OVR Controller?
     
  4. El Maxo

    El Maxo

    Joined:
    May 23, 2013
    Posts:
    177
    Thanks you for your screenshots, althought they are a little hard to read clearly due to the size.

    Im sorry to say this, but we are running into slightly different issues, to improve apon the issues that I was having I fiddled about with between using direct x 9 and 11, as 9 made a slight improvement, also try disableding vsync
     
  5. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    Yes I know this issue, I've set all settings as writen down in de Oculus Rift Unity documentation. VSync off ( it automaticly turns of when OVR Controller is enabled ) and DirectX set to 11. This all won't make any difference. I just don't get why I get FPS drops when my machine is hardly working when rendering the scene. It's the Unity Engine in combination with OVR Controller that limits something. I would have peace with it if my PC worked its ass off and the performance was crap. But it isn't doing anything and the scene performance is uber laggy.
     
  6. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    Does anyone know why with OVR Controller the scene has lower FPS count, while my GFX card doesn't even have to work hard? What causes the fact that I can't get my scene run fully smooth while my machine should be able to? I don't understand what is happening here. It's like you buy a car that can drive 300km/h but at 150km/h the engine overheads. So why is it able to run 300km/h while the engine can't? This is the limit I hit here without any clue.

    With a standard FPS controller I can get the scene running as smooth as I want without any drops. With the OVR Controller I really have to limit my whole application by half to be able to run even a little smooth with the Oculus Rift. This all would make sense if my PC hit it's hardware limit, but it just doesn't. Seems the Unity 3D engine together with the Oculus Rift implementation is limited somehow.
     
  7. dell

    dell

    Joined:
    Aug 12, 2008
    Posts:
    24
    I am seeing the exact same behavior as my project sounds just like the one mentioned by JDMulti. Very curious how to get out of the FPS quagmire. I am going to GDC in a few weeks so if we don't have a good answer by then... I can talk to Unity and/or Oculus to see what the problem might be.
     
  8. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    if you find any info make sure to post it here :)
     
  9. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    I'm curious as well. Because not only the VR applications have this issue. I have a realtime environment that is not VR, has huge amount of drawcalls and little fps drop. However the GFX card and CPU aren't both fully used to there maximum. Seams the engine itself is somehow limited, because I would expect only fps drops when gfx card or cpu are hitting there max. Unless the HD Drive it's rotating speed is the limit, but seems unlikely.
     
  10. NerdRageStudios

    NerdRageStudios

    Joined:
    Nov 1, 2013
    Posts:
    167
    I am seeing a similar issue here too. My scene when using a normal camera and looking at the whole scene in view uses 700(ish) draw calls, cpu 0.5ms, 0.6ms render time and maximum FPS. When I use the OVR camera, my draw calls double (assume this is the two cameras) but my CPU and GPU times jump to 16 - 18ms and my FPS drop considerably. It seems that there is a huge overhead on the CPU and GPU when using the OVR camera, and considering it causes a drop in frames on mine and I have a top end I7 CPU and GTX980 OC tells me that there is some optimisation still needed in the Oculus drivers and integration package.

    As it stands, when my levels are fully fleshed out, I doubt my game will even run in the OR without a serious amount of reduction in draw distance.
     
  11. HalversonS

    HalversonS

    Joined:
    Jan 24, 2014
    Posts:
    28
    Guess he didn't get a chance to talk to them at GDC... seeing it's well passed.

    I'm having similar issues. It appears while running Oculus display the FPS is halved if the scene FPS were to drop below ~75. As soon as I hit anything below ~75 FPS it drops right to ~37 in the build. However, in the unity editor (with both cameras rendering everything as is) where it drops to ~37 in the build, it only drops to 60 FPS.

    I'd like to at least maintain the 60 FPS during the build, as the judder becomes quite discombobulating for others... Not sure why it's being halved.
     
  12. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    Same here. It's always 75 or 37. When it's at 37, sometimes I can look up at the sky to raise it to 75, then look back down and it will stay at 75. Something's not right somewhere.

    In another thread one of the Unity staff was saying they have more fixes and stuff coming for the Rift, so I would bet this is something they're aware of and will fix eventually.
     
  13. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    I think the same, they told about optimizing unity for VR. But it would be just for great help to reply that what we see happening is indeed something related to that optimizing issue. Then I would have peace with it until it's done, but now I'm hitting my head against the desk for not knowing it and thinking it's my fault.
     
  14. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    For what it's worth, a couple days ago when I was doing some tinkering with tree details I found one combination that ran at 37 fps the first few times I ran the built version. On the fourth or fifth try it ran 75 fps. So yeah, the more I look the more I think there's just some little timing hiccup bug somewhere in there that's causing this.

    Also in the preview mode it'll run a solid 60 all the time with both the regular preview and the Rift preview which is laid on top of it. Fraps reports 120 but maybe that's because of the double rendering. Run it in the Rift in built mode and it's 37 or 75.

    There seem to be a lot of other people reporting the same thing, so I imagine they're aware of it and will iron it out eventually. Still though, I too feel a little anxiety in the meantime not knowing for sure. It's a bit tough to set scenes up not really knowing what the framerate will be in the end.

    I don't recall this happening in Unity 4, seems it's probably a new thing with Unity 5 for whatever reason.
     
  15. Welby2

    Welby2

    Joined:
    Feb 5, 2014
    Posts:
    33
    Ok i need to say i've the same issue..

    However... the oculus rift has some builted-in vsync in software.. so you can't disable it in the build...

    The main reason why we have 37fps fps (usually also 37.5fps) is because if you drops down 74-73 fps the vsync istantly cut the half of the current fps to continue to get them stable... However if i'm correctly that's something happen only in Direct Mode,instead in Extended Mode it should just drops below 75fps and nothing more.. i guess that the builted-in vsync is off in extended mode or something..

    However i'm hoping for some HEAVY optimization in the next updates of Unity 5.
     
  16. El Maxo

    El Maxo

    Joined:
    May 23, 2013
    Posts:
    177
    As I said you can temp disable this in the player, you can do this by disableing vsync when you have it running in the editor, this could help you see how well your project can "work" without the vsync. althought this only workis in the editor.
     
  17. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
  18. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
  19. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    150
    I'm in the same situation as JDMulti, but using Unity 5.1.2f1, and the unity built in VR Support (checking the Virtual Reality Supported box in the Player settings).

    The best I can run my scene is while having my devkit 2 running in Extended mode. It does not drop from 75fps straight to 35fps, but it becomes jittery if fps drop <74.

    The problem is of course that my GPU is running at ~35% regardless of how much the oculus build is struggling.


    Have any of you managed to solve your issues in the meantime?
     
  20. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    My performance has improved dramatically in the meantime just due to Unity updates since last April when I wrote that last post. I'm even able to run a realtime reflection probe now which I wasn't ever really expecting to be able to do. Before I couldn't run even a baked probe. More performance is always welcome of course, but I'm quite pleased with how it's running now.
     
  21. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    Anything below that 75 is going to get shakes and jitters because of the time warping stuff in the Rift which reduces latency so much. Keep in mind that for the commercial version you'll need 90, not 75.

    What frame rate are you getting on a regular monitor?
     
  22. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    150
    That's interesting.

    I'm getting 280fps to 350fps without VR/oculus. GPU probe says it's at ~14%.
    I'm getting 40-63fps on average while using VR/Oculus. The CPU wait for oculus is at 60%. GPU is at ~35%

    My game isn't cpu bound, I have a 3.5ghz i7 and a gtx770.
     
  23. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    Ok, that sounds like you've probably got too many cameras in the scene. Get rid of the OVRPlayerController and instead just make an empty game object with a regular camera on it.
     
  24. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    150
    No, I checked, I have one bare camera.

    I just noticed that if I do a stress test by increasing the amount of geometry and lights in the scene, and run it without VR, the GPU will still never go above 40% (and the vram stays at under 2.5gb (out of 4gb)) even though the scene starts to lag (go down to ~28fps).
    Similar behaviour both in Deferred and in Forward rendering.

    I see that JDMulti had a similar observation with regards to GPU %. I used GPU-Z to check this.

    I guess I just have to debug further. There have to be some bottlenecks like number of light sources, GI calculations, cutout foilage shaders etc. (I even turned off shadows)

    The weird thing I keep seeing is that the Camera.Render in the Profiler is at 75% under CPU usage (and according to task manager it uses all 8 cpu "cores"), and at 23% under GPU Usage. o_O

    Since when does rendering use so much CPU? (I'm not even moving the light sources/sun; when I do, it's slower)
    My game uses 0 cpu apart from a standard FPS character controller.
     
    Last edited: Aug 19, 2015
  25. wano987

    wano987

    Joined:
    Dec 9, 2016
    Posts:
    1
    Well, as on 5.4.0f3, the issue is still with us.

    Is anyone have a solution or even dirty hack trough hex-editors?