Render two pass at same time

Hi,

I’m having this problem, how can i render two pass at same time on Unity ?
i’m using Graphics.Blit(), but i can only use 1 …

Any ideas ?

What do you mean ‘at the same time?’

I have a shader, this shader have multiple pass (Tonemapper, Color Correction etc)

//Pass 0  
  Pass
   {
    CGPROGRAM
     #pragma vertex vert_Something
     #pragma fragment _Something
   
     ENDCG
}
//Pass 1
Pass
   {
    CGPROGRAM
     #pragma vertex vert_Something2
     #pragma fragment _Something2
   
     ENDCG
}

I want to render all this passes in one script and one shader, i made a c# script with a OnRenderImage() and a Graphics.Blit(), no matter how i try, i can only render one of this passes “Graphics.Blit(source,destination,material, here is the number of the pass)”
This is what i want to do, no idea how…

You need to do a blit per pass you have, we do this in one of our effects too.

Basically:

*Allocate a temp texture
*blit from src to a temp texture using pass 0
*blit from temp texture to dest using pass 1
*destroy the temp texture

You can’t just render all passes in a row as you need to swap the src / destination each time.

1 Like

Oh, i’m gonna try this and post the results later, thanks !!!