use 2 or more passes in surface shader?

How would this be possible?

Or, how can i duplicate vertices in a vertex frag without using additional passes?

I’m not exactly sure about the limitations (as surface shaders produce multiple passes), but I managed to add extra (non-surface shader) passes like this:

	SubShader 
	{
		Pass {Colormask 0}

		CGPROGRAM
		#pragma surface surf BlinnPhong alpha
		// surface shader code
		ENDCG
	}

Just make sure to keep the cgprogram outside any pass blocks. For this simple case of transparent z-culling the multiple passes work fine (although I never tested it with deferred shading).

If you need surface shaders for both passes, I don’t think it is possible. You should probably just use 2 materials in that case.

To be more clear, I will need both the vertex and frag functions to be in several passes like a fur shader, or any other way of duplicating same vertices in one pass is also okay.

Surface shaders generate a number of passes, and aren’t compatible with the addition of arbitrary passes. If you’d like to build a shader that uses multiple passes for each rendering stage, you should compile your current surface shader with the #pragma debug directive, and then work from the code produced by that.

if you need smth like fur shader effect, you can either duplicate your object several times or add several materials with different offset parameter instead.

I am not aware of any other easy way to get several surface passes :expressionless: