Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. Shader "Projector/Solid Projector" {
  2. Properties{
  3. _Color("Tint Color", Color) = (1,1,1,1)
  4. _ShadowTex("Cookie", 2D) = "gray" {}
  5. }
  6. Subshader
  7. {
  8. Tags {"Queue" = "Transparent" "RenderType" = "Transparent"}
  9. Pass
  10. {
  11. ZWrite Off
  12. // Premultiplied alpha
  13. Blend One OneMinusSrcAlpha
  14. Offset -1, -1
  15.  
  16. CGPROGRAM
  17. #pragma vertex vert
  18. #pragma fragment frag
  19. #include "UnityCG.cginc"
  20.  
  21. struct v2f {
  22. float4 uvShadow : TEXCOORD0;
  23. float4 pos : SV_POSITION;
  24. };
  25.  
  26. float4x4 unity_Projector;
  27. float4x4 unity_ProjectorClip;
  28.  
  29. v2f vert(float4 vertex : POSITION)
  30. {
  31. v2f o;
  32. o.pos = UnityObjectToClipPos(vertex);
  33. o.uvShadow = mul(unity_Projector, vertex);
  34. return o;
  35. }
  36.  
  37. // This texture contains the decal camera's output
  38. sampler2D _ShadowTex;
  39. fixed4 _Color;
  40.  
  41. fixed4 frag(v2f i) : SV_Target
  42. {
  43. fixed4 texCookie = tex2Dproj(_ShadowTex, UNITY_PROJ_COORD(i.uvShadow));
  44. fixed4 outColor = _Color * texCookie;
  45.  
  46. // This tweak is needed to get around gamma color space issues;
  47. // if you're using linear you probably don't need it
  48. outColor.a = sqrt(outColor.a);
  49. return outColor * outColor.a;
  50. }
  51. ENDCG
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement