diff options
author | chai <chaifix@163.com> | 2021-09-30 18:15:25 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-09-30 18:15:25 +0800 |
commit | 5b19af7f51ad4504fc426b8387442f6b868b5f61 (patch) | |
tree | a90e5829c6d87386cf552ade49609597e93ce8df /Assets/Bundle/Shaders/Common/Image/ImageHelper.cginc | |
parent | 76745de7a04e46d18319c734067fa49641370014 (diff) |
*misc
Diffstat (limited to 'Assets/Bundle/Shaders/Common/Image/ImageHelper.cginc')
-rw-r--r-- | Assets/Bundle/Shaders/Common/Image/ImageHelper.cginc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Assets/Bundle/Shaders/Common/Image/ImageHelper.cginc b/Assets/Bundle/Shaders/Common/Image/ImageHelper.cginc new file mode 100644 index 00000000..ffe5bc11 --- /dev/null +++ b/Assets/Bundle/Shaders/Common/Image/ImageHelper.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; +} |