源战役客户端
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

57 lignes
1.4 KiB

  1. Shader "MyShader/VertexAlpha"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. _Color ("Main Color", Color) = (1,1,1,1)
  7. }
  8. SubShader
  9. {
  10. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
  11. Blend SrcAlpha OneMinusSrcAlpha
  12. LOD 200
  13. Pass
  14. {
  15. CGPROGRAM
  16. #pragma vertex vert
  17. #pragma fragment frag
  18. #include "UnityCG.cginc"
  19. struct appdata
  20. {
  21. float4 vertex : POSITION;
  22. fixed4 color : COLOR;
  23. float2 uv : TEXCOORD0;
  24. };
  25. struct v2f
  26. {
  27. float2 uv : TEXCOORD0;
  28. float4 vertex : SV_POSITION;
  29. fixed vertexAlpha : TEXCOORD1;
  30. };
  31. sampler2D _MainTex;
  32. float4 _MainTex_ST;
  33. fixed4 _Color;
  34. v2f vert (appdata v)
  35. {
  36. v2f o;
  37. o.vertex = UnityObjectToClipPos(v.vertex);
  38. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  39. o.vertexAlpha = v.color.a;
  40. return o;
  41. }
  42. fixed4 frag (v2f i) : SV_Target
  43. {
  44. fixed4 col = tex2D(_MainTex, i.uv);
  45. col.a = i.vertexAlpha;
  46. col *= _Color;
  47. return col;
  48. }
  49. ENDCG
  50. }
  51. }
  52. }