[#18837] if a sunlamp is set to a too high energy, speculars turn black
shr->spec values could be greater then 1.0, causing negative color when using (1.0-shr->spec[i]) as a blending factor. When shr->spec[i] is 1.0 the mircol is ignored, so only mix the mircol when needed (like clamping the spec).
This commit is contained in:
@@ -1239,15 +1239,18 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
|
||||
}
|
||||
|
||||
if(shi->combinedflag & SCE_PASS_REFLECT) {
|
||||
/* values in shr->spec can be greater then 1.0.
|
||||
* in the case when it is 1.0 diff */
|
||||
|
||||
f= fr*(1.0f-shr->spec[0]); f1= 1.0f-i;
|
||||
diff[0]= f*mircol[0] + f1*diff[0];
|
||||
f1= 1.0f-i;
|
||||
|
||||
f= fg*(1.0f-shr->spec[1]); f1= 1.0f-i;
|
||||
diff[1]= f*mircol[1] + f1*diff[1];
|
||||
diff[0] *= f1;
|
||||
diff[1] *= f1;
|
||||
diff[2] *= f1;
|
||||
|
||||
f= fb*(1.0f-shr->spec[2]); f1= 1.0f-i;
|
||||
diff[2]= f*mircol[2] + f1*diff[2];
|
||||
if(shr->spec[0]<1.0f) diff[0] += mircol[0] * (fr*(1.0f-shr->spec[0]));
|
||||
if(shr->spec[1]<1.0f) diff[1] += mircol[1] * (fg*(1.0f-shr->spec[1]));
|
||||
if(shr->spec[2]<1.0f) diff[2] += mircol[2] * (fb*(1.0f-shr->spec[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user