LensFlareCreate.shader 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Hidden/LensFlareCreate" {
  3. Properties {
  4. _MainTex ("Base (RGB)", 2D) = "" {}
  5. }
  6. CGINCLUDE
  7. #include "UnityCG.cginc"
  8. struct v2f {
  9. float4 pos : SV_POSITION;
  10. float2 uv[4] : TEXCOORD0;
  11. };
  12. fixed4 colorA;
  13. fixed4 colorB;
  14. fixed4 colorC;
  15. fixed4 colorD;
  16. sampler2D _MainTex;
  17. v2f vert( appdata_img v ) {
  18. v2f o;
  19. o.pos = UnityObjectToClipPos(v.vertex);
  20. o.uv[0] = ( ( v.texcoord.xy - 0.5 ) * -0.85 ) + 0.5;
  21. o.uv[1] = ( ( v.texcoord.xy - 0.5 ) * -1.45 ) + 0.5;
  22. o.uv[2] = ( ( v.texcoord.xy - 0.5 ) * -2.55 ) + 0.5;
  23. o.uv[3] = ( ( v.texcoord.xy - 0.5 ) * -4.15 ) + 0.5;
  24. return o;
  25. }
  26. fixed4 frag(v2f i) : SV_Target {
  27. fixed4 color = float4 (0,0,0,0);
  28. color += tex2D(_MainTex, i.uv[0] ) * colorA;
  29. color += tex2D(_MainTex, i.uv[1] ) * colorB;
  30. color += tex2D(_MainTex, i.uv[2] ) * colorC;
  31. color += tex2D(_MainTex, i.uv[3] ) * colorD;
  32. return color;
  33. }
  34. ENDCG
  35. Subshader {
  36. Blend One One
  37. Pass {
  38. ZTest Always Cull Off ZWrite Off
  39. CGPROGRAM
  40. #pragma vertex vert
  41. #pragma fragment frag
  42. ENDCG
  43. }
  44. }
  45. Fallback off
  46. } // shader