diff options
7 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c index 820e0f479be..79d66495ad7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_material.c @@ -186,7 +186,7 @@ static void node_shader_exec_material(void *data, int UNUSED(thread), bNode *nod if (node->type == SH_NODE_MATERIAL_EXT) { /* Shadow, Reflect, Refract, Radiosity, Speed seem to cause problems inside * a node tree :( */ - copy_v3_v3(out[MAT_OUT_DIFFUSE]->vec, shrnode.diff); + copy_v3_v3(out[MAT_OUT_DIFFUSE]->vec, shrnode.diffshad); copy_v3_v3(out[MAT_OUT_SPEC]->vec, shrnode.spec); copy_v3_v3(out[MAT_OUT_AO]->vec, shrnode.ao); } diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h index 57e52a9316b..70e3edccb2c 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/extern/include/RE_shader_ext.h @@ -50,9 +50,10 @@ typedef struct ShadeResult { float col[4]; float alpha, mist, z; float emit[3]; - float diff[3]; /* no ramps, shadow, etc */ - float spec[3]; - float shad[4]; /* shad[3] is shadow intensity */ + float diff[3]; /* diffuse with no ramps, shadow, etc */ + float diffshad[3]; /* diffuse with shadow */ + float spec[3]; /* specular with shadow */ + float shad[4]; /* shad[3] is shadow intensity */ float ao[3]; float env[3]; float indirect[3]; diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 6807af0abc9..6dd2692f52e 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -563,6 +563,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) /* raytrace likes to separate the spec color */ sub_v3_v3v3(shr->diff, shr->combined, shr->spec); + copy_v3_v3(shr->diffshad, shr->diff); } } diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index bc9ba348c62..90e5def64f6 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -118,8 +118,10 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr) madd_v3_v3fl(shr->combined, shr_t.combined, fac); if (shi->passflag & SCE_PASS_SPEC) madd_v3_v3fl(shr->spec, shr_t.spec, fac); - if (shi->passflag & SCE_PASS_DIFFUSE) + if (shi->passflag & SCE_PASS_DIFFUSE) { madd_v3_v3fl(shr->diff, shr_t.diff, fac); + madd_v3_v3fl(shr->diffshad, shr_t.diffshad, fac); + } if (shi->passflag & SCE_PASS_SHADOW) madd_v3_v3fl(shr->shad, shr_t.shad, fac); diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 6cb34a67f45..4f41f2729a1 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -937,6 +937,8 @@ void shade_color(ShadeInput *shi, ShadeResult *shr) shr->diff[2] *= obcol[2]; if (shi->mode & MA_TRANSP) shr->alpha *= obcol[3]; } + + copy_v3_v3(shr->diffshad, shr->diff); } /* ramp for at end of shade */ @@ -1874,9 +1876,11 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) } if (shi->combinedflag & SCE_PASS_SHADOW) - copy_v3_v3(shr->combined, shr->shad); /* note, no ';' ! */ + copy_v3_v3(shr->diffshad, shr->shad); /* note, no ';' ! */ else - copy_v3_v3(shr->combined, shr->diff); + copy_v3_v3(shr->diffshad, shr->diff); + + copy_v3_v3(shr->combined, shr->diffshad); /* calculate shadow pass, we use a multiplication mask */ /* if diff = 0,0,0 it doesn't matter what the shadow pass is, so leave it as is */ diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index f2d4a7afd94..9a6a2b8ec9c 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -216,8 +216,10 @@ static void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float } if (addpassflag & SCE_PASS_EMIT) interpolate_vec3(shr1->emit, shr2->emit, t, negt, shr->emit); - if (addpassflag & SCE_PASS_DIFFUSE) + if (addpassflag & SCE_PASS_DIFFUSE) { interpolate_vec3(shr1->diff, shr2->diff, t, negt, shr->diff); + interpolate_vec3(shr1->diffshad, shr2->diffshad, t, negt, shr->diffshad); + } if (addpassflag & SCE_PASS_SPEC) interpolate_vec3(shr1->spec, shr2->spec, t, negt, shr->spec); if (addpassflag & SCE_PASS_SHADOW) diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 05d0eff311f..39950a1d417 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -748,6 +748,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in shr->alpha = col[3]; copy_v3_v3(shr->diff, shr->combined); + copy_v3_v3(shr->diffshad, shr->diff); } /* Traces a shadow through the object, |