diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-01-17 00:18:35 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-01-17 00:18:35 +0300 |
commit | 96138daa2bd4e82c7d326a5cfc2a6ba042a4a0dd (patch) | |
tree | eaacc6d7f3dd660cab69990002d0a96bd0c35044 /source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl | |
parent | 213e34a6c32022836337c8bf181b4bbd69fa6097 (diff) |
Eevee: SSR: Fix artifacts at object/background limits.
This should have a very small perf impact but it's needed.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl index fef55d82e96..9043a4ca768 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl @@ -97,9 +97,14 @@ void main() float depth = texelFetch(depthBuffer, fullres_texel, 0).r; + /* Default: not hits. */ + hitData = encode_hit_data(vec2(0.5), false, false); + pdfData = 0.0; + /* Early out */ + /* We can't do discard because we don't clear the render target. */ if (depth == 1.0) - discard; + return; vec2 uvs = vec2(fullres_texel) / vec2(textureSize(depthBuffer, 0)); @@ -113,17 +118,15 @@ void main() /* Early out */ if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) - discard; + return; float roughness = speccol_roughness.a; float roughnessSquared = max(1e-3, roughness * roughness); float a2 = roughnessSquared * roughnessSquared; - if (roughness > maxRoughness + 0.2) { - hitData = encode_hit_data(vec2(0.5), false, false); - pdfData = 0.0; + /* Early out */ + if (roughness > maxRoughness + 0.2) return; - } vec4 rand = texelFetch(utilTex, ivec3(halfres_texel % LUT_SIZE, 2), 0); |