diff options
| author | UjinT34 <41110182+UjinT34@users.noreply.github.com> | 2026-04-16 21:19:25 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-16 19:19:25 +0100 |
| commit | 66ea2e2c9ed4e9257521e6706fbd21feb7e3cc5b (patch) | |
| tree | 6c0c9842245917e9828874263cd11d6f556a0a48 /src/render/shaders/glsl/blur1.glsl | |
| parent | 4cce7f60a9c8772d18ffb43cb74aa227ab4b3bc4 (diff) | |
renderer: Various CM fixes, part 8 of refactors (#13860)
Part 8 of Ujin's refactors.
Diffstat (limited to 'src/render/shaders/glsl/blur1.glsl')
| -rw-r--r-- | src/render/shaders/glsl/blur1.glsl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/render/shaders/glsl/blur1.glsl b/src/render/shaders/glsl/blur1.glsl index 36e7d660..86a37d88 100644 --- a/src/render/shaders/glsl/blur1.glsl +++ b/src/render/shaders/glsl/blur1.glsl @@ -100,10 +100,14 @@ vec4 blur1(vec2 v_texcoord, sampler2D tex, float radius, vec2 halfpixel, int pas vec2 uv = v_texcoord * 2.0; vec4 sum = texture(tex, uv) * 4.0; - sum += texture(tex, uv - halfpixel.xy * radius); - sum += texture(tex, uv + halfpixel.xy * radius); - sum += texture(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius); - sum += texture(tex, uv - vec2(halfpixel.x, -halfpixel.y) * radius); + // Those pixels might go outside the rendered area and grab some gabage. + // That garbage maps to 0.0-1.0 range with UINT8 buffer and doesn't have any significant impact on the end result. + // FP16 garbage maps to -65,504 - 65,504 and defines the end result. Clamp it here to 0.0 - 1.0 to get the same quality outcome as with UINT8. + // Rerendering an undamaged area to get some insignificant color accuracy increase on blur edges isn't worth it. + sum += clamp(texture(tex, uv - halfpixel.xy * radius), 0.0, 1.0); + sum += clamp(texture(tex, uv + halfpixel.xy * radius), 0.0, 1.0); + sum += clamp(texture(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius), 0.0, 1.0); + sum += clamp(texture(tex, uv - vec2(halfpixel.x, -halfpixel.y) * radius), 0.0, 1.0); vec4 color = sum / 8.0; |
