Search Unity

Bug Cross Pipeline shadergraph (HDRP+URP) breaks srp batcher

Discussion in 'Shader Graph' started by Camarent, Jan 19, 2021.

  1. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Hi! I am working on a game with cross pipeline (URP and HDRP). Tried new feature from shadergraph that can generate shader for URP and HDRP. Both version is 10.2.2.
    When I choose 2 targets for shadergraph it is showing that srp batcher is not compatible.

    It is super easy to test this behaviour:
    1. Create new project with Unity 2020.2.1f1 and URP 10.2.2.
    2. Download HDRP 10.2.2 in the same project.
    3. Create new lit shadergraph through URP menus.
    4. Add target HDRP
    5. Add any property as in screenshoot.

    upload_2021-1-19_17-52-41.png

    upload_2021-1-19_17-53-29.png
     
    laurentlavigne likes this.
  2. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    I also tested SRP 11.x version and this bug is still there.
     
  3. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
  4. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Any news about it?
     
  5. alexvector

    alexvector

    Joined:
    Oct 9, 2019
    Posts:
    26
    I have also encountered the issue, but the error message for me is different:
    upload_2021-1-22_10-13-33.png

    I suppose the HDRP and URP passes have a different UnityPerMaterial definition and it disables SRP batcher, even though those passes will never be used together in the same frame.
     
    Camarent likes this.
  6. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    What is strange for me that no one answering about this question and still I see that feature is marked as released from version 9 to version 11 (the newest one with Unity 2021). So it makes me think that maybe I do something wrong? Like when you forget to enable toggle from camera for specific effect because it was disabled by default for some reason.
     
  7. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
  8. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
  9. alexvector

    alexvector

    Joined:
    Oct 9, 2019
    Posts:
    26
    I also reported case #1309114
     
  10. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    So I just tested what QA wrote in description and it seems working if you first install HDRP and then URP. If you do it backwards it is showing this error.
    The question is how it is this possible? Can I fix my project somehow while we are waiting for bug resolving?

    @alexvector Did you experience the same? I mean you installed hdrp onto urp or your case is different?
     
  11. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    So this case cannot be fast fixed as I see. I tested what was in the description on issue tracker but it worked only because you also need to set a URP asset not only for the Graphics tab but also for the Quality settings. When I did it immediately show the same error message. It is actually great to see that the order does not matter but it is sad that we do not have any fast fixes then.
     
  12. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Any news about this bug?
     
  13. goran_okomotive

    goran_okomotive

    Joined:
    Apr 26, 2017
    Posts:
    60
    We also need this fixed.
    I found a work-around, just delete the HDRP target in the graphs before building a URP build, but this is super un-convenient for a build pipeline workflow and in general.

    Is there maybe a way to open a shadergraph in the editor and to remove targets via script? This would be easy to add to the build-pipeline procedure.
     
  14. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    The good news is that Jason made surface shader that works in this situation.
    https://assetstore.unity.com/packages/tools/visual-scripting/better-shaders-standard-urp-hdrp-187838
    https://assetstore.unity.com/packages/vfx/shaders/better-lit-shader-189232
    You will need to modify his importer so you can work with two targets in one project but it is only acceptable solution I know for now.
     
  15. goran_okomotive

    goran_okomotive

    Joined:
    Apr 26, 2017
    Posts:
    60
    That looks awesome but can't update now all shaders to this tool-set.