diff options
author | mano-wii <germano.costa@ig.com.br> | 2018-11-15 13:34:33 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2018-11-16 17:43:45 +0300 |
commit | f6c2fb0eb62aa0a5535801e6358e148d10d349c3 (patch) | |
tree | 1c44f5ef57f0eebe70e5108089f1e935e914f896 /source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl | |
parent | e9eb80055bbfc302066da8d3462c369a10de81c0 (diff) |
Minor edits in `effect_ssr_frag.glsl`
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 | 56 |
1 files changed, 28 insertions, 28 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 0f76f8e1b8c..43b888198aa 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl @@ -410,34 +410,6 @@ void main() if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) discard; - /* TODO optimize with textureGather */ - /* Doing these fetches early to hide latency. */ - vec4 hit_pdf; - hit_pdf.x = texelFetch(pdfBuffer, halfres_texel + neighbors[0 + neighborOffset], 0).r; - hit_pdf.y = texelFetch(pdfBuffer, halfres_texel + neighbors[1 + neighborOffset], 0).r; - hit_pdf.z = texelFetch(pdfBuffer, halfres_texel + neighbors[2 + neighborOffset], 0).r; - hit_pdf.w = texelFetch(pdfBuffer, halfres_texel + neighbors[3 + neighborOffset], 0).r; - - ivec4 hit_data[2]; - hit_data[0].xy = texelFetch(hitBuffer, halfres_texel + neighbors[0 + neighborOffset], 0).rg; - hit_data[0].zw = texelFetch(hitBuffer, halfres_texel + neighbors[1 + neighborOffset], 0).rg; - hit_data[1].xy = texelFetch(hitBuffer, halfres_texel + neighbors[2 + neighborOffset], 0).rg; - hit_data[1].zw = texelFetch(hitBuffer, halfres_texel + neighbors[3 + neighborOffset], 0).rg; - - /* Find Planar Reflections affecting this pixel */ - PlanarData pd; - float planar_index; - for (int i = 0; i < MAX_PLANAR && i < prbNumPlanar; ++i) { - pd = planars_data[i]; - - float fade = probe_attenuation_planar(pd, worldPosition, N, 0.0); - - if (fade > 0.5) { - planar_index = float(i); - break; - } - } - float roughness = speccol_roughness.a; float roughnessSquared = max(1e-3, roughness * roughness); @@ -454,6 +426,34 @@ void main() float weight_acc = 0.0; if (roughness < ssrMaxRoughness + 0.2) { + /* TODO optimize with textureGather */ + /* Doing these fetches early to hide latency. */ + vec4 hit_pdf; + hit_pdf.x = texelFetch(pdfBuffer, halfres_texel + neighbors[0 + neighborOffset], 0).r; + hit_pdf.y = texelFetch(pdfBuffer, halfres_texel + neighbors[1 + neighborOffset], 0).r; + hit_pdf.z = texelFetch(pdfBuffer, halfres_texel + neighbors[2 + neighborOffset], 0).r; + hit_pdf.w = texelFetch(pdfBuffer, halfres_texel + neighbors[3 + neighborOffset], 0).r; + + ivec4 hit_data[2]; + hit_data[0].xy = texelFetch(hitBuffer, halfres_texel + neighbors[0 + neighborOffset], 0).rg; + hit_data[0].zw = texelFetch(hitBuffer, halfres_texel + neighbors[1 + neighborOffset], 0).rg; + hit_data[1].xy = texelFetch(hitBuffer, halfres_texel + neighbors[2 + neighborOffset], 0).rg; + hit_data[1].zw = texelFetch(hitBuffer, halfres_texel + neighbors[3 + neighborOffset], 0).rg; + + /* Find Planar Reflections affecting this pixel */ + PlanarData pd; + float planar_index; + for (int i = 0; i < MAX_PLANAR && i < prbNumPlanar; ++i) { + pd = planars_data[i]; + + float fade = probe_attenuation_planar(pd, worldPosition, N, 0.0); + + if (fade > 0.5) { + planar_index = float(i); + break; + } + } + ssr_accum += get_ssr_samples(hit_pdf, hit_data, pd, planar_index, worldPosition, N, V, roughnessSquared, cone_tan, source_uvs, weight_acc); } |