Search Unity

Multi-pass simplicity

Discussion in 'Shaders' started by MattFS, Oct 31, 2009.

  1. MattFS

    MattFS

    Joined:
    Jul 14, 2009
    Posts:
    219
    hey,
    Was wondering if Unity supports a 'scripted' multi-pass setting in the shaders?
    The only multi-pass example I could find was the fur shader on these forums - but the author has manually copy/pasted the Pass 'x' times.

    Other engines/shader systems I've worked with allow something along the lines of:
    Code (csharp):
    1.  
    2. SubShader{
    3.    LoopPass [string passName] [int count]
    4.    Pass "Foo"
    5.    {
    6.    }
    7. }
    There would also be a constant set each pass by the engine to reflect the current pass count.

    Does something like this exist in Unity - if not, are there plans for something like this?

    Cheers!
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Looping through passes isn't supported in Shaderlab, and I don't expect it ever will be. You could build the shader from a script, and add passes procedurally that way.
     
  3. MattFS

    MattFS

    Joined:
    Jul 14, 2009
    Posts:
    219
    Yeh, I guess it's "bang for the buck", can only see grass/fur benefiting from it, and only then during dev time.
    Cheers!