diff options
author | chai <chaifix@163.com> | 2021-09-26 09:51:36 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-09-26 09:51:36 +0800 |
commit | 10ea61d63a87931a98c3591735f0d70e10939401 (patch) | |
tree | ff1f4f738f07e86166eafcd3736eb56e30c2dbd6 /Assets/Bundle/Shaders/Include/ImageEffect.cginc | |
parent | 2f310aa9f3f1cb1d51e8f62a6d5e3dda4821b82b (diff) |
*misc
Diffstat (limited to 'Assets/Bundle/Shaders/Include/ImageEffect.cginc')
-rw-r--r-- | Assets/Bundle/Shaders/Include/ImageEffect.cginc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Assets/Bundle/Shaders/Include/ImageEffect.cginc b/Assets/Bundle/Shaders/Include/ImageEffect.cginc new file mode 100644 index 00000000..ffe5bc11 --- /dev/null +++ b/Assets/Bundle/Shaders/Include/ImageEffect.cginc @@ -0,0 +1,18 @@ + +// µü´úÒ»´Î +fixed4 blur(sampler2D tex, float2 texSize, fixed2 uv, float spread = 1) +{ + fixed2 step = 1 / texSize; + const fixed weight = 0.1111111; + fixed4 color = fixed4(0, 0, 0, 0); + color += tex2D(tex, uv + spread * fixed2(-step.x, step.y)) * weight; + color += tex2D(tex, uv + spread * fixed2(0, step.y)) * weight; + color += tex2D(tex, uv + spread * fixed2(step.x, step.y)) * weight; + color += tex2D(tex, uv + spread * fixed2(-step.x, 0)) * weight; + color += tex2D(tex, uv) * weight; + color += tex2D(tex, uv + spread * fixed2(step.x, 0)) * weight; + color += tex2D(tex, uv + spread * fixed2(-step.x, -step.y)) * weight; + color += tex2D(tex, uv + spread * fixed2(0, -step.y)) * weight; + color += tex2D(tex, uv + spread * fixed2(step.x, -step.y)) * weight; + return color; +} |