Search Unity

Iterate Pass

Discussion in 'Shaders' started by dacostaleo, Jul 31, 2014.

  1. dacostaleo

    dacostaleo

    Joined:
    Dec 12, 2013
    Posts:
    2
    Hello. I have a question.

    I'm trying to do a flur shader, and i need too "execute" the same shader pass multiple times "N times" (The shader pass take a value "N" and displace the vertex position pos = pos + normal * N;)
    Is possible to iterate in the subshader? something like:

    SubShader {
    for (int N = 0; N < max; N++){
    Pass{}
    }
    }

    Thanks for the help.
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    No, you have to write each pass explicitly. They can, however, share code from a CGINCLUDE block.
     
    dacostaleo likes this.
  3. dacostaleo

    dacostaleo

    Joined:
    Dec 12, 2013
    Posts:
    2
    Thanks! :)