diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-02 21:49:31 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-02 21:49:31 +0400 |
commit | f7efb510547e9686787128df99a616b940485382 (patch) | |
tree | 357316f330904c7f118213a5de68a6da9db470d7 | |
parent | c4780c233e7eaabfbf2ee4101d4d675f37974471 (diff) |
Fix #34803: blender internal SSS rendering black/nan with negative texture colors.
-rw-r--r-- | source/blender/render/intern/source/shadeoutput.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 2d26ebe2b91..0e9be0aa3a9 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1735,15 +1735,15 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) shr->col[0]= shr->col[1]= shr->col[2]= shr->col[3]= 1.0f; } else { - shi->r= pow(shi->r, ma->sss_texfac); - shi->g= pow(shi->g, ma->sss_texfac); - shi->b= pow(shi->b, ma->sss_texfac); - shi->alpha= pow(shi->alpha, ma->sss_texfac); + shi->r= pow(max_ff(shi->r, 0.0f), ma->sss_texfac); + shi->g= pow(max_ff(shi->g, 0.0f), ma->sss_texfac); + shi->b= pow(max_ff(shi->b, 0.0f), ma->sss_texfac); + shi->alpha= pow(max_ff(shi->alpha, 0.0f), ma->sss_texfac); - shr->col[0]= pow(shr->col[0], ma->sss_texfac); - shr->col[1]= pow(shr->col[1], ma->sss_texfac); - shr->col[2]= pow(shr->col[2], ma->sss_texfac); - shr->col[3]= pow(shr->col[3], ma->sss_texfac); + shr->col[0]= pow(max_ff(shr->col[0], 0.0f), ma->sss_texfac); + shr->col[1]= pow(max_ff(shr->col[1], 0.0f), ma->sss_texfac); + shr->col[2]= pow(max_ff(shr->col[2], 0.0f), ma->sss_texfac); + shr->col[3]= pow(max_ff(shr->col[3], 0.0f), ma->sss_texfac); } } } @@ -1833,9 +1833,9 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) else { copy_v3_v3(col, shr->col); mul_v3_fl(col, invalpha); - col[0]= pow(col[0], 1.0f-texfac); - col[1]= pow(col[1], 1.0f-texfac); - col[2]= pow(col[2], 1.0f-texfac); + col[0]= pow(max_ff(col[0], 0.0f), 1.0f-texfac); + col[1]= pow(max_ff(col[1], 0.0f), 1.0f-texfac); + col[2]= pow(max_ff(col[2], 0.0f), 1.0f-texfac); } shr->diff[0]= sss[0]*col[0]; |