Search Unity

  1. We have added a sub-forum for DOTS Graphics. Please use the new space for related discussions.
    Dismiss Notice
  2. The 2021.2 beta is now available. To find out what's new, have a look at our 2021.2 beta blog post.
    Dismiss Notice
  3. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  4. Dismiss Notice

Unity Hybrid Renderer V2 (0.4.0)

Discussion in 'DOTS Graphics' started by SebastianAaltonen, Mar 16, 2020.

Thread Status:
Not open for further replies.
  1. AlexHolderDev

    AlexHolderDev

    Joined:
    Jul 2, 2014
    Posts:
    21
    I've made a ticket/case for this now too, case 1313303.
     
  2. Srokaaa

    Srokaaa

    Joined:
    Sep 18, 2018
    Posts:
    151
    I updated to latest HR but it doesn't fix it for me. These are reflections from the skybox and not point light like in the sample scene. It also seems like this is mostly about intensity. I need to set skybox intensity about 3x higher to achieve the same effect for Entities as I do for GameObjects
     
    Last edited: Feb 11, 2021
  3. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    675
    Is there any way to completely disable light probes for entity? Even if I set Light Probes to Off in a MR, HR still adds AmbientProbeTag to entity and huge pile of light probe properties (eating a lot of chunk space). But I am using unlit material for this entity...
    @SebastianAaltonen
     
    Morbeavus likes this.
  4. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    675
    Also culling not working great with camera.layerCullDistances (I think because of chunk render bounds)
     
  5. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    675
    Looks like camera.layerCullSpherical doesn't work too.
     
  6. MicCode

    MicCode

    Joined:
    Nov 19, 2018
    Posts:
    42
    Yes, even without any light probe in the scene, it still use up a lot of chunk space.
    Now I separate the logic and rendering to two entity. Linked with a "RenderEntity" component
    But if I have to update the material property every frame from some logic, this is bad for performance because of the random access reference...
     
  7. Lee200

    Lee200

    Joined:
    Nov 26, 2017
    Posts:
    4
    Will there be a plan to increase GPU instancing to a number greater than 1023?
    I think it is important in DOTS considering we can have hundreds of thousands of objects in a scene. The hundreds of "AddBatch" calls is quite expensive in a game loop.
     
    apkdev and Mockarutan like this.
  8. Mockarutan

    Mockarutan

    Joined:
    May 22, 2011
    Posts:
    104
    I have this exact problem, my own old solution before hybrid renderer v2 was significantly faster when I draw 40000 of my objects, but I can't use that because DrawProceduralIndirect is unusable with V2...
     
  9. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    799
    I think the 1023 limit is inherited from Material Property Block.
     
  10. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,255
    MaterialPropertyBlock's itself haven't these restrictions, in default rendering path Graphics.DrawMeshInstanced has, if you'll use DrawMeshInstancedIndirect, DrawMeshInstancedProcedural you can have more than 1023 MPB's. In case of HR is BatchRenderGroup C++ side restrictions I suppose.
    upload_2021-2-26_14-45-59.png
     
    charleshendry and Opeth001 like this.
  11. Fribur

    Fribur

    Joined:
    Jan 5, 2019
    Posts:
    50
    Weird batching behavior:
    • Spawning ~3000 entities in System A using material A: 1 Hybrid Batch group
    • Spawning ~134 entities in System B using material B: 1 Hybrid Batch group
    • Spawning both (System A and B) : 49 Hybrid Batch group (alternating small batches of A and B material)
    Any idea how to prevent this and end up with 2 batches?

    (using ENABLE_HYBRID_RENDERER_V2, URP pipeline Asset, SRP batching is on, both materials use custom URP unlit Shadergraph )

    UPDATE: Fixed it by changing one of the two Shaders from "transparent" to "opaque". Guessing it is not related to Hybrid Batch creation after all, but rather has something to do with https://docs.unity3d.com/ScriptReference/TransparencySortMode.html
     

    Attached Files:

    Last edited: Mar 6, 2021
    cultureulterior likes this.
  12. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    In an upcoming Hybrid Renderer version this memory usage problem has been significantly improved for AmbientProbeTag (no probe properties for each entity anymore in that case), and there is also a define to disable light probes completely, by using DISABLE_HYBRID_LIGHT_PROBES.
     
    keeponshading and iamarugin like this.
  13. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    Hybrid Renderer currently splits transparent entities into separate batches by default to guarantee correct depth sorting (otherwise rendering order artifacts can result). To opt out of this behavior, you can use the DISABLE_HYBRID_TRANSPARENCY_BATCH_PARTITIONING define, in which case transparencies get treated the same as everything else. We are looking to solve this problem in a more performant manner in a future release.
     
    keeponshading likes this.
  14. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    There shouldn't be any AddBatch calls each frame, unless you are using Hybrid Renderer V1, or unless you are instantiating new entities each frame in a way where the new entities cannot be directly added into existing batches (out of space, or archetype didn't match).

    If you're creating entities each frame by hand, it is easy to encounter the latter situation by accident. We recommend either instantiating Prefabs or using the new RenderMeshUtility API to reduce how often this happens.
     
  15. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    853
    Hi @JussiKnuuttila. Any new progress for case 1312138 and what is causing this bug as previous version dun have this bug? Seems like regression. I believe the bug for this case should highest priority bug to fix.
     
  16. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    Hello. Unfortunately, no news to report yet. Quickly looking at the editor log for the issue, it seems that some unfortunate edge case is being hit during batch creation.

    In your case, what are the "previous version" and "current version", as having that information should prove helpful in investigating this bug as it would narrow down some of the changes which could have affected this.
     
    optimise likes this.
  17. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    853
    If I remember correctly previous version" is 0.10.0-preview.21 and "current version" is 0.11.0-preview.42.
     
  18. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    62
    Hi, I'm using Hybrid Renderer 0.11.0 and URP 10.2.2 in 2020.2.2. There is a problem when I instantiate prefab with light components: the instantiated light is not lighting the instantiated mesh. If I create a new gameobject in editor in playmode, it could be lit though. If not using URP, light is working correctly. I don't know it's a URP problem or Hybrid Renderer problem. Hope someone could help me?
     
  19. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    62
    Switch to Hybrid Renderer 0.11.0 and URP 10.3.2 in 2020.2.7, problem still exists.
     
    Last edited: Mar 10, 2021
  20. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    For various technical reasons, Hybrid Renderer cannot support the default Forward lighting mode in URP, which requires per object light lists which are incompatible with DOTS entities. That is why local lights currently don't work by default.

    However, Hybrid Renderer will support the upcoming URP Forward+ lighting mode (see https://portal.productboard.com/8ufdwj59ehtmsvxenjumxo82/c/261-forward-renderer-support), and should already support the new URP Deferred rendering mode which should be possible to enable in the newest URP version.
     
    BobFlame and thelebaron like this.
  21. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    62
    Thanks for reply. So if I understand correctly, there are some solutions to this problem:
    1, switch to built-in rendering or HDRP, hybrid renderer support local lights to them.
    2, implement myself a global light transform synchronization system.
    3, wait URP forward+ lighting mode.
    Am I right? which solution do you suggest?
     
  22. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    62
    Another thing is I notice, when I switch hybrid renderer V1, the light works fine. Should I stick to V1? How much performance difference between V1 and V2?
     
  23. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    Hybrid Renderer V2 does not support the built-renderer. Hybrid Renderer V1 supports built-in, but I believe at least forward lighting with local lights is not supported. However, it is possible that built-in local lights work with HRV1 in deferred rendering mode.

    A custom light synchronization system by itself would not be enough. A complete implementation would also require setting up a list of lights for each visible entity in the format used by URP. This is likely to be a very large task, and I would not recommend it.

    Hybrid Renderer V2 supports lights in HDRP, because HDRP uses deferred rendering and does not require per-entity light lists. Both the upcoming URP Forward+ and the new URP Deferred also use similar approaches, and will be supported.

    The performance difference between V1 and V2 highly depends on the scene. V1 is fast when you can mostly use the so-called "static" or "frozen" batches which are set up once and then cheaply rendered each frame, but has a substantial main thread cost each frame for everything else, which includes all dynamic entities (e.g. moving entities), and also everything else not explicitly configured as frozen. V2 handles unchanged data automatically, and should be much faster for this type of content. In internal benchmarks we see V2 consistently being faster in pretty much all scenes, but the difference depends on the scene. Also, V2 supports many more URP and HDRP features than V1 does.

    If you need something you can use right now, I would suggest trying V2 with the new URP deferred rendering mode, which should be possible to enable in the latest URP version by changing the package code locally.
     
    BobFlame likes this.
  24. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    853
    If understand correctly, seems like DOTS entities can't render the graphics properly at mobile platform right compare with classic Game Object? Btw which version of Hybrid Renderer will actually fix this?
     
  25. linfuqing

    linfuqing

    Joined:
    May 11, 2015
    Posts:
    133
    Will point light be supported?
     
  26. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    62
    Thank you so much for so detailed answer, I will try it.
    I have successfully enable deferred rendering, It's working now.
    Here is how to do it.
    https://forum.unity.com/threads/urp-limited-number-of-pixel-lights-why.1048142/#post-6923480
     
    Last edited: Mar 11, 2021
    cultureulterior likes this.
  27. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    182
    when a shadergraph shader has active targets as both hdrp and urp, hybrid renderer 2 does not work in urp mode and throws this error.



    the only solution right now is to duplicate the shader and have one be hdrp and another urp
     

    Attached Files:

  28. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    We are continuously improving the supported URP feature list, and we will continue to do so. I can't give you an exact version when everything will be supported, but it is definitely something we are working towards. It is true that right now Hybrid Renderer does not support all URP features available for GameObjects.
     
  29. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    Point lights will definitely be supported, but the goal is to only support the new Forward+ or Deferred modes in URP. So you will be able to use point lights as long as you use those modes instead of the current default Forward lighting mode.
     
    linfuqing and charleshendry like this.
  30. SamOld

    SamOld

    Joined:
    Aug 17, 2018
    Posts:
    255
    Could you give a hint about when Forward+ is likely to appear? I understand that you probably don't want to say anything conclusive, but are we looking at more like 1 month, 3 months, 6 months, or more?
     
  31. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    The only thing I can share at this point is that it is being actively worked on by the URP team.
     
  32. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    182
    also, another bug i've noticed is that realtime shadows are still calculated for objects that have been baked into the shadowmap. the two are then overlapped
     
  33. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    182
    How do you change the lightmaps for an entity? doing
    Code (CSharp):
    1. EntityManager.SetsharedComponentData(ent, new Lightmaps{ new texture2darray... });
    does not work. the only thing that works is changing the pixel data of the already present lightmaps
     
  34. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    643
    I got it working and its a big relief to finally have the trifecta of dots, urp and point lights/shadows working together, so thank you hybrid renderer team!

    However... it appears when using entities rendered with the Render Objects Feature in combination with the hybrid renderer do not receive lighting from point lights. If a bug report is needed Id be happy to file one(I didnt as its using the current srp master straight from github).
    Unsure if its by design with it being deferred and if forward+ will take care of it or if its a known/unknown bug.
     
  35. tassarho

    tassarho

    Joined:
    Aug 25, 2019
    Posts:
    11
    It doesn't seem to have been reported so i post here:
    i work since last weekend to install Hybrid_Renderer_V2
    First try with URP: all entities turn invinsible, after searching it seems a lot of user have the same problem and there is no solution yet.

    second try HDRP: no problem (except maybe huge performance drop).

    BUT in both case(HDRP and URP), whenever an entity has a material: hybrid_renderer_V2 seems to add material related components:
    is it intended?
    upload_2021-3-15_20-54-31.png

    at first i thought it was the conversion from builtin to srp , but even after creating new material, those component are still added.
    the documentation don't talk about that so. is it intended?
    EDIT found those components in the documentation, it's just not precise it adds them by default
    EDIT2: Link to the documentation: https://docs.unity3d.com/Packages/c...tinMaterialPropertyUnity_MatrixPreviousM.html
     
    Last edited: Mar 16, 2021
    charleshendry and Antypodish like this.
  36. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    8,815
    @tassarho can you add link, for future readers?
     
  37. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    324
    I don't know if it's known or not :

    Color are not rendered the same way in URP between a GO and an entity

    Before playing, same object except for the right one which will be converted to an entity
    NotPlaying.PNG

    After playing and conversion ( color is still the same)
    Playing.PNG

    Edit : case 1323153
     

    Attached Files:

    Last edited: Mar 20, 2021
  38. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    675
    Is there any plans to fix GC allocations every frame?
    upload_2021-3-22_23-49-48.png
     
  39. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    675
    Looks like this system is leaking memory hard, even if there are no entities to render. Like Megabyte per second. If I disable this system via Entity Debugger, leak is stopping.
    Unity 2020.3, HDRP 10.4, latest HR. Any advise would be appreciated.
     
    Last edited: Mar 22, 2021
  40. kite3h

    kite3h

    Joined:
    Aug 27, 2012
    Posts:
    135
    In Future , They maybe should make ProbeVolume ( SDF ) . And BakedLight ( Ambient ) pass move to Light pass. ( Currently gbuffer pass ) . SH will be no more .
     
  41. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    675
    Spent several hours researching. So HRS is leaking when there is nothing to render. Around 3GB per hour. As a workaround I am disabling HRS system by another system when there is no entities to render...
    @JussiKnuuttila I hope this will help you to solve the problem on the side of HR.
     
  42. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    182
    have you tried turning off collections safety? might just be the dispose sentinels, or unity editor interlope
     
  43. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    675
    Leak is happening in the build as well.
     
  44. hauwing

    hauwing

    Joined:
    Dec 13, 2017
    Posts:
    54
    hello, I have some models which use customized shaders, they look good under normal URP but they just show pink when converted into entity, I suppose it is to do with the hybrid renderer V2. Is it that hybrid renderer V2 only have limited support on customized shaders? or need to somehow convert these shaders into hybrid renderer V2? thanks.
     
  45. Resshn27

    Resshn27

    Joined:
    Apr 21, 2018
    Posts:
    18
    Check Material Overrides in Hybrid Rendering docs, if you are using custom shaders created using ShaderGraph.
    Also, don't forget to check ECS Samples/HybridURPSamples repo, they got pretty good samples for Custom Material Property overrides.
     
    Last edited: Mar 27, 2021
  46. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    I looked into this today, and I can confirm that there was a bug where small ComputeBuffers were leaked on frames where Hybrid Renderer does not update any data to the GPU (i.e. no MaterialProperty IComponentDatas had changes, which also happens when there is nothing to render). The same bug also caused the GC allocs which happened because a new buffer is created.

    If you need a quick solution to the issue, you can use a local copy of the package and make a single line code change in SparseUploader.cs around line 402. To fix the issue, change this:
    Code (CSharp):
    1. while (m_FrameData[i].m_Buffers.Count > 0)
    2. {
    3.     m_FenceBufferPool.PutBufferId(m_FrameData[i].m_FenceBuffer);
    4.     var buffer = m_FrameData[i].m_Buffers.Pop();
    5.     m_UploadBufferPool.PutBufferId(buffer);
    6. }
    7.  
    to this:
    Code (CSharp):
    1. // Fixed version
    2. m_FenceBufferPool.PutBufferId(m_FrameData[i].m_FenceBuffer);
    3. while (m_FrameData[i].m_Buffers.Count > 0)
    4. {
    5.     var buffer = m_FrameData[i].m_Buffers.Pop();
    6.     m_UploadBufferPool.PutBufferId(buffer);
    7. }
    8.  
     
  47. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    269
    I upgraded from 2021.1.0f1 to 2021.1.1f1 and my projects two main URP shadergraphs both register as "SRP Batcher Compatible", but they no longer run - i get an error that something is wrong with the DOTS_INSTANCING_ON variant.

    I ask myself... How can this break in a patch update? Pretty upsetting. One of the shaders is complex, the other is super simple. The shadergraph editor shows no deprecation issues and no errors.
     
  48. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    87
    This error is issued when the Hybrid Renderer runtime cannot find any DOTS instanced properties in any loaded shader variant (variants are loaded on demand in the editor). I would suggest checking the generated shader code to see that:
    • There is a multi_compile definition for the DOTS_INSTANCING_ON keyword
    • The shader target is 4.5 or greater (ComputeBuffers are required)
    • There is at least one DOTS instanced property (transform matrices should always be DOTS instanced, so not having any would be unexpected)
     
  49. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    675
    Thank you very much, that helped a lot!
     
  50. Fribur

    Fribur

    Joined:
    Jan 5, 2019
    Posts:
    50
    @JussiKnuuttila : I have the exacts same issue as Thygrrr: all of my URP ShaderGraph shader broke when upgrading to 2021.1.1f. Could you please look into this?

    Have for 6 shader this message:
    Code (CSharp):
    1. A Hybrid Renderer V2 batch is using the shader "Shader Graphs/SpriteGraph", but the shader is either not compatible with Hybrid Renderer V2, is missing the DOTS_INSTANCING_ON variant, or there is a problem with the DOTS_INSTANCING_ON variant.
    2. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    Downgraded to 2021.1.0 for now where everything went back to normal.
     
    Last edited: Apr 1, 2021
    Thygrrr likes this.
Thread Status:
Not open for further replies.
unityunity