Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Hybrid Renderer V2, HDRP/Lit not SRP batcher compatible

Discussion in 'Graphics for ECS' started by Mockarutan, Apr 18, 2021.

  1. Mockarutan

    Mockarutan

    Joined:
    May 22, 2011
    Posts:
    158
    I'm getting this error:

    Code (CSharp):
    1. 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.
    First of all, I'm aware of the talks about this in the Hybrid Renderer V2 thread, but I could not use any of that to decipher where my issue is.

    The error is completely anonymous (I assume that's always the case with this error) and it does not appear that often. I get it in two flavors; sometimes it just appears seemingly randomly, but I also get it 100% consistently when I run with built addressable assets. When it appears, it is accompanied by a "motionvector-type"-issue everywhere, I'm not really sure what it is, but it looks like this:

    (It's suppose to be a door with no blur)

    If I get it randomly in the editor (no addressables), the Lit shader in the HDRP package show "not SRP compatible" and it says 'UnityPerMaterial var is not declared in the property section (_DistortionScale)' undeneath in an info box. And of course I can reimport it to fix it.

    I have no idea how to debug this... and it takes so much time to rebuild addressables all the time to test it. Is there a way to find what materials are causing this?

    My packages
    com.unity.render-pipelines.high-definition: 10.4.0
    com.unity.rendering.hybrid: 0.11.0-preview.42
     
  2. Alaiing

    Alaiing

    Joined:
    Nov 17, 2012
    Posts:
    15
    Hi!
    I've had the same issue ever since I updated Unity to 2020.3.4f1. I would seem that the shader "HDRP/Lit" is not compatible with Hybrid Renderer V2 anymore.
    I have a simple prefab entity which I create from a prefab game object, it's just an arrow model with a simple material using the HDRP/Lit shader and I get the error 100% of the time when an arrow is shot in my game. And the arrow is not renderer.
    I reverted to Hybrid Renderer V1 for now to continue working. Hopefully this will be addressed soon.
     
  3. JediNizar

    JediNizar

    Joined:
    Nov 13, 2016
    Posts:
    111
    did you add Hybrid Renderer V2 to the scripting define symbols
     
  4. Alaiing

    Alaiing

    Joined:
    Nov 17, 2012
    Posts:
    15
    Well I suppose if we didn't, the message wouldn't be "A Hybrid Renderer V2 batch...". ;)

    Jokes aside, that's actually how I reverted to V1, by removing the define symbol..
     
  5. Mockarutan

    Mockarutan

    Joined:
    May 22, 2011
    Posts:
    158
    I guess the latest version of the hybrid renderer is just broken then... I Just moved over a minimal amount of code and asset to a fresh project and encountered the same issue pretty early on. It's still quite random for me, but I will just revert back and hope things get fixed in another update.

    And I can't revert back to V1, I use a lot of stuff from V2.
     
  6. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    954
    I get the same error, also accompanied with the motion blur. No idea how to fix this.
     
  7. Mockarutan

    Mockarutan

    Joined:
    May 22, 2011
    Posts:
    158
    @Enzi and @Alaiing

    I Think I found a solution, I made my own Lit master shader in shader graph. It works like Lit, with about 50% of it's functionality, or all the stuff we need at least. And by just swapping out all usage of Lit and switch to the home-made one, all the errors disappeared! Might be cumbersome, but it works!

    You can name Texture variables in your Lit Shader Graph to the same names that is used in the normal Lit, and the material will keep it's textures when you swap shader.
     
  8. JediNizar

    JediNizar

    Joined:
    Nov 13, 2016
    Posts:
    111
    mind to share?
     
  9. azmi_unity

    azmi_unity

    Joined:
    Dec 13, 2020
    Posts:
    62
    Thanks! this works for me--Navigate to "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader" -> Right click -> Reimport.

    I'm in 2021.1.4f1. I don't know if this is due to Entities being no longer supported in Unity 2021.
     
  10. SebastianAaltonen

    SebastianAaltonen

    Unity Technologies

    Joined:
    Feb 21, 2020
    Posts:
    112
    Could you try upgrading to HDRP 10.5.0 package? There was a bug in HDRP that caused SRP Batcher issues. I believe that the fix landed in 10.5.0, but I am not 100% sure.

    If you test with 10.5.0, please report findings to this thread.
     
  11. SebastianAaltonen

    SebastianAaltonen

    Unity Technologies

    Joined:
    Feb 21, 2020
    Posts:
    112
    Also if somebody could try deleting their "library" folder (exit Unity before you do it), and let Unity rebuild it. There might be some stale data in the library folder that was not properly upgraded to the new Unity version. We have seen some of these problems in the past, and deleting the "library" folder is a good workaround for this. Please report in the thread if this helped your case.
     
  12. azmi_unity

    azmi_unity

    Joined:
    Dec 13, 2020
    Posts:
    62
    I was in HDRP 11.0.0 when it happened. Re-importing did the trick and I didn't get that error since. Will report back if it happens again.
     
    Filimindji likes this.
  13. alloplastic

    alloplastic

    Joined:
    Jun 30, 2015
    Posts:
    18
    I've been seeing this error in my game, but only in executables. I.e., the game runs fine in the editor but I get the error that HDRP/Lit does not support SRP. when running the built game.

    I can work around this for now since my entities render with other shaders (HDRP/Unlit and HDRP/Hair).

    I've tried:

    * Reimporting the shader
    * Deleting /Libraries
    * Trying to configure the HDRP/Lit material to be as simple/default as possible

    Some details:

    * HDRP/Lit shows up as "compatible" with SRP in the inspector
    * I don't see any motion blur
    * I'm doing the rendering via a streaming camera, based on Unity Render Streaming 2.2.2 and WebRTC 2.3.1. (I've migrated the original Unity Render Streaming code manually to align with the WebRTC version.)
    * I've seen the same behavior in Linux builds but haven't tested thoroughly

    Version details:

    * Unity 2020.3.10f1
    * Windows 10 Pro
    * HDRP 10.5.0
    * Hybrid Renderer V2 0.11.0-preview.44
    * Entities 0.17.0-preview.42
     
  14. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    If you get the error in standalone but not in the editor, then almost certainly the problem is some very specific shader variant which is not compatible with SRP Batcher.

    In the editor, Unity compiles variants on demand, based on what you actually used. If you never use the problematic variant in the editor, everything is fine. When building a standalone player, Unity compiles every shader variant in advance, so the problem variant will always be present.

    Something you can try is to open the shader in the editor, and from the inspector use the "Compile and show code" button, which I think should compile all variants. Doing that might hopefully allow you to see the reason for SRP Batcher incompatibility in the editor.
     
    andreiagmu and thelebaron like this.
  15. alloplastic

    alloplastic

    Joined:
    Jun 30, 2015
    Posts:
    18
    @JussiKnuuttila -- Thanks for the advice. Compiling the HDRP/Lit shader with "Compile and show code" appears to confirm what you said. The "SRP Batcher" field changes to "not compatible" in the inspector.

    However, I didn't see a clear indication of what the bad variant might be. The error I got, in the inspector, was "Internal error communicating with the shader compiler process. Please report a bug including this shader and the editor log."

    The editor log didn't contain any obvious errors -- the shader seemed to compile, and the HDRP/Lit-related files in /Temp looked fine, to my uneducated eye.

    In any case, I did file a bug on this with what information I had. Luckily I can use the Unlit shader for what I'm doing in the near term.
     
  16. zajacLG

    zajacLG

    Joined:
    Apr 19, 2021
    Posts:
    3
    Unity 2020.3.3f1 HDRP 10.4.0 (I do not see 10.5.0)
    After every Stop HDRP/Lit goes to SRP Batcher not compatible
    Reimport of shader fixes that.
    Then hit Play, everything is OK
    Stop -> broken again
     
    Filimindji likes this.
  17. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
    I've been dealing with this for a while now, this seemed to fix it. Thanks for posting.
     
    Filimindji likes this.
  18. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    This worked for me on 2020.3, thanks.
     
  19. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    On which version of 2020.3 are you?
    I have the same issue with the 2020.3.14f1 and when I re-import the Lit shader it only works once, when I stop playing my scene the Lit shader back to SRP incompatible :'(
     
  20. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    Unfortunately, it was a while back and I don't recall which I was on at the time. I have since updated to the most recent 2020.3.x with that project.
     
  21. ZbigniewBrzozowski

    ZbigniewBrzozowski

    Joined:
    Jan 26, 2019
    Posts:
    4
    "Hybrid Renderer V2 is compatible with following shader types: ShaderGraph, HDRP/Lit, HDRP/Unlit, URP/Lit, URP/Unlit." this helped me!