Passes and CGPROGRAM

Hi there,

today I tried to get a grip on unity shaders. I watched several tutorials and read the references. I managed to write some shaders which use passes and wrote shaders that used CGPROGRAM with the this pragma-string #pragma surface surf BlinnPhong.
I had no success combining the two (passes and CGPROGRAM). I already found out that you can use CGPROGRAM fragment shaders with passes. Could somebody shed some light on using passes and CGPROGRAM in combination?
Thanks a lot!
Tim

Each pass that’s not a surface shader needs to be contained within Pass{} parentheses.

Surface shaders don’t go within these tags because they essentially generate their own when compiled. So if you simply act as if your surface shader is adding it’s own Pass tags, it should make a bit more sense.

Aside from that, you can simply add Passes before or after the surface shader CGPROGRAM block as per usual.

The examples here might be useful;
http://forum.unity3d.com/threads/96393-Achieving-a-multi-pass-effect-with-a-Surface-Shader

That helps! Thanks, Farfarer!!