Search Unity

SetReplacementShader alternative solution for HDRP

Discussion in 'High Definition Render Pipeline' started by andrzej_, Nov 20, 2019.

  1. andrzej_

    andrzej_

    Joined:
    Dec 2, 2016
    Posts:
    81
    I'm trying to port a solution that used SetReplacementShader to get custom secondary render passes, to HDRP. As far as I could tell, the method is no longer available in SRP.

    What I'm trying to do is basically this:

    Optical flow is a bit of a different problem, but basically I would need a replacement shader for a secondary cameras.
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    I'm not sure what you need to do, but couldn't you just write an image effect if you need to see that data on the screen? Although you probably need that replacement shader (or similar thing) to write out those categories etc.

    I'm probably shooting in the dark but have you checked that custom pass repo:
    https://github.com/alelievr/HDRP-Custom-Passes

    There might be some useful pointers to the right direction. I haven't yet had time to check those properly so I'm just guessing, but there's examples of isolated effects etc. so it might be possible to use those techniques. But someone more knowledgeable might be able to help.
     
    Last edited: Nov 20, 2019
  3. andrzej_

    andrzej_

    Joined:
    Dec 2, 2016
    Posts:
    81
    Exactly, as you write, I need this to be rendered and written to disc with all of those options for the same exact scene in a single frame from multiple cameras (or one camera that would iterate between different 'options'). Some passes, like the segmentation, can't have AA as well.
    I'll take a look at the custom passes repo. Thanks!
     
  4. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi custom pass is indeed what you need.
    In the future we will add the option to export custom pass with our AOV request API to do what you describe, but it is not available for now, should be in 2020.1
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    Once HDRP stabilizes (which should be soon, right?) can we get docs about these things?

    At this point the best way to figure out how to write custom passes is to study these : https://github.com/alelievr/HDRP-Custom-Passes which is fine, but clear docs would help too :)
     
  6. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    265
    ekakiya, Olmi and AcidArrow like this.