uniform shader image; uniform float size; uniform float amount; uniform float darkness; half4 main(float2 coord) { float4 sum = float4(0.0); float weights[4]; weights[0] = 0.1531; weights[1] = 0.12245; weights[2] = 0.0918; weights[3] = 0.051; float4 baseColor = unpremul(image.eval(coord)); for (int i = 1; i <= 4; i++) { float weight = weights[i - 1]; float offset = size * float(i); sum += weight * (unpremul(image.eval(coord + float2(offset, 0))) - darkness); sum += weight * (unpremul(image.eval(coord + float2(-offset, 0))) - darkness); sum += weight * (unpremul(image.eval(coord + float2(0, offset))) - darkness); sum += weight * (unpremul(image.eval(coord + float2(0, -offset))) - darkness); } sum += 2.0 * 0.1633 * (baseColor - darkness); // Additive Blend float4 result = baseColor + max(sum, 0.0) * amount; result = clamp(result, float4(0.0), float4(1.0)); result.rgb *= result.a; return result; }