XGame-TestCloud.shader 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
  2. // "Legacy Shaders/Transparent/Diffuse"
  3. Shader "XGame/TestCloud"
  4. {
  5. Properties
  6. {
  7. _Color ("Main Color", Color) = (1,1,1,1)
  8. _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
  9. _ScrollY ("Scroll Speed", Range(0, 1)) = 1
  10. }
  11. SubShader
  12. {
  13. Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  14. LOD 200
  15. CGPROGRAM
  16. #pragma surface surf NoLight alpha:fade noforwardadd
  17. sampler2D _MainTex;
  18. fixed4 _Color;
  19. float _ScrollY;
  20. struct Input
  21. {
  22. float2 uv_MainTex;
  23. };
  24. void surf (Input IN, inout SurfaceOutput o)
  25. {
  26. fixed4 c = tex2D(_MainTex, IN.uv_MainTex + float2(0, _ScrollY * _Time.y)) * _Color;
  27. o.Albedo = c.rgb;
  28. o.Alpha = c.a;
  29. }
  30. //光照方程,名字为Lighting接#pragma suface后的光照方程名称
  31. //lightDir :顶点到光源的单位向量
  32. //viewDir :顶点到摄像机的单位向量
  33. //atten :关照的衰减系数
  34. float4 LightingNoLight(SurfaceOutput s, float3 lightDir,half3 viewDir, half atten)
  35. {
  36. float4 c ;
  37. c.rgb = s.Albedo;
  38. c.a = s.Alpha;
  39. return c;
  40. }
  41. ENDCG
  42. }
  43. Fallback "Legacy Shaders/Transparent/VertexLit"
  44. }