Previous bugfix for shadows cast on objects with diffuse reflectivity set to 0
caused errors on only shadow lamps; fixed this by adding back in the original intensity > 0.0 check in the only shadow if statement, where it belonged in the first place. In addition, the specular pass was not correctly affected by only shadow lamps, severely reducing the usefulness of this feature. For example, using four spotlamps to create an omnidirectional buffered shadow lamp didn't work.
This commit is contained in:
@@ -1245,12 +1245,16 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
|
||||
lamp_get_shadow(lar, shi, inp, shadfac, shi->depth);
|
||||
|
||||
/* warning, here it skips the loop */
|
||||
if(lar->mode & LA_ONLYSHADOW) {
|
||||
if((lar->mode & LA_ONLYSHADOW) && i>0.0) {
|
||||
|
||||
shadfac[3]= i*lar->energy*(1.0f-shadfac[3]);
|
||||
shr->shad[0] -= shadfac[3]*shi->r;
|
||||
shr->shad[1] -= shadfac[3]*shi->g;
|
||||
shr->shad[2] -= shadfac[3]*shi->b;
|
||||
|
||||
shr->spec[0] -= shadfac[3]*shi->r;
|
||||
shr->spec[1] -= shadfac[3]*shi->g;
|
||||
shr->spec[2] -= shadfac[3]*shi->b;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1280,7 +1284,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
|
||||
}
|
||||
|
||||
/* specularity */
|
||||
if(shadfac[3]>0.0f && shi->spec!=0.0f && !(lar->mode & LA_NO_SPEC)) {
|
||||
if(shadfac[3]>0.0f && shi->spec!=0.0f && !(lar->mode & LA_NO_SPEC) && !(lar->mode & LA_ONLYSHADOW)) {
|
||||
|
||||
if(!(passflag & (SCE_PASS_COMBINED|SCE_PASS_SPEC)));
|
||||
else if(lar->type==LA_HEMI) {
|
||||
|
||||
Reference in New Issue
Block a user