Search Unity

Hybrid Renderer 0.8.0 - Suddenly much slower

Discussion in 'Graphics for ECS' started by Thygrrr, Mar 15, 2020.

  1. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    I have a scene that ran very well optimized at 400+ fps both in edit mode as well as in play mode.

    Now in play mode it is still at 2.3 ms per frame, but in play mode, frame times are in the high thirties, and it is proportional to the amount of geometry in the scene, but not to the amount of geometry in the view frustum(s).

    Also, the HybridRenderer rendered Meshes cause an insane amount of draw calls in Render Main Shadowmap
    upload_2020-3-15_22-20-21.png
    but lighting and shadows are independent from this massive, massive performance drop.

    The performance changed a few days back after I update packages, and I thought maybe it is a transient bug, but it basically breaks my game ;-)

    Any suggestions where I could look would be appreciated. It's not instancing, and the materials stayed practically the same, ... this is with Universal Render Pipeline, of course.
     
    Last edited: Mar 15, 2020
  2. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    Reducing shadow cascades reduces this figure, but it worked well with 2 or 4 shadow cascades before.
     
  3. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    Ok, so I initially wondered why there are an additional 27ms added to every frame. Now I turned off the shadow casting light... and I get this:

    upload_2020-3-15_22-33-38.png

    but at the same time still this:
    upload_2020-3-15_22-33-49.png
     
  4. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    The slowdown scales with the number of meshes I have. It is independent of postprocessing .

    The meshes don't have a lot of geometry, really. The "saved by batching" number being negative is kind of weird, though. A week or so ago, it was more like this (in my performance test scene)



    (sorry for potato quality, had to snip this from my social media history)
     
    Last edited: Mar 15, 2020
  5. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    Hello @Thygrrr,
    sorry it's not related to your Thread, but im facing a weird Bug with Hybrid Renderer V2 (Entities 0.8) and it looks like you solved it.

    this is how i added the Hybred Renderer V2 to my Project:

    1) i downloaded the full project from Github.

    2) i copied com.unity.render-pipelines.core, com.unity.render-pipelines.universal, com.unity.shadergraph, com.unity.testframework.graphics in the Packages Folder.

    3) i modified the manifest.json :

    Code (CSharp):
    1. {
    2.   "dependencies": {
    3.     "com.unity.collab-proxy": "1.3.7",
    4.     "com.unity.collections": "0.7.0-preview.2",
    5.     "com.unity.entities": "0.8.0-preview.8",
    6.     "com.unity.formats.fbx": "2.0.3-preview.3",
    7.     "com.unity.ide.visualstudio": "2.0.0",
    8.     "com.unity.ide.vscode": "1.1.4",
    9.     "com.unity.physics": "0.3.0-preview.1",
    10.     "com.unity.render-pipelines.core": "file:../../../com.unity.render-pipelines.core",
    11.     "com.unity.render-pipelines.universal": "file:../../../com.unity.render-pipelines.universal",
    12.     "com.unity.rendering.hybrid": "0.4.0-preview.8",
    13.     "com.unity.shadergraph": "file:../../../com.unity.shadergraph",
    14.     "com.unity.test-framework": "1.1.11",
    15.     "com.unity.testframework.graphics": "file:../../../com.unity.testframework.graphics",
    16.     "com.unity.textmeshpro": "3.0.0-preview.1",
    17.     "com.unity.timeline": "1.2.12",
    18.     "com.unity.modules.ai": "1.0.0",
    19.     "com.unity.modules.androidjni": "1.0.0",
    20.     "com.unity.modules.animation": "1.0.0",
    21.     "com.unity.modules.assetbundle": "1.0.0",
    22.     "com.unity.modules.audio": "1.0.0",
    23.     "com.unity.modules.cloth": "1.0.0",
    24.     "com.unity.modules.director": "1.0.0",
    25.     "com.unity.modules.imageconversion": "1.0.0",
    26.     "com.unity.modules.imgui": "1.0.0",
    27.     "com.unity.modules.jsonserialize": "1.0.0",
    28.     "com.unity.modules.particlesystem": "1.0.0",
    29.     "com.unity.modules.physics": "1.0.0",
    30.     "com.unity.modules.physics2d": "1.0.0",
    31.     "com.unity.modules.screencapture": "1.0.0",
    32.     "com.unity.modules.terrain": "1.0.0",
    33.     "com.unity.modules.terrainphysics": "1.0.0",
    34.     "com.unity.modules.tilemap": "1.0.0",
    35.     "com.unity.modules.ui": "1.0.0",
    36.     "com.unity.modules.uielements": "1.0.0",
    37.     "com.unity.modules.umbra": "1.0.0",
    38.     "com.unity.modules.unityanalytics": "1.0.0",
    39.     "com.unity.modules.unitywebrequest": "1.0.0",
    40.     "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    41.     "com.unity.modules.unitywebrequestaudio": "1.0.0",
    42.     "com.unity.modules.unitywebrequesttexture": "1.0.0",
    43.     "com.unity.modules.unitywebrequestwww": "1.0.0",
    44.     "com.unity.modules.vehicles": "1.0.0",
    45.     "com.unity.modules.video": "1.0.0",
    46.     "com.unity.modules.wind": "1.0.0"
    47.   }
    48. }
    when i add the ENABLE_HYBRID_RENDERER_V2 to the scripting defined symbols nothing is rendered anymore, but by removing it, the Old RendererSystemV2 is rendering Correctly.

    im using the Unity 2020.1.0b1.

    Did I do something wrong ?
    Thanks!
     
  6. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    I use Unity 2020.1.0b1 as well,and I just add all the packages through the package manager.

    Here is my packages manifest:

    Code (CSharp):
    1.   GNU nano 4.5                                                                                                                                                   Packages/manifest.json
    2. {
    3.   "dependencies": {
    4.     "com.unity.burst": "1.3.0-preview.6",
    5.     "com.unity.inputsystem": "1.0.0-preview.6",
    6.     "com.unity.jobs": "0.2.7-preview.11",
    7.     "com.unity.physics": "0.3.0-preview.1",
    8.     "com.unity.render-pipelines.universal": "8.0.1",
    9.     "com.unity.rendering.hybrid": "0.4.0-preview.8",
    10.     "com.unity.textmeshpro": "3.0.0-preview.7",
    11.     "com.unity.ugui": "1.0.0",
    12.     "com.unity.modules.ai": "1.0.0",
    13.     "com.unity.modules.androidjni": "1.0.0",
    14.     "com.unity.modules.animation": "1.0.0",
    15.     "com.unity.modules.assetbundle": "1.0.0",
    16.     "com.unity.modules.audio": "1.0.0",
    17.     "com.unity.modules.cloth": "1.0.0",
    18.     "com.unity.modules.director": "1.0.0",
    19.     "com.unity.modules.imageconversion": "1.0.0",
    20.     "com.unity.modules.imgui": "1.0.0",
    21.     "com.unity.modules.jsonserialize": "1.0.0",
    22.     "com.unity.modules.particlesystem": "1.0.0",
    23.     "com.unity.modules.physics": "1.0.0",
    24.     "com.unity.modules.physics2d": "1.0.0",
    25.     "com.unity.modules.screencapture": "1.0.0",
    26.     "com.unity.modules.terrain": "1.0.0",
    27.     "com.unity.modules.terrainphysics": "1.0.0",
    28.     "com.unity.modules.tilemap": "1.0.0",
    29.     "com.unity.modules.ui": "1.0.0",
    30.     "com.unity.modules.uielements": "1.0.0",
    31.     "com.unity.modules.umbra": "1.0.0",
    32.     "com.unity.modules.unityanalytics": "1.0.0",
    33.     "com.unity.modules.unitywebrequest": "1.0.0",
    34.     "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    35.     "com.unity.modules.unitywebrequestaudio": "1.0.0",
    36.     "com.unity.modules.unitywebrequesttexture": "1.0.0",
    37.     "com.unity.modules.unitywebrequestwww": "1.0.0",
    38.     "com.unity.modules.vehicles": "1.0.0",
    39.     "com.unity.modules.video": "1.0.0",
    40.     "com.unity.modules.vr": "1.0.0",
    41.     "com.unity.modules.wind": "1.0.0",
    42.     "com.unity.modules.xr": "1.0.0"
    43.   }
    44. }
     
  7. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    When I add that scripting define you describe, I get this compile error:
    Code (CSharp):
    1. Library\PackageCache\com.unity.rendering.hybrid@0.4.0-preview.8\Unity.Rendering.Hybrid\CopySkinnedEntityDataToRenderEntity.cs(16,26): error CS0246: The type or namespace name 'RenderMeshSystemV2' could not be found (are you missing a using directive or an assembly reference?
     
  8. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    ah ok, you are not using the Hybred Renderer V2, for this you need to add the "com.unity.render-pipelines.universal": "9.0.0" which is not released yet, it need be copied from Github.

    that's why you have this problem:
     
  9. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    The problem is this -
    Code (CSharp):
    1. #if ENABLE_HYBRID_RENDERER_V2 && UNITY_2020_1_OR_NEWER && (HDRP_9_0_0_OR_NEWER || URP_9_0_0_OR_NEWER)
    These 9_0_0 defines aren't what I'm using. I'm using 8.
     
  10. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    Yeah. I want to use 0.8.0 and am struggling with this.

    The performance was great with 0.6 and 0.7. I don't need a hypothetical performance boost. I also feel I'm bleeding edge enough as it is.

    And I don't even see a 0.9.0 tag on github...
     
  11. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    this Condition require ENABLE_HYBRID_RENDERER_V2 which require the URP 9.0.0 or HDRP 9.0.0. but you are in a lower version.
     
  12. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    Yeah I don't want to use that right now. :)
     
    Opeth001 likes this.
  13. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    i hope they will fix everything before the Entities 1.0 (we are not that far), for the current Entities Package Version (0.8) it looks like they didnt even tested it with the Android platform. by switching to it you get a Compile Error in the Entities Package XD.
     
    lclemens likes this.
  14. TLRMatthew

    TLRMatthew

    Joined:
    Apr 10, 2019
    Posts:
    65
    Opeth001 likes this.
  15. SebastianAaltonen

    SebastianAaltonen

    Unity Technologies

    Joined:
    Feb 21, 2020
    Posts:
    112
    The documentation we shipped with 0.4.0 was outdated. I am trying to resolve this issue ASAP.

    IMPORTANT Hybrid Renderer V2 info:
    • You need Unity 2020.1b3. This version has not yet shipped!
    • SRP 9.0.0-preview is required. This package is not yet shipped!
    • SRP: Alternative you can use SRP master branch.
    If you don't have all these requirements, the graphics rendering will be broken or extremely slow. Or both.
     
  16. SebastianAaltonen

    SebastianAaltonen

    Unity Technologies

    Joined:
    Feb 21, 2020
    Posts:
    112
    Regarding to the shadow map slow down:

    We fixed a bug with culling (entities missing far away from camera). This fix revealed a yet unknown bug in the shadow map culling. The result seems to be shadow flickering and performance issues in some scenes. We are investigating why this happens. This bug is likely related to spot light shadow flickering bug that has always been there. We will investigate both issues and try to implement a fix ASAP.
     
    lclemens, hippocoder and thelebaron like this.
  17. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    I don't use Hybrid V2.

    V1 has become extremely slow, so thank you very much for the clarification.

    I see no problems with shadows in my scene (other than them not getting culled right).
     
  18. SebastianAaltonen

    SebastianAaltonen

    Unity Technologies

    Joined:
    Feb 21, 2020
    Posts:
    112
    Yes. The culling issue affects both Hybrid V1 and Hybrid V2. We have two engineers working on solving it ASAP. Both the performance is sub-optimal and the result is incorrect. This is an existing old bug, but recent changes make it visible in more cases.
     
  19. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    The strange part is, my performance test showed most contents of the scene. :) A single model which I was able to render 1000x @ 60fps now eats 20 ms. :)

    I'll wait for the update. Maybe I'll downgrade to Unity 2019.
     
  20. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Hello! I tried to to reproduce this performance issue using our internal test scenes, and I wasn't able to reproduce it, so probably some specific circumstances are required for it to happen.

    Could I ask you to report a bug (Help > Report a Bug), ideally with a repro case? This would make it a lot easier for us to look at this issue in detail and fix it.
     
    Opeth001 likes this.
  21. WildMaN

    WildMaN

    Joined:
    Jan 24, 2013
    Posts:
    128
    Any update on this guys?
     
    Opeth001 likes this.
  22. SebastianAaltonen

    SebastianAaltonen

    Unity Technologies

    Joined:
    Feb 21, 2020
    Posts:
    112
    We implemented tight bounds calculation for hybrid renderer batches. This should result in optimal bounds. However we have only been able to reproduce visual issues and performance defects based on the bounds with built-in renderer. URP has their own shadow cascade bounds calculation code that doesn't depend on the bounds of DOTS batches.

    This fix should be in hybrid.renderer 0.4.1 package. If you are still seeing this performance issue with this package, please file a bug report with a small repro project, so we can start investigating the issue.
     
    hippocoder likes this.