// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) // "Legacy Shaders/Transparent/Diffuse" Shader "XGame/TestCloud" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {} _ScrollY ("Scroll Speed", Range(0, 1)) = 1 } SubShader { Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} LOD 200 CGPROGRAM #pragma surface surf NoLight alpha:fade noforwardadd sampler2D _MainTex; fixed4 _Color; float _ScrollY; struct Input { float2 uv_MainTex; }; float2 ModuloUV(float2 uv) { // 取模运算,返回小数部分 // uv.y -= floor(uv.y); return uv - floor(uv); // return frac(uv); } void surf (Input IN, inout SurfaceOutput o) { fixed4 c = tex2D(_MainTex, ModuloUV(IN.uv_MainTex + float2(0, _ScrollY * _Time.y))) * _Color; o.Albedo = c.rgb; o.Alpha = c.a; } //光照方程,名字为Lighting接#pragma suface后的光照方程名称 //lightDir :顶点到光源的单位向量 //viewDir :顶点到摄像机的单位向量 //atten :关照的衰减系数 float4 LightingNoLight(SurfaceOutput s, float3 lightDir,half3 viewDir, half atten) { float4 c ; c.rgb = s.Albedo; c.a = s.Alpha; return c; } ENDCG } Fallback "Unlit/Transparent" }