diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-09-11 17:14:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-09-11 17:15:43 +0300 |
commit | aa5c543a7fe1fa1be95b6a09421a20617928d3b1 (patch) | |
tree | 866d6bbb2aeb0bb94a9264ac8f1d07bf62503d53 /source | |
parent | 766d9c293773a5e72e7ba466d4521f52711854cb (diff) |
Eevee: Fix downsampling shader with textureGather
This was leading to issues with all raytracing and AO algorithm.
Fix T55619
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl index f834b698ef9..e9f05cfe0ff 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl @@ -49,7 +49,8 @@ void main() #else vec4 samp; # ifdef GPU_ARB_texture_gather - samp = gatherLowerMip(vec2(texelPos) / vec2(mipsize)); + /* + 1.0 to gather at the center of target 4 texels. */ + samp = gatherLowerMip((vec2(texelPos) + 1.0) / vec2(mipsize)); # else samp.x = sampleLowerMip(texelPos); samp.y = sampleLowerMip(texelPos + ivec2(1, 0)); @@ -67,7 +68,7 @@ void main() val = minmax2(val, samp.x); } # ifdef GPU_ARB_texture_gather - samp = gatherLowerMip((vec2(texelPos) + vec2(1.0, 0.0)) / vec2(mipsize)); + samp = gatherLowerMip((vec2(texelPos) + vec2(2.0, 1.0)) / vec2(mipsize)); # else samp.y = sampleLowerMip(texelPos + ivec2(2, 0)); samp.z = sampleLowerMip(texelPos + ivec2(2, 1)); @@ -77,7 +78,7 @@ void main() /* if we are reducing an odd-height texture then fetch the edge texels */ if (((mipsize.y & 1) != 0) && (texelPos.y == mipsize.y - 3)) { # ifdef GPU_ARB_texture_gather - samp = gatherLowerMip((vec2(texelPos) + vec2(0.0, 1.0)) / vec2(mipsize)); + samp = gatherLowerMip((vec2(texelPos) + vec2(1.0, 2.0)) / vec2(mipsize)); # else samp.x = sampleLowerMip(texelPos + ivec2(0, 2)); samp.y = sampleLowerMip(texelPos + ivec2(1, 2)); |