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

Standard shader as overlay

Discussion in 'General Graphics' started by silentslack, Apr 26, 2015.

  1. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    379
    Hey,

    Is there a fast way to make a variant of the standard shader that is set to Overlay rendering?

    Thanks!
     
  2. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    379
    Little bump on this - just would like a variant of the standard that overlays. I've downloaded the native shader pack and imported it but what do I need to duplicate and change?
     
  3. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    Overlays as in is rendered after EVERYTHING else?
    What about a second camera? If it's in the main camera it's very likely still going to be before any post-process effects and GUI.
    If your ok with it being before post-processes (At least I think even RenderQue 4000 is before post-processes, then use either the first or as I'd suggest the second answer in this thread: http://answers.unity3d.com/questions/8220/rendering-order.html )
    (Second one is about setting it per material instead of having to use a new renderer. With unity 5 you might even be able to set it per renderer!)
     
  4. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    379
    Yes I would like to render over everything else. Second Camera isn't an option unfortunately as I'm developing for GearVR and there are issues there. I assumed I would be updating the render queue to 4000 but I'm just not sure where when it comes to the standard shader!?
     
  5. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    No need to modify the shader, you can set Material.renderQueue instead.
    You would need to set that from a script. (Or possibly a modified material editor)
     
    DarthDisembowel likes this.
  6. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    379
    Oh right, cool! Was completely unaware of that - that's awesome.

    And yes, it works! Fantastic, thanks for the help, just saved me creating tons of unnecessary duplicate shaders!
     
  7. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    You almost never need to create a new shader, the tricks have simply been hidden away! (Not documented, and I'm still not sure if they are)
    Such as the ability to set Blend Mode, Stencil, ZWrite !
     
    silentslack and theANMATOR2b like this.
  8. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    Nice, thanks @Zicander ! Wish I had found this before I made a bunch of special shaders :)