我尝试制作具有阴影效果的统一曲线着色器?

我试图做阴影效果的弧形着色器我有一个现有的弧形着色器在github中,它没有阴影效果,我尝试修改它,但我找不到任何合适的解决scheme。

Shaderor帮助脚本链接: https ://gist.github.com/g0ody/5550039

Curved.shader:

Shader“Platogo / Curved”{属性{_MainTex(“Base(RGB)”,2D)=“white”{} _QOffset(“Offset”,Vector)=(0,0,0,0)_Dist(“Distance”,浮动)= 100.0} SubShader {Tags {“RenderType”=“Opaque”}通过{照明closures

CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" sampler2D _MainTex; float4 _QOffset; float _Dist; uniform float4 _MainTex_ST; struct v2f { float4 pos : SV_POSITION; float2 uv : TEXCOORD0; }; v2f vert (appdata_base v) { v2f o; float4 vPos = mul (UNITY_MATRIX_MV, v.vertex); float zOff = vPos.z/_Dist; vPos += _QOffset*zOff*zOff; o.pos = mul (UNITY_MATRIX_P, vPos); o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); return o; } half4 frag (v2f i) : COLOR { return tex2D(_MainTex, i.uv); } ENDCG } } FallBack "Mobil/Unlit" 

}

CurvedAlpha.shader

Shader“Platogo / CurvedAlpha”{属性{_MainTex(“Base(RGB)”,2D)=“white”{} _QOffset(“Offset”,Vector)=(0,0,0,0)_Dist(“Distance”, SubShader {Tags {“Queue”=“Transparent”“IgnoreProjector”=“True”“RenderType”=“Transparent”} LOD 100

  ZWrite On Blend SrcAlpha OneMinusSrcAlpha Pass { Lighting Off CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" sampler2D _MainTex; float4 _QOffset; float _Dist; float _Alpha; uniform float4 _MainTex_ST; struct v2f { float4 pos : SV_POSITION; float2 uv : TEXCOORD0; }; v2f vert (appdata_base v) { v2f o; float4 vPos = mul (UNITY_MATRIX_MV, v.vertex); float zOff = vPos.z/_Dist; vPos += _QOffset*zOff*zOff; o.pos = mul (UNITY_MATRIX_P, vPos); o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); return o; } half4 frag (v2f i) : COLOR { return tex2D(_MainTex, i.uv) * float4(1,1,1,_Alpha); } ENDCG } } 

FallBack“Platogo /不亮纹理Alpha”}

我需要的样品