Hi,
I would like to lerp textures in a shader depending on the world position. My shader works so far in the editor and on iOS 5.1.1 but on iOS 6 the bottom texture (_SecondTex) is not visible.
@edit the second texture is not ‘not visible’, it’s just black.
Shader "Custom/TestShader" {
Properties {
_MainTex("Top", 2D) = "white" {}
_SecondTex("Bottom", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
sampler2D _SecondTex;
struct Input {
float2 uv_MainTex;
float2 uv_SecondTex;
float3 worldPos;
};
void surf (Input IN, inout SurfaceOutput o) {
float4 Tex2D0 = tex2D(_MainTex, IN.uv_MainTex);
float4 Tex2D1 = tex2D(_SecondTex, IN.uv_SecondTex);
float4 Lerp0 = lerp(Tex2D1, Tex2D0, clamp(IN.worldPos.y * 10, 0, 1));
o.Albedo = Lerp0.rgb;
o.Alpha = Lerp0.a;
}
ENDCG
}
FallBack "Diffuse"
}
Did I do something wrong or is there an issue on iOS6?
I also tried to use ShaderLab but don’t know how to get the world position then.