HollywoodFlareStretch.shader 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Hidden/HollywoodFlareStretchShader" {
  3. Properties {
  4. _MainTex ("Base (RGB)", 2D) = "" {}
  5. }
  6. CGINCLUDE
  7. #include "UnityCG.cginc"
  8. struct v2f {
  9. float4 pos : POSITION;
  10. float2 uv : TEXCOORD0;
  11. };
  12. float4 offsets;
  13. float stretchWidth;
  14. sampler2D _MainTex;
  15. v2f vert (appdata_img v) {
  16. v2f o;
  17. o.pos = UnityObjectToClipPos(v.vertex);
  18. o.uv = v.texcoord.xy;
  19. return o;
  20. }
  21. half4 frag (v2f i) : COLOR {
  22. float4 color = tex2D (_MainTex, i.uv);
  23. float b = stretchWidth;
  24. color = max(color,tex2D (_MainTex, i.uv + b * 2.0 * offsets.xy));
  25. color = max(color,tex2D (_MainTex, i.uv - b * 2.0 * offsets.xy));
  26. color = max(color,tex2D (_MainTex, i.uv + b * 4.0 * offsets.xy));
  27. color = max(color,tex2D (_MainTex, i.uv - b * 4.0 * offsets.xy));
  28. color = max(color,tex2D (_MainTex, i.uv + b * 8.0 * offsets.xy));
  29. color = max(color,tex2D (_MainTex, i.uv - b * 8.0 * offsets.xy));
  30. color = max(color,tex2D (_MainTex, i.uv + b * 14.0 * offsets.xy));
  31. color = max(color,tex2D (_MainTex, i.uv - b * 14.0 * offsets.xy));
  32. color = max(color,tex2D (_MainTex, i.uv + b * 20.0 * offsets.xy));
  33. color = max(color,tex2D (_MainTex, i.uv - b * 20.0 * offsets.xy));
  34. return color;
  35. }
  36. ENDCG
  37. Subshader {
  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