combining surface shaders

I’m making a 3d viewer and I need to be able to make the object displayed switch between beeing opaque and translucent-like.
I made a surface shader for the opaque look,
and 2 surface shaders for the translucent look, 1 which renders the inside (Cull Front) opaque and blurred, then the other renders the outside slightly transparent.

I’m content with the effect, but now I would like to have this all in 1 shader.
Cause now I have 2 prefabs with 3 materials (1 for the opaque, 2 for the translucent) with all the same settings, just different shaders. And well that’s just not very clean, plus it’s a hassle to switch between the 2 looks, I have to switch between prefabs instead of just changing a boolean in the material.

Anyway, I tried combining them, but it appears surface shaders can’t be inside passes,
so does anyone have an idea of how to do this ?

Surface shaders can be inside passes, search the forum, quite a few threads about it.

I did, and it seemed to me they can’t, especially after reading http://forum.unity3d.com/threads/96393-Achieving-a-multi-pass-effect-with-a-Surface-Shader.
But alright, if you’re positive, i’ll look again, see if I can find what I need to know.

Supposedly this:

    //1st pass
    CGPROGRAM
    #pragma surface surf
    ...
    ENDCG
     
    //2nd pass
    CGPROGRAM
    #pragma surface surf
    ...
    ENDCG

should work,
but it doesn’t, at least, not in my case.

This is what I have:

Shader "Custom/BidonComplete" 

{ 

	Properties 

	{

		_Color ("bidon kleur", Color)  = (1.0, 1.0, 1.0, 1.0)

		_SpecColor ("Specular Color", Color) = (0.5,0.5,0.5,1.0)

		_Shininess ("Shininess", Range (0.01, 1)) = 0.078125

		_MainTex ("bidon bedrukking", 2D) = "bidon bedrukking" {}

		_Aspect ("Texture Aspect", Float) = 2.0

		_Blur ("Blur Width", Float) = 0.01

	}



	Subshader 

	{ 

		Tags 

		{ 

			"RenderType" = "Opaque" 

		}

		

		LOD 300

		Cull Front

		//ZWrite Off

		

			CGPROGRAM

			#pragma surface surf BlinnPhong

			#pragma target 3.0

	

			sampler2D _MainTex;

			fixed4 _Color;

			half _Shininess;

			half _Aspect;

			half _Blur;

	

			struct Input 

			{

				float2 uv_MainTex;

			};

	

			void surf(Input IN, inout SurfaceOutput o) 

			{

				...

			}

	

			ENDCG

		

			Tags 

			{ 

				"Queue" = "Transparent"

				"RenderType" = "Transparent" 

			}

	

			Blend SrcAlpha OneMinusSrcAlpha 

			LOD 300

			//Cull Front

			//ZWrite Off

	

			CGPROGRAM

			#pragma surface surf BlinnPhong

			#pragma target 3.0

	

			sampler2D _MainTex;

			fixed4 _Color;

			half _Shininess;

	

			struct Input 

			{

				float2 uv_MainTex;

			};

	

			void surf(Input IN, inout SurfaceOutput o) 

			{
				
				...

			}

	

			ENDCG

	}



	FallBack "Diffuse"

}

It’d be easier to see what’s happening if you could post some images of the desired effect and of the current effect with it’s issues.

There isn’t musch to show, it just ignores the second pass completely it seems,
I just get the same result as when only using the first shader (the opaque one).

Use pragma debug and look at the compiled shader code, might give you a clue as to what’s going wrong.