diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-03-10 17:34:11 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-03-10 19:57:09 +0300 |
commit | d89fb77d894e8652608ebf78657bd199bfb3bbee (patch) | |
tree | 952ee64a887cd8544d88fc4074b37ab30c37793c /source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl | |
parent | 9957096f35fcb9d63ae611464667638dcbfb6dd6 (diff) |
EEVEE: GGX: Use distribution of visible normal for sampling
This changes the sampling routine to use the method described in
"A Simpler and Exact Sampling Routine for the GGXDistribution of Visible Normals"
by Eric Heitz.
http://jcgt.org/published/0007/04/01/slides.pdf
This avoids generating bad rays and thus improve noise level in screen-
space reflections / refraction.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl index 5f0fde134d1..c8eaa06094e 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl @@ -102,7 +102,7 @@ float D_ggx_opti(float NH, float a2) return M_PI * tmp * tmp; /* Doing RCP and mul a2 at the end */ } -float G1_Smith_GGX(float NX, float a2) +float G1_Smith_GGX_opti(float NX, float a2) { /* Using Brian Karis approach and refactoring by NX/NX * this way the (2*NL)*(2*NV) in G = G1(V) * G1(L) gets canceled by the brdf denominator 4*NL*NV @@ -122,7 +122,7 @@ float bsdf_ggx(vec3 N, vec3 L, vec3 V, float roughness) float NL = max(dot(N, L), 1e-8); float NV = max(dot(N, V), 1e-8); - float G = G1_Smith_GGX(NV, a2) * G1_Smith_GGX(NL, a2); /* Doing RCP at the end */ + float G = G1_Smith_GGX_opti(NV, a2) * G1_Smith_GGX_opti(NL, a2); /* Doing RCP at the end */ float D = D_ggx_opti(NH, a2); /* Denominator is canceled by G1_Smith */ |