diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-19 01:24:43 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-19 01:24:43 +0300 |
commit | 7b9e47a35e048071ee6f514ec8aba95caa69a7a8 (patch) | |
tree | 6aeec545fe402e60eb3d90f1f45b66517ae797aa /source/blender/gpu/shaders/material | |
parent | 6f3c279d9e7082b963f3ca758f6ba0561c4bcc9c (diff) |
EEVEE: Fix Missing GGX multi-scattering on Glass BSDF
Oversight that should have been in rB6f3c279d9e70
Diffstat (limited to 'source/blender/gpu/shaders/material')
-rw-r--r-- | source/blender/gpu/shaders/material/gpu_shader_material_glass.glsl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_glass.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_glass.glsl index 6d782ff18de..c328b4800bc 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_glass.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_glass.glsl @@ -1,6 +1,11 @@ #ifndef VOLUMETRICS -void node_bsdf_glass( - vec4 color, float roughness, float ior, vec3 N, float ssr_id, out Closure result) +void node_bsdf_glass(vec4 color, + float roughness, + float ior, + vec3 N, + float use_multiscatter, + float ssr_id, + out Closure result) { N = normalize(N); vec3 out_spec, out_refr, ssr_spec; @@ -8,7 +13,9 @@ void node_bsdf_glass( color.rgb; /* Simulate 2 transmission event */ eevee_closure_glass(N, vec3(1.0), - vec3(1.0), + /* HACK: Pass the multiscatter flag as the sign to not add closure + * variations or increase register usage. */ + (use_multiscatter != 0.0) ? vec3(1.0) : -vec3(1.0), int(ssr_id), roughness, 1.0, @@ -28,5 +35,5 @@ void node_bsdf_glass( } #else /* Stub glass because it is not compatible with volumetrics. */ -# define node_bsdf_glass(a, b, c, d, e, f) (f = CLOSURE_DEFAULT) +# define node_bsdf_glass(a, b, c, d, e, f, result) (result = CLOSURE_DEFAULT) #endif |