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
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-05-23 16:30:38 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-05-23 16:32:05 +0300
commitdf7f69b8735f440f22404ab65698404deff30ed7 (patch)
treee0c08d07e813302ee0b215915d5f42db7332a1ae /source
parent44f9a502e7e7713c1760ffd59539d927211031fe (diff)
Eevee: Fix SSS energy disapearing with alpha blended material
Diffstat (limited to 'source')
-rw-r--r--source/blender/gpu/intern/gpu_material.c7
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index fde60fd387d..007a13a06ef 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -620,7 +620,7 @@ void GPU_material_flag_set(GPUMaterial *mat, eGPUMatFlag flag)
bool GPU_material_flag_get(GPUMaterial *mat, eGPUMatFlag flag)
{
- return (mat->flag & flag);
+ return (mat->flag & flag) != 0;
}
GPUMaterial *GPU_material_from_nodetree_find(ListBase *gpumaterials,
@@ -684,7 +684,10 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene,
if (mat->outlink) {
/* HACK: this is only for eevee. We add the define here after the nodetree evaluation. */
if (GPU_material_flag_get(mat, GPU_MATFLAG_SSS)) {
- defines = BLI_string_joinN(defines, "#define USE_SSS\n");
+ defines = BLI_string_joinN(defines,
+ "#ifndef USE_ALPHA_BLEND\n"
+ "# define USE_SSS\n"
+ "#endif\n");
}
/* Prune the unused nodes and extract attributes before compiling so the
* generated VBOs are ready to accept the future shader. */
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
index 6c3e082f36a..48065cb10c9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
@@ -164,7 +164,7 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat,
else if (use_subsurf && use_diffuse && !use_refract && !use_clear) {
static char name[] = "node_bsdf_principled_subsurface";
node_name = name;
- flag = GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_SSS | GPU_MATFLAG_GLOSSY;
+ flag = GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY;
}
else if (!use_subsurf && !use_diffuse && use_refract && !use_clear && !socket_not_zero(4)) {
static char name[] = "node_bsdf_principled_glass";
@@ -174,7 +174,11 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat,
else {
static char name[] = "node_bsdf_principled";
node_name = name;
- flag = GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY | GPU_MATFLAG_SSS | GPU_MATFLAG_REFRACT;
+ flag = GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY | GPU_MATFLAG_REFRACT;
+ }
+
+ if (use_subsurf) {
+ flag |= GPU_MATFLAG_SSS;
}
GPU_material_flag_set(mat, flag);