Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Can I just write lit shaders for URP

Discussion in 'Universal Render Pipeline' started by MikeUpchat, Mar 2, 2021.

  1. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    Just learning the whole URP thing, and one thing I am confused about is writing shaders, is it possible to by pass the whole Shadergraph thing and just write simple lit shaders with custom params, a vert fragment and a surface fragment. Are there examples on doing that? I see examples on the Unity Doc site for writing unlit shaders but nothing showing how to do a lit version.
     
  2. imagoFX

    imagoFX

    Joined:
    Sep 19, 2011
    Posts:
    84
    I second that question!
     
  3. colin299

    colin299

    Joined:
    Sep 2, 2013
    Posts:
    181
    jhocking likes this.
  4. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    jhocking likes this.
  5. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    There seems to be a few ways to do it so long as you don't need animated vertex positions. Hadn't seen the examples above, but had seen others where people have recreated URP-compatible lit shaders, usually with quite a stripped-down subset of features.

    Duplicating+editing the lit shader files from the URP package is another option, which I've used recently (this can be done without breaking SRP batching). But beware of the number of variants involved and effect on build times if you don't strip out what you don't need.

    But now I need to be able to do vertex shader animation, (with shadowcaster and depth passes), and it looks like things are about to get much uglier :(

    Not sure I can use it in my case, but Better Shaders may be the solution that some projects are looking for?
     
  6. djhatvr

    djhatvr

    Joined:
    Sep 22, 2019
    Posts:
    53
  7. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,748
    Can you not change vertex positions in hand written URP shaders?
     
  8. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    Yeah, you can, it just requires a deeper understanding of the passes within a URP shader (to ensure it works with deferred vs forward, shadows, depth-normals passes, etc).

    (I think I was going through the learning process - somewhat frustrated by the lack of surface shaders and limitations of Shader Graph - at the time of my last post...)