Guest User

Shader

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