Guest User

Untitled

a guest
Jan 19th, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. Shader "Unlit/unlit"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. Tags { "RenderType"="Transparent" }
  10. LOD 100
  11. Blend SrcAlpha OneMinusSrcAlpha
  12.  
  13.  
  14. Pass
  15. {
  16. CGPROGRAM
  17.  
  18. #pragma vertex vert
  19. #pragma fragment frag alpha
  20. // make fog work
  21. #pragma multi_compile_fog
  22. #pragma enable_d3d11_debug_symbols
  23.  
  24. #include "UnityCG.cginc"
  25.  
  26. struct appdata
  27. {
  28. float4 vertex : POSITION;
  29. float2 uv : TEXCOORD0;
  30. };
  31.  
  32. struct v2f
  33. {
  34. float2 uv : TEXCOORD0;
  35. float4 worldPos : TEXCOORD1;
  36. UNITY_FOG_COORDS(1)
  37. float4 vertex : SV_POSITION;
  38. };
  39.  
  40. struct q {
  41. float4 c;
  42. };
  43.  
  44. sampler2D _MainTex;
  45. float4 _MainTex_ST;
  46.  
  47. v2f vert (appdata v)
  48. {
  49. v2f o;
  50. o.worldPos = mul(unity_ObjectToWorld, v.vertex);
  51. o.vertex = UnityObjectToClipPos(v.vertex);
  52. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  53. UNITY_TRANSFER_FOG(o,o.vertex);
  54. return o;
  55. }
  56.  
  57. fixed4 frag (v2f i) : SV_Target
  58. {
  59. // sample the texture
  60. fixed4 col = tex2D(_MainTex, i.uv);
  61. col.a = 0.0;
  62. // apply fog
  63. UNITY_APPLY_FOG(i.fogCoord, col);
  64.  
  65. if (i.worldPos.y > 1.0) {
  66. col.a = 1.0;
  67. }
  68. else {
  69. col.a = i.worldPos.y;
  70. }
  71.  
  72.  
  73. return col;
  74. }
  75. ENDCG
  76. }
  77. }
  78. }
Add Comment
Please, Sign In to add comment