Mask_Quad.shader 1000 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Shader "Custom/Green Screen/Mask Quad"
  2. {
  3. Properties
  4. {
  5. _MainTex("Texture", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. Tags{ "RenderType" = "Transparent"
  10. "Queue" = "Transparent-2"
  11. }
  12. Cull Off
  13. Lighting On
  14. ZWrite Off
  15. ZTest Always
  16. Blend SrcAlpha OneMinusSrcAlpha
  17. Pass
  18. {
  19. //Write in the stencil
  20. Stencil{
  21. Ref 129
  22. Comp always
  23. Pass replace
  24. }
  25. CGPROGRAM
  26. #pragma vertex vert
  27. #pragma fragment frag
  28. #include "UnityCG.cginc"
  29. struct appdata
  30. {
  31. float4 vertex : POSITION;
  32. float2 uv : TEXCOORD0;
  33. };
  34. struct v2f
  35. {
  36. float2 uv : TEXCOORD0;
  37. float4 vertex : SV_POSITION;
  38. };
  39. sampler2D _MainTex;
  40. float4 _MainTex_ST;
  41. float alpha;
  42. v2f vert(appdata v)
  43. {
  44. v2f o;
  45. //o.vertex = UnityObjectToClipPos(v.vertex);
  46. o.vertex = mul(mul(UNITY_MATRIX_P, UNITY_MATRIX_V), v.vertex);
  47. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  48. return o;
  49. }
  50. fixed4 frag(v2f i) : SV_Target
  51. {
  52. return fixed4(1,1,1,alpha);
  53. }
  54. ENDCG
  55. }
  56. }
  57. }