- Home /
Question by
Lightmare_Studios · Jun 20, 2012 at 08:01 AM ·
iphonecompatibility
Shader Incompatible with iPhone
Hi everyone,
We have a relatively simple shader for our iPhone game, which draws our background tiles so that they're all aligned based on worldspace rather than the orientation of the tile. The problem is, this shader doesn't work won iOS (or when running the game on a mac, for that matter), and uses the fallback shader every time. We're at a loss as to how to make this shader run on iOS The issue happens regardless of if we use armv6 or armv7.
Here's the shader code:
Shader "Mobile/Diffuse_FogMod_WorldSpaceUV"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Tags {"Queue"="Geometry" "RenderType"="Opaque" }
LOD 150
Lighting off
CGPROGRAM
#pragma surface surf Lambert vertex:vert
sampler2D _MainTex;
struct Input
{
fixed4 color;
fixed2 WP_Coords;
};
void vert (inout appdata_full v, out Input o)
{
//texture uv's are worldspace to eliminate tile uv repetition, and have snazzy tile blending
fixed4 vertex = mul(_Object2World, v.vertex);
o.color.x = vertex.z;
o.color.y = vertex.y;
o.WP_Coords.xy = vertex.xy; //WP = WorldProjection
o.color.z = v.color.z;
}
void surf (Input IN, inout SurfaceOutput o)
{
fixed _MainTexScale = 0.32;
fixed4 c = tex2D(_MainTex, IN.WP_Coords.xy * _MainTexScale);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Mobile/Diffuse"
}
Thanks for your help.
Comment
Your answer
