Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2021-02-10 19:02:06 +0300
committerClément Foucault <foucault.clem@gmail.com>2021-02-10 19:02:06 +0300
commita9ac8d8871312cfa94d4721af82501ca520e44eb (patch)
treeaa5eb09cdc4550ec5e39e925a6d309fa1f02d08d /source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
parent9c2f45981691ee2a2c2774e7f51fa32582a1eaec (diff)
EEVEE: Better fit of BTDF LUTeevee-ggx-lut-fix
This simplify the BTDF retreival removing the manual clean cut at low roughness. This maximize the precision of the LUT by scalling the sides by the critical angle. Also touched the ior > 1.0 approximation to be smoother.
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.glsl3
1 files changed, 2 insertions, 1 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 1ac965d24ca..cb4d8931af0 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
@@ -24,6 +24,7 @@ float ior_from_f0(float f0)
return (-f - 1.0) / (f - 1.0);
}
+/* Simplified form of F_eta(eta, 1.0). */
float f0_from_ior(float eta)
{
float A = (eta - 1.0) / (eta + 1.0);
@@ -69,7 +70,7 @@ float F_eta(float eta, float cos_theta)
/* Fresnel color blend base on fresnel factor */
vec3 F_color_blend(float eta, float fresnel, vec3 f0_color)
{
- float f0 = F_eta(eta, 1.0);
+ float f0 = f0_from_ior(eta);
float fac = saturate((fresnel - f0) / (1.0 - f0));
return mix(f0_color, vec3(1.0), fac);
}