unity中使用sur着色器编写卡通光照模型。

来源:互联网 发布:中华人民网络安全法 编辑:程序博客网 时间:2024/04/29 00:35
先看代码: 
 half4 LightingCustomLambert (SurfaceOutput s, half3 lightDir, half3 viewDir, half atten) {   half NdotL = dot (s.Normal, lightDir);   half4 c;   c.rgb = (s.Albedo * _LightColor0.rgb * (tex2D (_RampMamp, half2 (NdotL * 0.5 + 0.5, 0)))) * (atten * 2);   c.a = s.Alpha;   return c;  }
主要是在Properties中声明一张渐变贴图:
0 0
原创粉丝点击