Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Hybrid Renderer V2 (0.4.0)

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

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

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    There are multiple DOTS instanced properties, and I have used them successfully in the past. (they also work, despite the error being thrown, but as the error is a runtime error, I can't test my game comfortably without execution halting on play)

    I was left with no choice but to downgrade to 2021.1.0f1 again for now.
     
  2. JediNizar

    JediNizar

    Joined:
    Nov 13, 2016
    Posts:
    111
    Hi Since the last update
    I'm getting "A Hybrid Renderer V2 batch is using a pass from the shader "HDRP/Lit", which is not SRP batcher compatible. Only SRP batcher compatible passes are supported with the Hybrid Renderer"

    Unity 2021.1.1f1
    Hybrid Render 0.11.0- preview.42

    any help?
     
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,106
    Hi @joelv @JussiKnuuttila. I successfully reproduce with 100% reproducible super simple repo. Refer to case 1327493. I confirmed hybrid renderer 0.10.0-preview.21 dun have error spamming bug. Hopefully this bug will be fixed in next version of Hybrid Renderer as it's critical bug and very easy to reproduce.
     
  4. vildauget

    vildauget

    Joined:
    Mar 10, 2014
    Posts:
    120
    I've found that as a work around, simply opening my custom shader graphs after a Unity version upgrade, and click save, fixes them for me. Probably mentioned in this thread before, but worth mentioning again, worth a try.
     
  5. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    Doesnt help me, sadly. Saving doesn't repair the shaders; neither does updating any deprecated nodes I may have. I have taken apart the simpler shader for some analysis - both work on 2021.1.0f1, but they fail on later versions, including .2f1.

    I have attached a simple sample project. I also filed is as a bug report: https://fogbugz.unity3d.com/default.asp?1327570_1bbde29qhen4ipta

    Case 1327570.


    1. What happened

    I updated my DOTS project to 2021.1.1f1, and later to 2021.1.2f1 from 2021.1.0f1.
    Two of my Hybrid Instanced shaders now throw a runtime error and do not render at runtime.

    A Hybrid Renderer V2 batch is using the shader "Shader Graphs/Graph Outline", 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. How can we reproduce it using the example you attached

    0. Run project in Unity 2021.1.1f1 or 2021.1.2f1.
    1. Open Bugscene.unity, hit play. Observe error in console.
    2. Open/Inspect Graph Outline.shadergraph. Observe SRP compatibility.
    3. Run same project in 2021.1.0f1. Observe: No shader error at runtime.
     

    Attached Files:

    Last edited: Apr 8, 2021
    reeseschultz likes this.
  6. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    I get this for "Universal Render Pipeline/Unlit", but the error goes away after a while.

    I also get this problem with the Shadergraph, mostly on Hybrid Instanced shaders, it appears:

    "Shader Graph Node gets Stuck on Mouse Cursor after Editing contents"
     
  7. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,106
    Thygrrr likes this.
  8. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,110
  9. Fribur

    Fribur

    Joined:
    Jan 5, 2019
    Posts:
    130
    What worked for me to get all my Unlit Shadergraphs working again was to downgrade from Universal RP 10.4.0 to 10.3.2:
    Code (CSharp):
    1. "com.unity.render-pipelines.universal": "10.3.2",
    (used to be easier via drop-down in Package Manager) Supports the hypothesis that the Shadergraph code generator is maybe at fault here.
     
    Thygrrr likes this.
  10. JediNizar

    JediNizar

    Joined:
    Nov 13, 2016
    Posts:
    111
    in another thread, @DK_A5B pointed out a fact that I have overseen.

    Unity just announced that the Entities package (which the Hybrid Renderer is dependent on) is not supported on any version of Unity 2021

    for me I have trouble with HDRP, I'll try to downgrade and see if it's working otherwise I will downgrade unity back to 2020. will see maybe also the lights will work in a combination with GPU Instancing, once I downgraded

     
  11. DK_A5B

    DK_A5B

    Joined:
    Jan 21, 2016
    Posts:
    110
    A warning I want to add here. Downgrading (opening a project in a lower/previous version of Unity - e.g. opening a 2021.1.x project in 2020.3.x) isn't supported by Unity. This may lead to unexpected bugs and issues, so you'll definitely want to back up any projects before attempting it. A better approach may be to create a fresh project in the target version and then import/copy/recreate your assets from the original project in this fresh project. Obviously, depending on your project and what type of assets you have this can either be pretty trivial (just copying some source files) or rather time consuming (recreating nested Prefab assets).
     
    Opeth001 likes this.
  12. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    Wow, nice idea thank you! Will try it.
    EDIT: IT WORKS! SO yeah 10.3.2 and 11.0.0 are the only URPs that work with my instanced graphs. Together with the message below this, I am forever grateful!

    Wait what? Ok that makes it simpe, at least 2020 isnt complete crap, though the UI in 2021 was a lot more responsive.
     
    Last edited: Apr 14, 2021
  13. DDAAACCC

    DDAAACCC

    Joined:
    Jul 8, 2020
    Posts:
    9
    I'd like to use multicore rendering in Unity, so I'm looking for content related to hybrid rendering.
    However, the content I found (ECS) is not content that renders with multiple cores, but only describes that after copying a lot of one object, the optimization is done well.
    I'm working on a Unity project that makes observing a human body modeling with many vertices and many objects, but since this object doesn't need to be copied, I wonder if it's better to use ECS and hybrid rendering.

    1. Is hybrid rendering using multicore?
    2. Is hybrid rendering or ECS itself suitable for many vertices and many (e.g. knuckle bones, each with a different modeling and texture)?

    Please help
     
  14. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,680
    1. Rendering itself - single threaded as far as I know. But data preparation multithreaded.
    2. Many vertices itself not a problem, but many different meshes can be not so noticeable performant in comparison for now (I expect it to be on the same level as unity default renderer with Built-in and SRP pipelines)
     
    bb8_1 likes this.
  15. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    837
    @JussiKnuuttila @SebastianAaltonen with the recent announcement of 2020LTS, does this mean Hybrid V2 URP Point light support will be 2022 at the earliest?

    I've been waiting so long to be able to use point lights in V2 with URP and this new announcement is giving me a lot of anxiety. For a brief moment it seemed like the pieces were finally falling into place(using deferred urp from github) and now an announcement is saying that this will definitely not work going forward, even though its working extremely well right now.

    Its tough to art direct a project that takes place indoors when you are limited to a single directional light.
     
    pcg likes this.
  16. DK_A5B

    DK_A5B

    Joined:
    Jan 21, 2016
    Posts:
    110
    Point light shadows for URP is one of the best examples of the problem with separating ECS (and therefore the Hybrid Renderer) onto the 2020 LTS track "until end of 2021 at the earliest".

    Support for point light shadows was added with URP 11.0.0, which requires Unity 2021.x. Therefore, unless they make URP 11.0.0 available for 2020 LTS at some point, or else add Point Light shadows to URP 10.x at some point, yeah, anyone using Hybrid Renderer with URP is stuck without Point Lights until ECS merges back with the tech stream.
     
    AlexHolderDev, thelebaron and elJoel like this.
  17. DDAAACCC

    DDAAACCC

    Joined:
    Jul 8, 2020
    Posts:
    9
    thankyou very much i want know this
     
  18. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    My requirements are so fortunately quite simple, I don't depend on point light shadows, I just want additional vertex point lights and SH point lights without shadows and even THESE don't seem to work with hybrid renderer. Or has that changed, at long last?

    I do agree that the xRP / HR / and now Unity version split is going to lead to some kind of dependency hell. Fittingly, DK_5AB's post is number #666.
     
    Last edited: Apr 18, 2021
    AlexHolderDev likes this.
  19. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    926
    Yeah, that's a pretty big problem now that URP/HDRP are tied to Unity versions.
     
  20. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    777
    It has always been like that?
     
  21. No. If I remember correctly (and I'm not sure) it became the norm with the "big sweep" last year, when they announced the crucial packages go back into the engine and the experimental ones won't be available by default nonsense too.
    So basically since last year.
     
  22. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    The Shader Hybrid Renderer Bug discussed in recent posts persists in 2020.3.5f1.

    Sad tiger is sad, even brand new created, simple shaders just don't work. I submitted a new case 1331111. It contains several examples in a minimal project, plus all the details I know so far.

    Only workaround is to downgrade to URP 10.3.2, with any unpredictable side effects that may have.

    Interestingly, LIT graphs are fine, only the UNLIT graphs are broken, but it seems that all of them are.
     
    Last edited: Apr 22, 2021
  23. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
  24. Fribur

    Fribur

    Joined:
    Jan 5, 2019
    Posts:
    130
    I fear this incompatibility of the Entities ecosystem with the latest Tech Stream Unity Engine (+packages like URP 11.0 tied to latest Tech Stream) might have been one of the contributing factors to recognizing "ENOUGH, this does not work".

    And might have led to the very decision to keep Entites+Hybrid etc with Unity 2020.3.3LTS and all the packages tied to it (URP 10.4.0 etc pp). Notice the silence from JussiKnuuttila and SebastianAaltonen here in this thread: they might be equally frustrated the rest of Unity keep breaking their hard work and they might not be able to keep up with unbreaking it. So I am skeptical they will fix it, as it is likely a change in URP 11.0 / Shadergraph, and not in the Hybrid package. etc. They might patch URP 10.4.0.
     
    Last edited: Apr 23, 2021
    Thygrrr likes this.
  25. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    926
    Why is the HRv2 performance so low? Am I expecting too much?
    I've tested the "StressTestHybrid" demo scene in HybirdHDRPSamples and hardcoded the scene to just update positions in a sine wave. Results are from a development build with auto profiler. (I've tested without dev build, makes no difference.) Unity is 2020.3.3f1

    Running on an i7-4770k 3.5ghz with geforce1080
    So we have 100k cubes that move in a sine wave:
    Overall: 9.35ms
    HybridRendererSystem: 3.34ms
    AnimatePositionsSystem: 2.21ms - I have tested with just moving an axis instead of sin which results in around 1.1ms

    Does anyone know some numbers from other engines or stress tests like this? I have no comparisons, I just feel like this can should 10 times faster. But yeah, maybe I'm expecting too much.
    upload_2021-4-23_19-16-43.png
     
    apkdev likes this.
  26. DK_A5B

    DK_A5B

    Joined:
    Jan 21, 2016
    Posts:
    110
    I can't speak to the specifics of your test scene, but if you're using the HDRP then that could be part of the reason. My understanding is that the architecture behind the HDRP is designed to have relatively high overhead (relative to the built-in or Universal RP) but to scale extremely well as you add more to it. In other words, you're going to have a relatively low ceiling for how fast you can possibly make the HDRP render (even with a minimal scene), but as a tradeoff it will scale better as the load grows (relative to the other RPs).

    Also, the HDRP has a ton of configuration parameters and if you're trying to squeeze optimal performance out of it you're definitely going to need to optimize those for your specific use case. The default configuration of the HDRP comes with a lot of bells and whistles enabled, and if you aren't using them then they're just dragging your performance down.
     
  27. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    926
    For 1 million cubes it takes 56ms on my machine. It's only 6 times slower with 10 times more cubes. Is that good? Hardly, not a good ratio. Now we have high initial costs and it doesn't scale.

    upload_2021-4-24_0-17-48.png

    Sure it can be optimized but GPU, shaders or render time are not the problem. CPU is.

    To add to that, I'm fully aware that the HR is built primarily for static scenes. Moving so much render entities on the CPU is maybe a bogus approach. I still think this could be optimized much more.

    edit:
    Most problems arise from TRSToLocalToWorldSystem. It's a bad system with excessive amounts of branching and should be either optimized or removed. Translation and Rotation are authoring components for LocalToWorld. I wonder why they even exist at this point. Bad design leads to bad usage. It's just as easy and faster when writing directly to LocalToWorld.
     
    Last edited: Apr 23, 2021
    apkdev and charleshendry like this.
  28. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    I think ECS is the absolute future, and I really hope Unity will keep developing it. Otherwise... well, I don't even know otherwise. There is really nothing like it, in an engine with such pervasive tooling and established, extensible workflows.

    I am totally fine with sticking with 2020 for a while, or even skipping 2021 entirely, as long as functionality keeps working and regressions are addressed quickly.
     
  29. alican_hasirci

    alican_hasirci

    Joined:
    Jul 7, 2020
    Posts:
    19
    I am having this error spamming at my logcat on Unity 2020.5.1f1 Android platform when i switch to IL2CPP backend. Does anyone else experience the same problem, if so is there a fix to it?

    Code (CSharp):
    1. E/Unity: InvalidOperationException: The NativeArray can not be Disposed because it was not allocated with a valid allocator.
    2.       at Unity.Collections.NativeArray`1[T].Dispose (Unity.Jobs.JobHandle inputDeps) [0x00000] in <00000000000000000000000000000000>:0
    3.       at Unity.Rendering.HybridRendererSystem.UpdateAllBatches (Unity.Jobs.JobHandle inputDependencies) [0x00000] in <00000000000000000000000000000000>:0
    4.       at Unity.Rendering.HybridRendererSystem.UpdateHybridV2Batches (Unity.Jobs.JobHandle inputDependencies) [0x00000] in <00000000000000000000000000000000>:0
    5.       at Unity.Rendering.HybridRendererSystem.OnUpdate (Unity.Jobs.JobHandle inputDeps) [0x00000] in <00000000000000000000000000000000>:0
    6.       at Unity.Entities.JobComponentSystem.Update () [0x00000] in <00000000000000000000000000000000>:0
    7.       at Unity.Entities.ComponentSystemGroup.UpdateAllSystems () [0x00000] in <00000000000000000000000000000000>:0
    8.       at Unity.Entities.ComponentSystem.Update () [0x00000] in <00000000000000000000000000000000>:0
     
  30. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    926
    @alican_hasirci Are there any errors happening before this? Usually all systems tend to crash when an allocation error happens like not disposing something in native memory.
     
  31. alican_hasirci

    alican_hasirci

    Joined:
    Jul 7, 2020
    Posts:
    19
    Sadly no, but after some trial/error + clean builds with Temp cleaned up etc, I've managed to make it work. Now my biggest problem is getting a working release build on Android with IL2CPP. Nothing seems to work but don't thnk the underlying solution has something to do with HybridRendererV2..
     
  32. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    350
    The issue with Unlit shader graphs should be fixed in URP 10.6.0. If you are unable to wait until then, it is possible to locally work around the issue if you want to use a locally modified package.
     
  33. DK_A5B

    DK_A5B

    Joined:
    Jan 21, 2016
    Posts:
    110
    What is the timeline for URP 10.6.0?
     
  34. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    350
    Unfortunately I don't know when it will be released, I only know that it should contain the fix for this problem. If you require an immediate fix, I can try to provide instructions how to work around the problem locally.
     
  35. DK_A5B

    DK_A5B

    Joined:
    Jan 21, 2016
    Posts:
    110
    @JussiKnuuttila, I appreciate you can't give me an exact date, but can you at least provide a ballpark? Are we talking next month (May), two months, six months...? Or are you saying you literally have no idea when - it could be sometime in May or it might not come until 2022?

    Just looking at the Changelog it looks like, starting with 10.1, new minor versions of URP 10 have been released every 1-2 months, so I'd assume that we're looking at May or June, but if you're saying that pattern isn't likely to hold that's also information worth knowing.

    Thanks for the offer to provide a local fix. For the time being I've been getting by staying with 10.3.2. It's a hassle to adjust the packages with every Unity update, but it works for now. However, I think there might be others on this thread who are having the same issue and might be interested in the local fix. I'll let them speak for themselves.
     
  36. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,696
    This forced me off LTS

    https://issuetracker.unity3d.com/is...5.1550216078.1617925947-1186942002.1613940835
     
  37. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    Heads up, URP 10.5.0 is available for Unity 2020.3.6f1.
    upload_2021-4-29_16-1-7.png

    I have not encountered the SRP Batcher issue for unlit shaders with it, so ... yay!
     
    Mockarutan likes this.
  38. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    Interestingly, a NEW shadergraph I created has the same issue now on 10.5.0 - investigating. Also, saving the graphs.

    I was working with this and editing graphs a lot yesterday, why did it suddenly break today?
     
  39. Fribur

    Fribur

    Joined:
    Jan 5, 2019
    Posts:
    130
    In case you are referencing to this ticket : 2020.3.6.f1 and URP 10.5.0 changing nothing for me, waiting for 10.6.0.
     
  40. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    350
    In case it is helpful, the shader graph breakage was caused by incorrect subshader ordering in the generated shader (target 2.0 subshader was generated before target 4.5 subshader, it should be the other way around), causing Unity to prefer the former, which is incompatible with Hybrid Renderer.

    If you encounter further similar problems and require an immediate workaround, you can locally modify the shader graph package to generate the 4.5 subshader first.
     
    Fribur likes this.
  41. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    350
    While you are correct that there are things we can do to try to optimize this further, it should be pointed out that a million moving cubes is a lot of dynamic data to copy over to the GPU each frame (in HDRP, this is over 100 MB of data for matrices and the color), so some cost is unavoidable in a general purpose solution like the Hybrid Renderer.

    Also, in cases like this where just LocalToWorld is enough (no hierarchy necessary), it should be possible to delete the components related to the transform hierarchy, which would save you the costs related with the transform system. Obviously this cannot be done in all cases, but it is good that it's sometimes an option.
     
  42. Fribur

    Fribur

    Joined:
    Jan 5, 2019
    Posts:
    130
    Thanks JussiKnuuttila, and here some more specifics in case anybody wonders as much as I did what to do now exactly:
    • com.unity.render-pipelines.universal@10.5.0\Editor\ShaderGraph\Targets\UniversalTarget.cs
    • move all statics containing "ShaderModel.Target45" in front of those with "ShaderModel.Target20"
    Error is indeed gone, Unlit Shaders work again with 10.5.0
     
  43. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    Can't I disable shader generation for 2.0 target entirely? There's no 2.0 hardware I would be interested in while prototyping, probably not even for production.
     
    Last edited: Apr 30, 2021
  44. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,696
    I’m trying to render a simple ECS cube on Oculus Quest 2. Has anyone got ECS working on Quest 2 with latest ECS and hybrid renderer v 2?

    if it is not support any suggestions to allow me to keep developing while I wait for that to drop?h
     
  45. ryanslikesocool

    ryanslikesocool

    Joined:
    Jul 31, 2016
    Posts:
    49
    I got it working at one point on Quest 1 + Hybrid Renderer v1 sometime in early 2020, but haven't tried since. It's possible that Hybrid Renderer v2 has something new that breaks it. The performance was less than ideal though.
     
  46. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    350
    That should work as well.
     
  47. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    341
  48. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    698
    Well seems like that's not possible from the shadergraph perspective, only by using #pragma target.

    I think it would drastically speed up shader compilation if the 2.0 specific stuff was omitted because there are maybe 5 or 6 PCs left on the planet that need 2.0 and 2.5.

    Been looking in the docs for this for half an hour now, there's really no global minimum one can set?
     
    d11joshuam, Enzi and hidingspot like this.
  49. Deeo

    Deeo

    Joined:
    Dec 6, 2012
    Posts:
    39
    Was making a shader graph for HDRP with V2 to take a texture and place it on a mesh but all it does is render a solid colour but it works fine on with the normal renderer. Is this a bug with the hybrid renderer V2 with HDRO and shader graph ?

    using unity 2021.1.2f1
     
  50. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    350
    Using textures with shader graphs should work in Hybrid V2. If it doesn't, please file a bug with a repro project so we can investigate.
     
Thread Status:
Not open for further replies.