源战役客户端
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

73 rader
2.2 KiB

1 månad sedan
  1. Shader "MyShader/FlowingLight" {
  2. Properties {
  3. _MainTex ("MainTex", 2D) = "white" {}
  4. _Color ("Color", Color) = (0.5,0.5,0.5,1)
  5. _Brighteen ("Brighteen", Range(0, 10)) = 1
  6. _Uspeed ("U speed", Range(-10, 10)) = 0
  7. _VSpeed ("V Speed", Range(-10, 10)) = 1
  8. }
  9. SubShader {
  10. Tags {
  11. "IgnoreProjector"="True"
  12. "Queue"="Transparent"
  13. "RenderType"="Transparent"
  14. }
  15. LOD 200
  16. Pass {
  17. Name "FORWARD"
  18. Tags {
  19. "LightMode"="ForwardBase"
  20. }
  21. Blend SrcAlpha One
  22. Cull Off
  23. ZWrite Off
  24. Fog { Mode off }
  25. CGPROGRAM
  26. #pragma vertex vert
  27. #pragma fragment frag
  28. #include "UnityCG.cginc"
  29. #pragma multi_compile_fwdbase
  30. #pragma target 3.0
  31. uniform float4 _TimeEditor;
  32. uniform sampler2D _MainTex; uniform fixed4 _MainTex_ST;
  33. uniform fixed4 _Color;
  34. uniform fixed _Brighteen;
  35. uniform half _Uspeed;
  36. uniform half _VSpeed;
  37. struct VertexInput {
  38. float4 vertex : POSITION;
  39. float2 texcoord0 : TEXCOORD0;
  40. fixed4 vertexColor : COLOR;
  41. };
  42. struct VertexOutput {
  43. float4 pos : SV_POSITION;
  44. float2 uv0 : TEXCOORD0;
  45. fixed4 vertexColor : COLOR;
  46. };
  47. VertexOutput vert (VertexInput v) {
  48. VertexOutput o = (VertexOutput)0;
  49. o.vertexColor = v.vertexColor * _Color;
  50. o.pos = UnityObjectToClipPos(v.vertex );
  51. float t = _Time.g + _TimeEditor.g;
  52. float2 uv = v.texcoord0 + float2(_Uspeed,_VSpeed) * t;
  53. o.uv0 = TRANSFORM_TEX(uv, _MainTex);
  54. return o;
  55. }
  56. fixed4 frag(VertexOutput i) : SV_Target {
  57. fixed4 mainColor = tex2D(_MainTex, i.uv0);
  58. fixed3 emissive = ((_Brighteen*mainColor.rgb)*i.vertexColor.rgb);
  59. return fixed4(emissive * mainColor.a * i.vertexColor.a, 1);
  60. }
  61. ENDCG
  62. }
  63. }
  64. }