Hello, I'm testing camera effect from this tutorial http://www.gamasutra.com/blogs/SvyatoslavCherkasov/20140531/218753/Shader_tutorial_CRT_emulation.php. Everything works well on pc, but when I run this on android (OnePlusOne) there are only shades of red This is my shader code: Code (CSharp): Shader "Custom/RetroShader" { Properties { _MainTex("Base (RGB)", 2D) = "white" {} } SubShader { Pass { ZTest Always Cull Off ZWrite Off Fog{ Mode off } CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest #include "UnityCG.cginc" #pragma target 3.0 struct v2f { float4 pos : POSITION; float2 uv : TEXCOORD0; float4 scr_pos : TEXCOORD1; }; uniform sampler2D _MainTex; v2f vert(appdata_img v) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.uv = MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); o.scr_pos = ComputeScreenPos(o.pos); return o; } half4 frag(v2f i) : COLOR { half4 color = tex2D(_MainTex, i.uv); float2 ps = i.scr_pos.xy *_ScreenParams.xy / i.scr_pos.w; int pp = (int)(ps.x) % 3; float4 outcolor = float4(0, 0, 0, 1); if (pp == 0) outcolor.r = color.r; else if (pp == 1) outcolor.g = color.g; else if (pp == 2) outcolor.b = color.b; return outcolor; } ENDCG } } FallBack "Diffuse" }
I tried to make another simple effect of scanlines every 2 pixels but it doesn't work on android either. This is my code: Code (CSharp): Shader "Custom/RetroShader" { Properties { _MainTex("Base (RGB)", 2D) = "white" {} } SubShader { Pass { ZTest Always Cull Off ZWrite Off Fog{ Mode off } CGPROGRAM #pragma vertex vert #pragma fragment frag //#pragma fragmentoption ARB_precision_hint_fastest #include "UnityCG.cginc" //#pragma target 3.0 struct v2f { float4 pos : POSITION; float2 uv : TEXCOORD0; float4 scr_pos : TEXCOORD1; }; uniform sampler2D _MainTex; v2f vert(appdata_img v) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.uv = MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); o.scr_pos = ComputeScreenPos(o.pos); return o; } half4 frag(v2f i) : COLOR { half4 color = tex2D(_MainTex, i.uv); float2 ps = i.scr_pos.xy *_ScreenParams.xy / i.scr_pos.w; int yPos = (int)(ps.y); if (((yPos / 2) & 1) == 0) { color *= 0.5f; } return color; } ENDCG } } FallBack "Diffuse" } I completely don't know what's wrong :/ It works perfectly on pc.