any way to tell if my shader will work on iOS without trying it on hardware ?

modified a rim shader into a nice xray view shader, works great on pc and mac, but renders flat magenta on iPad3
How can I tell if my shaders wil run ok on device ? or get any feedback as to how to modify/fix it.

The shader seems simple enough, but it has 3 passes. (turning on and off z-test and write in different passes)
is there a limit on number of passes ?

There is no limit on passes. Unity is not at all perfect when it comes to emulating other hardware for graphics compatibility, but have you tried setting the editor to iOS mode and graphics emulation to GLES 2.0?

thanks, hadn’t thought of that… will try it now…

.
trying…

yup, fails on GLES2.0 damn shame, that was a nice shader, :confused:
(error, requires both a pixel shader and vertex shader, in one of my passes)
I’ll make a simpler fallback version

Thanks much

GLES 2.0 supports programmable pipeline shaders, so there’s no inherent problem with vertex/fragment combinations. Perhaps you could provide the shader code, and someone might be able to spot the incompatibility.

OK both versions here, are modified versions of other xray/rim shaders I found from wiki or forums.
I added the passes and ztest/write changes, so that the alpha sorting looks clean, and it renders on top of objects.

They both look great, and work fine on PC.

But on iOS device The first one errors out, and the second one works.
Maybe cos the first one is missing a fragment shader ?
I’m no shader expert yet, but would like to know exactly why ? thanks

Shader "XRay" 
	{
    Properties {
        _Color ("Tint (RGB)", Color) = (1,1,1,1)
        _RampTex ("Facing Ratio Ramp (RGB)", 2D) = "white" {} 
    }
    
    
    SubShader 
    {
    	//Tags { "Queue"="Transparent+1" }
        Tags { "Queue" = "Overlay" }         
  
    
   		Pass
		{
  			 ZTest Off
   			 ZWrite On			
   			 Blend Zero One
   			 
			SetTexture [_MainTex] 
			{
				combine texture
			}
		}      
          

   		Pass
		{
  			 ZTest LEqual
   			 ZWrite On			
   			 Blend Zero One
   			 
			SetTexture [_MainTex]
			{
				combine texture
			}
		}
		    
    

        Pass 
        	{
		    	//ZTest Always
		    	ZTest LEqual
		        ZWrite Off
		        //Tags { "Queue" = "Transparent" }
				//Tags { "Queue"="Transparent+1" }
		        //Tags { "Queue" = "Overlay" }        
		        Blend One One            
		        
	            CGPROGRAM 
				// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
				#pragma exclude_renderers gles
	            #pragma vertex vert
	            #include "UnityCG.cginc" 
	
	            struct v2f 
	            {
	                float4 pos : SV_POSITION;
	                float4 uv : TEXCOORD0;
	            };
	            
	            v2f vert (appdata_base v) 
	            {
	                v2f o;
	                o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
	                float3 viewDir = normalize(ObjSpaceViewDir(v.vertex));
	                o.uv = float4( dot(viewDir,v.normal), 0.5, 0.0, 1.0 );
	                return o;
	            }
	            ENDCG 
	
	            SetTexture [_RampTex] {constantColor[_Color] combine texture * constant} 
        	}
        	
        	
       /*  ZTest Off	
    	Pass
		{
			Blend One One
			SetTexture [_MainTex]
			{
				constantColor[_Color]
			}
		}  */     	
    }    
    
    Fallback "XRay2"
}

the one that works on iOS…

Shader "XRay-cloud" {

    Properties {

        _Color ("Tint (RGB)", Color) = (1,1,1,1)

        _RampTex ("Facing Ratio Ramp (RGB)", 2D) = "white" {}

    }

SubShader {

        Cull Off //turn this on if using Blend One One
        ZWrite Off

        //Tags { "RenderType"="Opaque" "Queue" = "Transparent" "VisibleInDepth"="On"  "Queue" = "Overlay"}
        Tags { "RenderType"="Opaque" "Queue" = "Overlay" "VisibleInDepth"="On"  }

        //Blend One One
        
        
    	Pass
		{
  			 ZTest Off
   			 ZWrite On			
   			 Blend Zero One
   			 
			SetTexture [_MainTex] 
			{
				combine texture
			}
		}      
          

   		Pass
		{
  			 ZTest LEqual
   			 ZWrite On			
   			 Blend Zero One
   			 
			SetTexture [_MainTex]
			{
				combine texture
			}
		}
		           
        

         Pass {
     			  //Blend One OneMinusSrcColor
    			  Blend One One
		    	ZTest LEqual
		        ZWrite Off
 

            CGPROGRAM

            #pragma vertex vert

            #pragma fragment frag

            

            #include "UnityCG.cginc"

            

            float4 _Color;

            sampler2D _RampTex;

            

            struct v2f {

                float4  pos : SV_POSITION;

                float2  uv : TEXCOORD0;

            };

            

            float4 _RampTex_ST;

 

           v2f vert (appdata_base v) {

                v2f o;

                o.pos = mul (UNITY_MATRIX_MVP, v.vertex);

                float3 viewDir = normalize(ObjSpaceViewDir(v.vertex));

                o.uv = float4( abs(dot(viewDir,v.normal)), 0.5, 0.0, 1.0 );

                return o;

            }

 

 

            half4 frag (v2f i) : COLOR

            {

                half4 texcol = tex2D (_RampTex, i.uv);

                return texcol * _Color;

            }

            ENDCG

 

    }

}

Fallback "VertexLit"

}

In your first shader

// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.

Isn’t that the reason? iPad 3 uses OpenGL ES

You need a vertex and fragment defined. That is why the second one works. I don’t think the second one will have any more overhead than the first.

Thanks, yeah seems odd. Still trying to understand how it all works. Second one seems more involved as it included definition for fragment shader, but that’s the one that works.
I guess to make the first one work, would just need to include simple description of frag shader ?

The fragment program from the second shader should work fine in the first.

Thanks Daniel