Search Unity

Per-Instance Unlit Shading

Discussion in 'Shaders' started by BlakeSchreurs, Dec 18, 2017.

  1. BlakeSchreurs

    BlakeSchreurs

    Joined:
    Aug 10, 2016
    Posts:
    51
    Hey folks, I've been working around a problem, and I was hoping to tackle it head-on and solve it once and for all...

    Say I have a scene with 5 gameObjects. I want to have a side-by side image where one half are the objects rendered with one camera using the standard shader, and the other half are the objects are unlit, with a different color per instance.

    Right now I'm just alternating frames, and using projectors, but that doesn't help me do a side-by-side.
     
  2. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    375
    Render dupes of the objects with replacement shaders in the other camera?
     
  3. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    You write a shader that does standard shader things on one half and unlit things on the other half of the object

    or,

    * You render an image of the object(s) via replacement shader (mask of unlit or whatever)
    * with a postprocessing shader, you blend this unlit mask on your original shaders with the variable that defines the half
     
  4. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,983
    You could just do one pass that renders the left side and one that renders the right. You could discard what you dont need in one pass and same in other, or not.

    Replacement shader is also a way to go