Search Unity

Very poor performance in Unity 5.6.0f3 with simple scenes (20k triangles)

Discussion in 'VR' started by trzy, May 9, 2017.

  1. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    Hi,

    I've consistently been having performance issues for some time now and have never been able to solve them. Now I'm at a point where I would like to resolve them in order to publish an app.

    Right now, I've got a simple scene consisting of only a few objects but with spatial understanding meshes being used for occlusion. Only three materials and two shaders are used in my program: HoloToolkit/Occlusion and HoloToolkit/Vertex Lit Configurable.

    Quality settings are all at Fastest.

    I'm using Static Batching for spatial understanding meshes (once the scanning process is completed by the user).

    Single pass stereo rendering is enabled.

    And yet, frame rates rarely hit 60 FPS unless I am very close to a wall and nearly everything is outside the view frustum.

    Profiling on the actual device reveals that most of the time is spent by the CPU waiting on the GPU, and the GPU profiler does not indicate anything unusual (see the included image).

    I'm really at a loss here. With such low geometry counts, it should be trivial to hit 60 FPS. What could Unity possibly be doing? One thing I've noticed is that the frame rate dips noticeably as soon as an object comes into view (despite spatial understanding meshes always being visible). For example, I place two simple cubes around the room and as I turn my head and they enter the frustum, the FPS drops noticeably as observed from the web-based performance tracker.

    Thanks,

    Bart

    P.S. I'm happy to share the project files if anyone is interested in taking a look.

    prof.jpg
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you actually click on the CPU usage part so we could see what's taking up the time?
     
  3. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    I'll post a detailed screenshot later this evening (away from my dev PC now) but I do recall the CPU is stuck in VR.DeviceSDK/HoloLensWaitForGPU or something like that. More 50-60% of the time was spent there and the next nearest was physics, occasionally at 10%.

    The project files are at http://trzy.org/tmp/Game-Crane2.zip

    In the editor, WASD can be used to move around (to initially map the space) and then Enter (air tap) to stop scanning and switch to occlusion and static batching. A couple of cubes are then placed.

    When I build and deploy, I edit the manifest XML and change "Windows.Universal" to "Windows.Holographic" as early build instructions from 2016 instructed but I'm not sure if this is still necessary.
     
  4. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    As requested, further profiling information, taken from angles where the geometry count is high (but is this really the culprit?).

    prof_cpu.jpg prof_gpu.jpg
     
  5. derdimi

    derdimi

    Joined:
    Mar 6, 2017
    Posts:
    33
    I have the same problem when rendering Unity UI, especially with Scroll Views. Did you find any solution?
     
  6. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    I did. Go to your Main Camera and disable HDR as well as MSAA (which should already be disabled). I presume that HDR involves a post-processing phase or employs the use of a floating point frame buffer. Either way, HoloLens doesn't seem to like it. You should see a performance boost in your applications. I still suffer from some slowdowns that are related to spatial meshes and other features of my scenes, but the HDR setting was affecting performance even when those were not being rendered.
     
  7. derdimi

    derdimi

    Joined:
    Mar 6, 2017
    Posts:
    33
    Thanks for your response. Unfortunately, I already have HDR disabled.