Search Unity

Question How do I use multi-pass when I need to use standard Lit shader in URP?

Discussion in 'Shaders' started by jjiangweilan, Jan 29, 2021.

  1. jjiangweilan

    jjiangweilan

    Joined:
    Mar 31, 2018
    Posts:
    19
    Here is the situation:
    I have objects that need to be rendered twice. First rendering is rendering to the scene, second rendering is rendering to the velocity buffer.
    Right now I use two materials for one sub-mesh. It hints me to uses multi-pass. I think it makes sense because we reduce GL state changes by that.
    To use multi-pass I encounter two problems:
    1. Do I need to write the second pass in the same shaderlab file? Then how do I do that for URP's Lit shader? Is copying it out from packages the only option?
    2. URP doesn't work like build-in pipeline which renders the shader passes in order. How do I render the object twice in URP without actually breaking GL state (mainly the vertex data)? I currently use render features to draw the mesh twice(which causes more GL state changes)
    Thanks!
     
    bashis likes this.