【日常记录】Unity3D 中的 Surface Shader 是不支持在 Pass中使用的,因为自动生成了 Pass

如题

搞了好久,一直报错:

Shader error in 'custom_outline_effect': Parse error: syntax error, unexpected TOK_PASS, expecting TOK_SETTEXTURE or '}' at line 69

只要是把 #pragma surface ... 写在 Pass中就算出错,这种情况只要不写 Pass{} 中就行了,因为会自动生成的

复制代码
 1         Pass { // 这样写会报错,使用 surface 不需要写在 Pass 中
 2                 CGPROGRAM
 3                     #pragma surface surf Lambert
 4 
 5                     sampler2D _MainTex;
 6 
 7                     struct Input {
 8                         float2 uv_MainTex;
 9                     };
10 
11                     void surf (Input IN, inout SurfaceOutput o) {
12                         half4 c = tex2D (_MainTex, IN.uv_MainTex);
13                         o.Albedo = c.rgb;
14                         o.Alpha = c.a;
15                     }
16                  ENDCG
17         }
复制代码

 

本文作者:endlesstravel

本文链接:https://www.cnblogs.com/night-ride-depart/p/7258307.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   endlesstravel  阅读(4986)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起