diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-01-15 19:23:17 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-01-16 20:22:24 +0300 |
commit | 3cb2b2956b140b840ba8a481ad15df1b567d9c07 (patch) | |
tree | 27afbad091568f22beffc7481667b73ca152fde1 /source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl | |
parent | 84c91be0a4bf83f815406d8f707a60cb51a06d3b (diff) |
Eevee: SSR: Remove ray count and use integer texture for hit coord.
Using GL_RG16I texture for the hit coordinates increase tremendously the precision of the hit.
The sign of the integer is used to 2 flags (has_hit and is_planar).
We do not store the depth and retrieve it from the depth buffer (increasing bandwith by +8bit/px).
The PDF is stored into another GL_R16F texture.
We remove the raycount for simplicity and to reduce compilation time (less branching in refraction shader).
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl index 9ccfd127536..cac3edaee45 100644 --- a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl @@ -29,7 +29,6 @@ in vec3 viewNormal; #endif uniform float maxRoughness; -uniform int rayCount; #endif /* LIT_SURFACE_UNIFORM */ @@ -315,13 +314,7 @@ void CLOSURE_NAME( if (ssrToggle && roughness < maxRoughness + 0.2) { /* Find approximated position of the 2nd refraction event. */ vec3 refr_vpos = (refractionDepth > 0.0) ? transform_point(ViewMatrix, refr_pos) : viewPosition; - - float ray_ofs = 1.0 / float(rayCount); - vec4 trans = screen_space_refraction(refr_vpos, N, refr_V, final_ior, roughnessSquared, rand.xzw, 0.0); - if (rayCount > 1) trans += screen_space_refraction(refr_vpos, N, refr_V, final_ior, roughnessSquared, rand.xzw * vec3(1.0, -1.0, -1.0), 1.0 * ray_ofs); - if (rayCount > 2) trans += screen_space_refraction(refr_vpos, N, refr_V, final_ior, roughnessSquared, rand.xwz * vec3(1.0, 1.0, -1.0), 2.0 * ray_ofs); - if (rayCount > 3) trans += screen_space_refraction(refr_vpos, N, refr_V, final_ior, roughnessSquared, rand.xwz * vec3(1.0, -1.0, 1.0), 3.0 * ray_ofs); - trans /= float(rayCount); + vec4 trans = screen_space_refraction(refr_vpos, N, refr_V, final_ior, roughnessSquared, rand.xzw); trans.a *= smoothstep(maxRoughness + 0.2, maxRoughness, roughness); accumulate_light(trans.rgb, trans.a, refr_accum); } |