Search Unity

Frame rate issues with StandardFast and Mobile/Diffuse shaders

Discussion in 'VR' started by trzy, Aug 13, 2016.

  1. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    Hi,

    I've seen variants of this question posted before but I've never quite found a satisfactory answer to the problem of low frame rates when viewing simple geometry. In my app, which consists of a single low poly count helicopter model, the frame rate dips from 60 to 30 FPS whenever the helicopter is in view and within a few meters of the user.

    Some things I've tried:

    1. SetFocalPointForFrame() -- some of the jitter I was experiencing was simply an image stabilization issue. Profiling with the HoloLens web-based performance monitor confirms that the frame rate is still low, though (and it is very perceptible).

    2. Use the HoloToolkit shaders. Doesn't seem to make a perceptible difference.

    3. Disable shadows (receiving, casting) and motion vectors. No effect on performance.

    4. Try the Mobile/Diffuse shader. No effect.

    I'm at a loss as to what could be causing this. The helicopter consists of a rigged mesh and a rigidbody. I have spatial perception for occlusion enabled but this doesn't seem to have a discernible impact on performance.

    My project is accessible at github:

    git clone https://github.com/trzy/hololens

    You'll have to build and deploy the main scene (I didn't check in the generated App files). I use the recommended settings with "Fastest" quality.

    Thank you,

    Bart
     
  2. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    Attached are some results from the Unity profiler. I'm not pushing much geometry, as we can see here. Looks like the bulk of time is spent waiting for the GPU to finish. "Device.Present" occupies most of the time. Does anyone know what this is doing? Additionally, RenderTexture.ResolveAA is taking a considerable amount of time (23%) as well.

    prof1.jpg prof2.jpg prof3.jpg
     
  3. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    Also, I forgot to point out that the frame rate appears to recover if the object is far from the camera, regardless of shaders used. It's not quite a binary 60 vs. 30FPS but nearly so. Beyond a few meters, the frame rate appears to recover to 60FPS when in view, with occasional hiccups. Looking away also causes the frame rate to recover immediately.

    Fill rate related? Not sure why this mesh would cause any particular difficulty.
     
  4. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    Today I tried displaying my mesh with Direct3D (using the spinning cube template project). Runs without a hitch. Obviously, this is a vastly lighter-weight rendering process with very simple shaders, but given that I'm rendering only that single model in Unity, the complexity should not be too different.

    No one else has experienced this issue in Unity?
     
  5. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    Some further investigation reveals multiple possible culprits. It seems others are having trouble with any shaders more complex than unlit or vertex lit. Has anyone gotten StandardFast to work?

    Also, the Spatial Mapping Renderer component (used for occlusion) and, possibly, coroutines that move the position of the object, seem to trigger performance degradation as well.

    Maybe something the Unity developers can comment on/investigate? This last few posts in this thread have more information (at least a couple other users I've spoken to have encountered similar performance degradation): http://forums.hololens.com/discussion/1968/30fps-performance-with-simple-meshes-in-unity#latest
     
  6. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Hello,

    Can you try setting your quality settings to fastest? See if that makes a difference in performance.

    Thank you,
    Wesley
     
  7. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    Hi Wesley,

    The quality settings are already at Fastest. I've also tried explicitly disabling all lighting features that would require multiple passes (although my understanding is that Fastest should already ignore those). Nothing changes.

    Other users have mentioned similar issues (see the MS HoloLens Q&A forum, for instance). Might it make sense for me to bundle the project up in a zip file and upload it? It can also be pulled via Github (link in my original post).

    What is especially unusual is the way the degradation seems linked to motion of game objecting and moving the camera close (to within the clip distance). Also, occlusion seems to hinder performance as well. I've posted another thread about occlusion and I'll try the suggestions there but those suggestions have to do with obtaining the spatial mesh in a more intelligent manner. I think that the bottleneck in my case is actually rendering them using the occlusion shader.

    Thanks,

    Bart
     
  8. shouchard

    shouchard

    Unity Technologies

    Joined:
    Mar 29, 2016
    Posts:
    10
    If you're still seeing this issue, file a bug and we'll get it to our graphics folks. If you've got the time, building a minimal repro case to file with your bug would help us narrow things down.
     
    Hodgson_SDAS likes this.
  9. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,092
    Keep in mind that the "StandardFast" shader is the Standard Unity shader but optimized...
    The HoloToolkit provides the Unlit, Vertexlit, Lambert and Phong.
    You could almost say that the standardfast shader is comparable to the phong shader which is heavy and undesirable.

    You will most likely be using the Unlit shader and vertexlit shader.

    I downloaded the repository and I've noticed the project had quite some wrong settings.
    Using Unity 5.4.0f3-HTP
    Player Settings:
    Graphics jobs is experimental, I don't use it myself so turned it off
    Use 16-bit depth buffers should be turned on
    You may or may not want to use Single-Pass Stereo rendering
    Also changed some permissions but that shouldn't affect performance too much unless something is spam calling while it has no permission I guess?

    Another thing is you are drawing the spatial mapping mesh, this takes quite some performance as well which you kind of don't want to
    Normally you want to program the game / app to scan once and then turn off drawing the spatial mapping mesh to save rendering power.

    I had to delete the builder window of the holotoolkit cause for some reason it was erroring and I didn't want to spend too much time on figuring out why.
    but thats a side problem with the repository..
    also some dll was marked as ARM which isn't supported by the hololens because the hololens uses a X86 intel processor.
    Hence the reason you have to build the visual studio project with X86, release

    I have no clue why you have 2 cursors but ok whatever doesn't affect performance much.

    with the settings that I use, the project is pretty much 60 FPS no problem.
    so turned off the spatial mapping drawing.
    changed some settings in the player settings
    turned off audio listener and source (because I didn't want sound but thats just personal as I only wanted to test this repo for performance not sound)

    I hope this helped you a bit :)