Getting Xray shader working on iPhone (431789)

Hi I was wondering if anyone could help me solve my problem getting the XRay shader to work on iOS. Here’s the code for it.

http://www.unifycommunity.com/wiki/index.php?title=XRay

When I run it in Emulation OpenGL ES2.0 mode inside Unity, it renders fine, but turns purple on the Phone itself or in emulation OpenGL ES1.1 mode.

My phone is a 3GS and it’s compiling in ARM7 mode. #define USE_OPENGLES20_IF_AVAILABLE 1

Is there any reason this Shader shouldn’t work? If so, is there any alternative?

Thanks!

Is there any way to make sure I’m running ES 2.0?

Yeah, choose ES 2.0 in your player settings

Did you ever find a solution to this?

To answer my own question this is what I came up with

Shader "My Shaders/XRay" {
    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" }
        //Blend One One
        Blend One OneMinusSrcColor
        Pass {

			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"
}

Basically replace the setTexture line with a frag