Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Replacement Shader equivalent?

Discussion in 'Universal Render Pipeline' started by schneckerstein, May 29, 2020.

  1. schneckerstein

    schneckerstein

    Joined:
    Dec 6, 2018
    Posts:
    36
    Hello!

    I want to implement simple order indiependent transparancy for an existing URP project. For this I need to draw all materials with a special shader pass again. However using a override Material would not allow me to accsess the data of the original materials.

    Any ideas?
     
  2. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    464
    It seems the shader replacement system from the built in rendering was removed in URP. So, if an override material per layer isn't fine grained enough, I think we have to write our own script to access all the materials of all the renderers in question.
     
  3. schneckerstein

    schneckerstein

    Joined:
    Dec 6, 2018
    Posts:
    36
    That sounds like A LOT of unneccesarry overhead. :/
     
  4. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    It's actually possible to recreate replacement shader behavior with abusing ShaderLOD system. Even without modifying any URP sources.
     
    Olmi and chrismarch like this.
  5. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    @BattleAngelAlita Interesting, I need to look into that. Thanks for the tip. I find it weird that such necessary thing aren't working straight out of the box...
     
  6. Tepei

    Tepei

    Joined:
    Mar 29, 2014
    Posts:
    32
    Hi, can i ask you how did you use LOD to replace shaders ? Is it possible if using Shader Graph in URP ?
    I've done some work for the graphics of my project, using URP and Shader Graph.
    But now that i see there's no replacement shader, i'm forced to redo everything unless i find a workaround.
    Thanks for any response !
     
  7. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    Tepei
    If you can setup custom fallback shader from SG then yeah.
    Then just change Shader.globalMaximumLOD from a script.
     
  8. Tepei

    Tepei

    Joined:
    Mar 29, 2014
    Posts:
    32
    Very thanks,
    I could make it work, editing the generated shader located in a temp folder.
    But then the shader could not be open again in shader graph.
    Also now i struggle to find an equivalent to OnPreRender() in URP to make each camera a different LOD.
    Thanks !
     
  9. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,133
  10. Tepei

    Tepei

    Joined:
    Mar 29, 2014
    Posts:
    32