当前位置:   article > 正文

今天写shader流光效果,shader代码少了个括号,unity shader compiler卡死且不提示原因...

unity shader compiler

今天写shader流光效果,shader代码少了个括号,unity shader compiler卡死且不提示原因

 

好在找到了原因,shader 代码如下,原理是提高经过的颜色亮度

 

  1. void surf(Input IN, inout SurfaceOutputStandard o) {
  2. // Albedo comes from a texture tinted by color
  3. fixed2 scrolledUV = IN.uv_MainTex;
  4. fixed xScrollValue = 5 * _Time;
  5. fixed yScrollValue = 5 * _Time;
  6. scrolledUV += fixed2(xScrollValue, 0);
  7. fixed4 c = tex2D(_MainTex, IN.uv_MainTex);// *_Color;
  8. fixed4 d = tex2D(_FlowTex, scrolledUV);
  9. //if (d.a == 1) {
  10. if(d.a > 0.5) {
  11. o.Albedo = c.rgb;
  12. }
  13. else {
  14. o.Albedo = c.rgb + float3(d.a,d.a,d.a);
  15. }
  16. // Metallic and smoothness come from slider variables
  17. o.Metallic = _Metallic;
  18. o.Smoothness = _Glossiness;
  19. o.Alpha = c.a;
  20. }

  

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/109467?site
推荐阅读
相关标签
  

闽ICP备14008679号