Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "GrabTexBug"
- {
- Properties
- {
- [PerRendererData]
- _MainTex ("Sprite Texture", 2D) = "white" {}
- _Color ("Tint", Color) = (1,1,1,1)
- }
- SubShader
- {
- Tags
- {
- "Queue" = "Transparent"
- "RenderType" = "Transparent"
- }
- Cull Off
- Lighting Off
- ZWrite Off
- Blend SrcAlpha OneMinusSrcAlpha
- GrabPass { }
- Pass
- {
- CGPROGRAM
- #include "UnityCG.cginc"
- #pragma vertex ComputeVertex
- #pragma fragment ComputeFragment
- sampler2D _MainTex;
- sampler2D _GrabTexture;
- fixed4 _Color;
- struct VertexInput
- {
- float4 vertex : POSITION;
- float4 color : COLOR;
- float2 texcoord : TEXCOORD0;
- };
- struct VertexOutput
- {
- float4 vertex : SV_POSITION;
- fixed4 color : COLOR;
- half2 texcoord : TEXCOORD0;
- float4 screenPos : TEXCOORD1;
- };
- VertexOutput ComputeVertex (VertexInput vertexInput)
- {
- VertexOutput vertexOutput;
- vertexOutput.vertex = mul(UNITY_MATRIX_MVP, vertexInput.vertex);
- vertexOutput.screenPos = vertexOutput.vertex;
- vertexOutput.texcoord = vertexInput.texcoord;
- vertexOutput.color = vertexInput.color * _Color;
- return vertexOutput;
- }
- fixed4 ComputeFragment (VertexOutput vertexOutput) : SV_Target
- {
- return tex2D(_GrabTexture, vertexOutput.texcoord);
- }
- ENDCG
- }
- }
- Fallback "Sprites/Default"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement