Search Unity

Question Multiple shader graphs / effects on a single object

Discussion in 'Shader Graph' started by pabloruiz55, Feb 9, 2021.

  1. pabloruiz55

    pabloruiz55

    Joined:
    Aug 13, 2012
    Posts:
    8
    Hi! This might be a dumb question but I can't wrap mi head around what's the best practice here.
    Say I have an object that as a base has a toon shader. I want to be able to apply a dissolve effect at some point during runtime and also a glow at some point during runtime. Think character always has a toon shader effect and on top of that when damaged I want to apply a red glow shader effect and when it dies I want to dissolve it.

    I know how to create those 3 shaders independently but what I'm not sure of is what's the best practice when it comes to applying toon + glow or toon + dissolve.

    Should I have a single material with a huge Shader Graph that has those 3 "branches" and toggle dissolve/glow when applicable? I'd assume that if this character can have 10 different effects at different points in time then this graph would be huge with lots of conditionals/states.

    Should I, instead, have multiple materials that have toon + glow, toon + dissolve, toon + etc and swap materials when applicable?

    Thanks!
     
  2. SampsaPlaysome

    SampsaPlaysome

    Joined:
    Oct 20, 2019
    Posts:
    34
    I'd do a big shader with shader keywords in it to toggle features using EnableKeyword/DisableKeyword in the material. And isolate reusable parts into sub shader graphs.