AlphaTint.shader 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
  2. // Unlit alpha-blended shader.
  3. // - no lighting
  4. // - no lightmap support
  5. // - no per-material color
  6. Shader "Unlit/TransparentTint" {
  7. Properties {
  8. _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
  9. _Color ("Tint Color", Color) = (1, 1, 1, 1)
  10. }
  11. SubShader {
  12. Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  13. LOD 100
  14. ZWrite Off
  15. Blend SrcAlpha OneMinusSrcAlpha
  16. Pass {
  17. CGPROGRAM
  18. #pragma vertex vert
  19. #pragma fragment frag
  20. #pragma target 2.0
  21. #pragma multi_compile_fog
  22. #include "UnityCG.cginc"
  23. struct appdata_t {
  24. float4 vertex : POSITION;
  25. float2 texcoord : TEXCOORD0;
  26. UNITY_VERTEX_INPUT_INSTANCE_ID
  27. };
  28. struct v2f {
  29. float4 vertex : SV_POSITION;
  30. float2 texcoord : TEXCOORD0;
  31. UNITY_FOG_COORDS(1)
  32. UNITY_VERTEX_OUTPUT_STEREO
  33. };
  34. sampler2D _MainTex;
  35. float4 _MainTex_ST;
  36. float4 _Color;
  37. v2f vert (appdata_t v)
  38. {
  39. v2f o;
  40. UNITY_SETUP_INSTANCE_ID(v);
  41. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  42. o.vertex = UnityObjectToClipPos(v.vertex);
  43. o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
  44. UNITY_TRANSFER_FOG(o,o.vertex);
  45. return o;
  46. }
  47. fixed4 frag (v2f i) : SV_Target
  48. {
  49. fixed4 col = tex2D(_MainTex, i.texcoord) * _Color;
  50. UNITY_APPLY_FOG(i.fogCoord, col);
  51. return col;
  52. }
  53. ENDCG
  54. }
  55. }
  56. }