Commit: 9e94525681c80f1604e88f06fac5e55721325758
Author: Clément Foucault
Date:   Mon Jun 20 16:31:22 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB9e94525681c80f1604e88f06fac5e55721325758

Fix T99019 EEVEE: Regression: Specular BSDF does not apply occlusion

Since the occlusion input is going to be removed in EEVEE-Next, I just
added a temporary workaround. The occlusion is passed as SSS radius
as the Specular BSDF does not use it.

The final result matches 3.1 release

===================================================================

M       source/blender/draw/engines/eevee/shaders/closure_eval_surface_lib.glsl
M       
source/blender/gpu/shaders/material/gpu_shader_material_eevee_specular.glsl

===================================================================

diff --git 
a/source/blender/draw/engines/eevee/shaders/closure_eval_surface_lib.glsl 
b/source/blender/draw/engines/eevee/shaders/closure_eval_surface_lib.glsl
index 0f5290a7c07..ffca97b6b8f 100644
--- a/source/blender/draw/engines/eevee/shaders/closure_eval_surface_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/closure_eval_surface_lib.glsl
@@ -181,6 +181,8 @@ Closure closure_eval(ClosureDiffuse diffuse, 
ClosureReflection reflection)
   /* Glue with the old system. */
   CLOSURE_VARS_DECLARE_2(Diffuse, Glossy);
 
+  /* WORKAROUND: This is to avoid regression in 3.2 and avoid messing with 
EEVEE-Next. */
+  in_common.occlusion = (diffuse.sss_radius.g == -1.0) ? diffuse.sss_radius.r 
: 1.0;
   in_Diffuse_0.N = diffuse.N;
   in_Diffuse_0.albedo = diffuse.color;
   in_Glossy_1.N = reflection.N;
@@ -207,6 +209,8 @@ Closure closure_eval(ClosureDiffuse diffuse,
   /* Glue with the old system. */
   CLOSURE_VARS_DECLARE_3(Diffuse, Glossy, Glossy);
 
+  /* WORKAROUND: This is to avoid regression in 3.2 and avoid messing with 
EEVEE-Next. */
+  in_common.occlusion = (diffuse.sss_radius.g == -1.0) ? diffuse.sss_radius.r 
: 1.0;
   in_Diffuse_0.N = diffuse.N;
   in_Diffuse_0.albedo = diffuse.color;
   in_Glossy_1.N = reflection.N;
diff --git 
a/source/blender/gpu/shaders/material/gpu_shader_material_eevee_specular.glsl 
b/source/blender/gpu/shaders/material/gpu_shader_material_eevee_specular.glsl
index 530907859e9..b744d36d8c6 100644
--- 
a/source/blender/gpu/shaders/material/gpu_shader_material_eevee_specular.glsl
+++ 
b/source/blender/gpu/shaders/material/gpu_shader_material_eevee_specular.glsl
@@ -34,6 +34,13 @@ void node_eevee_specular(vec4 diffuse,
   diffuse_data.N = N;
   diffuse_data.sss_id = 0u;
 
+  /* WORKAROUND: Nasty workaround to the current interface with the closure 
evaluation.
+   * Ideally the occlusion input should be move to the output node or removed 
all-together.
+   * This is temporary to avoid a regression in 3.2 and should be removed 
after EEVEE-Next rewrite.
+   */
+  diffuse_data.sss_radius.r = occlusion;
+  diffuse_data.sss_radius.g = -1.0; /* Flag */
+
   ClosureReflection reflection_data;
   reflection_data.weight = alpha;
   if (true) {

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to