diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-07-25 23:07:15 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-07-25 23:07:35 +0300 |
commit | 3b84a0b3d29d3e7d4ac4eb8d46d04f35489d36f3 (patch) | |
tree | e13a6ef596f5ab8586e8ca9fd16dea0edb117127 /source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl | |
parent | 4fd70c99a5a37db00ea26b8e5efa7d351e5e1e2b (diff) |
Eevee: Fix post process with Ugly color.
This was cause by some post process not always sampling the highest mipmap.
But if there is no need for mipmapping (i.e. no SSR) these levels will be undefined.
So forcing all Post FX shader to sample level 0 fix this.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl index c1052881864..517605778e3 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl @@ -64,10 +64,10 @@ vec3 downsample_filter_high(sampler2D tex, vec2 uv, vec2 texelSize) /* Downsample with a 4x4 box filter + anti-flicker filter */ vec4 d = texelSize.xyxy * vec4(-1, -1, +1, +1); - vec3 s1 = texture(tex, uv + d.xy).rgb; - vec3 s2 = texture(tex, uv + d.zy).rgb; - vec3 s3 = texture(tex, uv + d.xw).rgb; - vec3 s4 = texture(tex, uv + d.zw).rgb; + vec3 s1 = textureLod(tex, uv + d.xy, 0.0).rgb; + vec3 s2 = textureLod(tex, uv + d.zy, 0.0).rgb; + vec3 s3 = textureLod(tex, uv + d.xw, 0.0).rgb; + vec3 s4 = textureLod(tex, uv + d.zw, 0.0).rgb; /* Karis's luma weighted average (using brightness instead of luma) */ float s1w = 1.0 / (brightness(s1) + 1.0); @@ -85,10 +85,10 @@ vec3 downsample_filter(sampler2D tex, vec2 uv, vec2 texelSize) vec4 d = texelSize.xyxy * vec4(-1, -1, +1, +1); vec3 s; - s = texture(tex, uv + d.xy).rgb; - s += texture(tex, uv + d.zy).rgb; - s += texture(tex, uv + d.xw).rgb; - s += texture(tex, uv + d.zw).rgb; + s = textureLod(tex, uv + d.xy, 0.0).rgb; + s += textureLod(tex, uv + d.zy, 0.0).rgb; + s += textureLod(tex, uv + d.xw, 0.0).rgb; + s += textureLod(tex, uv + d.zw, 0.0).rgb; return s * (1.0 / 4); } @@ -99,17 +99,17 @@ vec3 upsample_filter_high(sampler2D tex, vec2 uv, vec2 texelSize) vec4 d = texelSize.xyxy * vec4(1, 1, -1, 0) * sampleScale; vec3 s; - s = texture(tex, uv - d.xy).rgb; - s += texture(tex, uv - d.wy).rgb * 2; - s += texture(tex, uv - d.zy).rgb; + s = textureLod(tex, uv - d.xy, 0.0).rgb; + s += textureLod(tex, uv - d.wy, 0.0).rgb * 2; + s += textureLod(tex, uv - d.zy, 0.0).rgb; - s += texture(tex, uv + d.zw).rgb * 2; - s += texture(tex, uv ).rgb * 4; - s += texture(tex, uv + d.xw).rgb * 2; + s += textureLod(tex, uv + d.zw, 0.0).rgb * 2; + s += textureLod(tex, uv , 0.0).rgb * 4; + s += textureLod(tex, uv + d.xw, 0.0).rgb * 2; - s += texture(tex, uv + d.zy).rgb; - s += texture(tex, uv + d.wy).rgb * 2; - s += texture(tex, uv + d.xy).rgb; + s += textureLod(tex, uv + d.zy, 0.0).rgb; + s += textureLod(tex, uv + d.wy, 0.0).rgb * 2; + s += textureLod(tex, uv + d.xy, 0.0).rgb; return s * (1.0 / 16.0); } @@ -120,10 +120,10 @@ vec3 upsample_filter(sampler2D tex, vec2 uv, vec2 texelSize) vec4 d = texelSize.xyxy * vec4(-1, -1, +1, +1) * (sampleScale * 0.5); vec3 s; - s = texture(tex, uv + d.xy).rgb; - s += texture(tex, uv + d.zy).rgb; - s += texture(tex, uv + d.xw).rgb; - s += texture(tex, uv + d.zw).rgb; + s = textureLod(tex, uv + d.xy, 0.0).rgb; + s += textureLod(tex, uv + d.zy, 0.0).rgb; + s += textureLod(tex, uv + d.xw, 0.0).rgb; + s += textureLod(tex, uv + d.zw, 0.0).rgb; return s * (1.0 / 4.0); } @@ -136,14 +136,14 @@ vec4 step_blit(void) #ifdef HIGH_QUALITY /* Anti flicker */ vec3 d = sourceBufferTexelSize.xyx * vec3(1, 1, 0); - vec3 s0 = texture(sourceBuffer, uvcoordsvar.xy).rgb; - vec3 s1 = texture(sourceBuffer, uvcoordsvar.xy - d.xz).rgb; - vec3 s2 = texture(sourceBuffer, uvcoordsvar.xy + d.xz).rgb; - vec3 s3 = texture(sourceBuffer, uvcoordsvar.xy - d.zy).rgb; - vec3 s4 = texture(sourceBuffer, uvcoordsvar.xy + d.zy).rgb; + vec3 s0 = textureLod(sourceBuffer, uvcoordsvar.xy, 0.0).rgb; + vec3 s1 = textureLod(sourceBuffer, uvcoordsvar.xy - d.xz, 0.0).rgb; + vec3 s2 = textureLod(sourceBuffer, uvcoordsvar.xy + d.xz, 0.0).rgb; + vec3 s3 = textureLod(sourceBuffer, uvcoordsvar.xy - d.zy, 0.0).rgb; + vec3 s4 = textureLod(sourceBuffer, uvcoordsvar.xy + d.zy, 0.0).rgb; vec3 m = median(median(s0.rgb, s1, s2), s3, s4); #else - vec3 s0 = texture(sourceBuffer, uvcoordsvar.xy).rgb; + vec3 s0 = textureLod(sourceBuffer, uvcoordsvar.xy, 0.0).rgb; vec3 m = s0.rgb; #endif @@ -180,7 +180,7 @@ vec4 step_upsample(void) #else vec3 blur = upsample_filter(sourceBuffer, uvcoordsvar.xy, sourceBufferTexelSize); #endif - vec3 base = texture(baseBuffer, uvcoordsvar.xy).rgb; + vec3 base = textureLod(baseBuffer, uvcoordsvar.xy, 0.0).rgb; return vec4(base + blur, 1.0); } @@ -191,7 +191,7 @@ vec4 step_resolve(void) #else vec3 blur = upsample_filter(sourceBuffer, uvcoordsvar.xy, sourceBufferTexelSize); #endif - vec4 base = texture(baseBuffer, uvcoordsvar.xy); + vec4 base = textureLod(baseBuffer, uvcoordsvar.xy, 0.0); vec3 cout = base.rgb + blur * bloomIntensity; return vec4(cout, base.a); } |