From e8abf7a8668b9fc61e33409e730b5a55a64bd0dd Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Sat, 16 May 2020 19:17:12 +0200 Subject: [PATCH] UPBGE: Avoid to use Burley BSDF when roughness is connected --- .../blender/nodes/shader/nodes/node_shader_material.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c index eaebe7ec0f55..5f081bd595e9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_material.c @@ -95,11 +95,15 @@ static void node_shader_exec_material(void *data, int UNUSED(thread), bNode *nod shi = shcd->shi; shi->mat = (Material *)node->id; - if (hasinput[MAT_IN_ROUGHNESS] || hasinput[MAT_IN_METALLIC]) { - shi->mat->diff_shader = MA_DIFF_BURLEY_BSDF; + if (hasinput[MAT_IN_ROUGHNESS]) { + if (shi->mat->diff_shader != MA_DIFF_LAMBERT_CUSTOM_BSDF) { + shi->mat->diff_shader = MA_DIFF_BURLEY_BSDF; + } + } + if (hasinput[MAT_IN_METALLIC]) { shi->mat->spec_shader = MA_SPEC_GGX_BSDF; } - + /* copy all relevant material vars, note, keep this synced with render_types.h */ memcpy(&shi->r, &shi->mat->r, 23 * sizeof(float)); shi->har = shi->mat->har;