Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. Shader "GrabTexBug"
  2. {
  3. Properties
  4. {
  5. [PerRendererData]
  6. _MainTex ("Sprite Texture", 2D) = "white" {}
  7. _Color ("Tint", Color) = (1,1,1,1)
  8. }
  9.  
  10. SubShader
  11. {
  12. Tags
  13. {
  14. "Queue" = "Transparent"
  15. "RenderType" = "Transparent"
  16. }
  17.  
  18. Cull Off
  19. Lighting Off
  20. ZWrite Off
  21. Blend SrcAlpha OneMinusSrcAlpha
  22.  
  23. GrabPass { }
  24.  
  25. Pass
  26. {
  27. CGPROGRAM
  28.  
  29. #include "UnityCG.cginc"
  30.  
  31. #pragma vertex ComputeVertex
  32. #pragma fragment ComputeFragment
  33.  
  34. sampler2D _MainTex;
  35. sampler2D _GrabTexture;
  36. fixed4 _Color;
  37.  
  38. struct VertexInput
  39. {
  40. float4 vertex : POSITION;
  41. float4 color : COLOR;
  42. float2 texcoord : TEXCOORD0;
  43. };
  44.  
  45. struct VertexOutput
  46. {
  47. float4 vertex : SV_POSITION;
  48. fixed4 color : COLOR;
  49. half2 texcoord : TEXCOORD0;
  50. float4 screenPos : TEXCOORD1;
  51. };
  52.  
  53. VertexOutput ComputeVertex (VertexInput vertexInput)
  54. {
  55. VertexOutput vertexOutput;
  56.  
  57. vertexOutput.vertex = mul(UNITY_MATRIX_MVP, vertexInput.vertex);
  58. vertexOutput.screenPos = vertexOutput.vertex;
  59. vertexOutput.texcoord = vertexInput.texcoord;
  60. vertexOutput.color = vertexInput.color * _Color;
  61.  
  62. return vertexOutput;
  63. }
  64.  
  65. fixed4 ComputeFragment (VertexOutput vertexOutput) : SV_Target
  66. {
  67. return tex2D(_GrabTexture, vertexOutput.texcoord);
  68. }
  69.  
  70. ENDCG
  71. }
  72. }
  73.  
  74. Fallback "Sprites/Default"
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement