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-14 02:49:54 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-11-14 02:49:54 +0300
commitf8b14305668ff7b1f3ba6f886b9e1881c764b201 (patch)
tree5f773bf0b3a723e7a3b895e0f41bcaecd93f75ad /source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
parent89e9f6ea79078f846d78b6effda2ae8a8a32de84 (diff)
Eevee: Initial Separable Subsurface Scattering implementation.
How to use: - Enable subsurface scattering in the render options. - Add Subsurface BSDF to your shader. - Check "Screen Space Subsurface Scattering" in the material panel options. This initial implementation has a few limitations: - only supports gaussian SSS. - Does not support principled shader. - The radius parameters is baked down to a number of samples and then put into an UBO. This means the radius input socket cannot be used. You need to tweak the default vector directly. - The "texture blur" is considered as always set to 1
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.glsl12
1 files changed, 11 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 bbb69d557c4..179d2f9096b 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
@@ -605,7 +605,8 @@ Closure closure_mix(Closure cl1, Closure cl2, float fac)
Closure cl;
#ifdef USE_SSS
- cl.sss_data = mix(cl1.sss_data, cl2.sss_data, fac);
+ cl.sss_data.rgb = mix(cl1.sss_data.rgb, cl2.sss_data.rgb, fac);
+ cl.sss_data.a = (cl1.sss_data.a > 0.0) ? cl1.sss_data.a : cl2.sss_data.a;
#endif
if (cl1.ssr_id == outputSsrId) {
@@ -640,8 +641,14 @@ Closure closure_add(Closure cl1, Closure cl2)
#if defined(MESH_SHADER) && !defined(USE_ALPHA_HASH) && !defined(USE_ALPHA_CLIP) && !defined(SHADOW_SHADER) && !defined(USE_MULTIPLY)
layout(location = 0) out vec4 fragColor;
+#ifdef USE_SSS
+layout(location = 1) out vec4 sssData;
+layout(location = 2) out vec4 ssrNormals;
+layout(location = 3) out vec4 ssrData;
+#else
layout(location = 1) out vec4 ssrNormals;
layout(location = 2) out vec4 ssrData;
+#endif
Closure nodetree_exec(void); /* Prototype */
@@ -665,6 +672,9 @@ void main()
ssrNormals = cl.ssr_normal.xyyy;
ssrData = cl.ssr_data;
+#ifdef USE_SSS
+ sssData = cl.sss_data;
+#endif
}
#endif /* MESH_SHADER && !SHADOW_SHADER */