- Home /
iPhone shader help to simulate TV static, works but not on iPhone.
Can someone with shader knowledge take a look at this and tell me why it doesnt work on the iPhone. It was taken from the Wiki, and works in the editor using ES 2.0 graphics emulation, but no other emulation. When I build it to the iPhone device it doesn't run either.
I'm not sure what to look for or tweak in order to begin making it work on lower emulation settings or if it can be done at all. Thanks. You can also find the original code here, it doesnt seem to format correctly below...
Shader "FX/Hyperbolic Static" {
Properties { _Color ("Color Tint", Color) = (1,1,1,1) _Rate ("Oscillation Rate", Range (1, 500)) = 300 }
SubShader {
ZWrite Off Tags { "Queue" = "Transparent" } Blend One One
Pass {
CGPROGRAM
pragma vertex vert
pragma fragment frag
pragma fragmentoption ARB_fog_exp2
include "UnityCG.cginc"
float4 _Color; float _Rate;
struct v2f { float4 pos : SV_POSITION; float4 texcoord : TEXCOORD0; };
v2f vert (appdata_base v) { v2f o; o.pos = mul (UNITY_MATRIX_MVP, v.vertex); o.texcoord = v.texcoord; return o; }
half4 frag (v2f i) : COLOR { float3 color; float m; m = _Time[0] _Rate + ((i.texcoord[0]+i.texcoord1) 5000000 _Color.a _Color.a); m = sin(m) 0.5; color = float3(m _Color.r, m _Color.g, m _Color.b); return half4( color, 1 ); } ENDCG
}
} Fallback "Transparent/Diffuse" }
Answer by Jessy · Nov 15, 2010 at 05:05 AM
That shader only works with a programmable GPU. Old iOS devices don't have that, and newer ones require that you're using OpenGLES 2.0. You had the right idea with what you need in your other question, but this site is pitifully unequipped for us to help you with that; it's very text-based around here, and you need annotated screenshots and a .unitypackage. Ask on the forum and provide us with a .unitypackage to build off of, and I'll answer the question, with a link back to the forum.
Regarding OpenGLES 2.0...is that only available on the iPhone 4? I see it's an option to Target Platform Arm6+7 (1.2+2.0) but not a 2.0 only. Is the current iPad OpenGLES2.0 or 1.2?
The 3GS was the first 2.0 device. Everything iOS device since then has used the same GPU, other than the cheapest iPod touch model from 2009, which is not compatible with programmable shaders.
Regarding this...how can I force a build to use OpenGLES 2.0? I need to test a shader made with Strumpy's Shader Editor.
Ah, I see now a good usage for the forums... Attaching .unitypackages
. Jessy, would you happen to know why can't we have something like the way images currently work and host it on answers itself?
Your answer
Follow this Question
Related Questions
Is there a way to visually show the order in which geometry was rendered in your scene. 1 Answer
VertexLit Hilight Shader - Flicker on iOS Problem 1 Answer
Shader looks different on iPhone and Editor 2 Answers
Animated television static effect, techniques? iPhone shader 2 Answers
Displaying background layers effectively on iPhone 0 Answers