lensflarecreate.shader 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 : POSITION;
  10. float2 uv[4] : TEXCOORD0;
  11. };
  12. float4 resolution;
  13. float4 colorA;
  14. float4 colorB;
  15. float4 colorC;
  16. float4 colorD;
  17. sampler2D _MainTex;
  18. v2f vert( appdata_img v ) {
  19. v2f o;
  20. o.pos = UnityObjectToClipPos(v.vertex);
  21. o.uv[0] = ( ( v.texcoord.xy - 0.5 ) * -0.85 ) + 0.5;
  22. o.uv[1] = ( ( v.texcoord.xy - 0.5 ) * -1.45 ) + 0.5;
  23. o.uv[2] = ( ( v.texcoord.xy - 0.5 ) * -2.55 ) + 0.5;
  24. o.uv[3] = ( ( v.texcoord.xy - 0.5 ) * -4.15 ) + 0.5;
  25. return o;
  26. }
  27. half4 frag(v2f i) : COLOR {
  28. half4 color = float4 (0,0,0,0);
  29. color += tex2D(_MainTex, i.uv[0] ) * colorA;
  30. color += tex2D(_MainTex, i.uv[1] ) * colorB;
  31. color += tex2D(_MainTex, i.uv[2] ) * colorC;
  32. color += tex2D(_MainTex, i.uv[3] ) * colorD;
  33. return color;
  34. }
  35. ENDCG
  36. Subshader {
  37. Blend One One
  38. Pass {
  39. ZTest Always Cull Off ZWrite Off
  40. Fog { Mode off }
  41. CGPROGRAM
  42. #pragma fragmentoption ARB_precision_hint_fastest
  43. #pragma vertex vert
  44. #pragma fragment frag
  45. ENDCG
  46. }
  47. }
  48. Fallback off
  49. } // shader