我尝试让我的物体看起来像地铁游戏一样弯曲,所以我使用这个着色器,它的工作编辑器,但在Android设备上没有产生任何东西
我尝试让我的物体看起来像地铁游戏一样弯曲,所以我使用这个着色器,它的工作编辑器,但在Android设备上没有产生任何东西
Shader "Custom/CurvedWorld"
{
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 150
CGPROGRAM
#pragma surface surf Lambert noforwardadd vertex:vert
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
void vert( inout appdata_full v)
{
float4 _QOffset= float4(-5,-5,0,0);
float _Dist=100.0;
vv.xyz -= _WorldSpaceCameraPos.xyz;
float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
float zOff = vPos.z/_Dist;
vPos += _QOffset*zOff*zOff;
v.vertex = mul (vPos, UNITY_MATRIX_IT_MV);
v.texcoord = mul( UNITY_MATRIX_TEXTURE0, v.texcoord );
}
ENDCG
}
}