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>2017-11-25 00:29:18 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-11-25 00:29:28 +0300
commit7cbc7dd90499f98e3f44f86fdacae5365e53cd77 (patch)
tree63eecf24db2b50ec51e9241eb20c20ecde7a8a66 /source/blender/gpu
parent8d4aa6bf44106bbc1605151c05ae6d5bb5c30e29 (diff)
Eevee: SSS: Add separated Albedo option.
This option prevent from automatically blurring the albedo color applied to the SSS. While this is great for preserving details it can bleed more light onto the nearby objects since the blurring will be done on pure "white" irradiance. This issue is to be tackled in a separate commit.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index b23c1708ee1..9d22fbba65e 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2909,7 +2909,12 @@ void node_bsdf_principled_clearcoat(vec4 base_color, float subsurface, vec3 subs
result.ssr_id = int(ssr_id);
#ifdef USE_SSS
result.sss_data.a = sss_scalef;
- result.sss_data.rgb = (out_diff + out_trans) * mix(vec3(0.0), subsurface_color.rgb, subsurface);
+ result.sss_data.rgb = out_diff + out_trans;
+#ifdef USE_SSS_ALBEDO
+ result.sss_albedo.rgb = mix(vec3(0.0), subsurface_color.rgb, subsurface);
+#else
+ result.sss_data.rgb *= mix(vec3(0.0), subsurface_color.rgb, subsurface);
+#endif
result.sss_data.rgb *= (1.0 - transmission);
#endif
@@ -2954,7 +2959,14 @@ void node_subsurface_scattering(
result.ssr_id = -1;
result.sss_data.a = scale;
eevee_closure_subsurface(N, color.rgb, 1.0, scale, out_diff, out_trans);
- result.sss_data.rgb = (out_diff + out_trans) * color.rgb;
+ result.sss_data.rgb = out_diff + out_trans;
+#ifdef USE_SSS_ALBEDO
+ /* Not perfect for texture_blur not exaclty equal to 0.0 or 1.0. */
+ result.sss_albedo.rgb = mix(color.rgb, vec3(1.0), texture_blur);
+ result.sss_data.rgb *= mix(vec3(1.0), color.rgb, texture_blur);
+#else
+ result.sss_data.rgb *= color.rgb;
+#endif
#else
node_bsdf_diffuse(color, 0.0, N, result);
#endif