To use a grab pass, you need to follow these steps:
- Remove the Properties section, and the Input section; this shader will not use any of them.
- In the SubShader section, remove everything, and add the following to ensure the object is treated as being Transparent:
Tags{ "Queue" = "Transparent" }
- Then, below that, add a grab pass:
GrabPass{ }
- After the GrabPass, we will need to add this extra pass:
Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" sampler2D _GrabTexture; struct vertInput { float4 vertex : POSITION; }; struct vertOutput { float4 vertex : POSITION; float4 uvgrab : TEXCOORD1; }; // Vertex function vertOutput vert(vertInput v) { vertOutput o; o.vertex = mul(UNITY_MATRIX_MVP, ...