2021년 4학년 1학기 기업연계프로젝트2 컴퓨터소프트웨어공학과 <원광투어팀> 팀장 : 송유진 팀원 : 김나영, 이경희, 한유진
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.4 KiB

5 years ago
  1. // Upgrade NOTE: replaced '_Projector' with 'unity_Projector'
  2. // Upgrade NOTE: replaced '_ProjectorClip' with 'unity_ProjectorClip'
  3. Shader "Projector/Multiply" {
  4. Properties {
  5. _ShadowTex ("Cookie", 2D) = "gray" {}
  6. _FalloffTex ("FallOff", 2D) = "white" {}
  7. }
  8. Subshader {
  9. Tags {"Queue"="Transparent"}
  10. Pass {
  11. ZWrite Off
  12. ColorMask RGB
  13. Blend DstColor Zero
  14. Offset -1, -1
  15. CGPROGRAM
  16. #pragma vertex vert
  17. #pragma fragment frag
  18. #pragma multi_compile_fog
  19. #include "UnityCG.cginc"
  20. struct v2f {
  21. float4 uvShadow : TEXCOORD0;
  22. float4 uvFalloff : TEXCOORD1;
  23. UNITY_FOG_COORDS(2)
  24. float4 pos : SV_POSITION;
  25. };
  26. float4x4 unity_Projector;
  27. float4x4 unity_ProjectorClip;
  28. v2f vert (float4 vertex : POSITION)
  29. {
  30. v2f o;
  31. o.pos = UnityObjectToClipPos(vertex);
  32. o.uvShadow = mul (unity_Projector, vertex);
  33. o.uvFalloff = mul (unity_ProjectorClip, vertex);
  34. UNITY_TRANSFER_FOG(o,o.pos);
  35. return o;
  36. }
  37. sampler2D _ShadowTex;
  38. sampler2D _FalloffTex;
  39. fixed4 frag (v2f i) : SV_Target
  40. {
  41. fixed4 texS = tex2Dproj (_ShadowTex, UNITY_PROJ_COORD(i.uvShadow));
  42. texS.a = 1.0-texS.a;
  43. fixed4 texF = tex2Dproj (_FalloffTex, UNITY_PROJ_COORD(i.uvFalloff));
  44. fixed4 res = lerp(fixed4(1,1,1,0), texS, texF.a);
  45. UNITY_APPLY_FOG_COLOR(i.fogCoord, res, fixed4(1,1,1,1));
  46. return res;
  47. }
  48. ENDCG
  49. }
  50. }
  51. }