526 |
|
#define wrongsource(m, r) (r->rsrc>=0 && source[r->rsrc].so!=r->ro && \ |
527 |
|
(m->otype!=MAT_ILLUM || wrongillum(m,r))) |
528 |
|
|
529 |
– |
/* badspecular * |
530 |
– |
* |
531 |
– |
* Any undirected specular ray that hits a light source |
532 |
– |
* should be discarded. This is because the source contribution to |
533 |
– |
* specular components is calculated separately to reduce variance. |
534 |
– |
*/ |
535 |
– |
|
536 |
– |
#define badspecular(m, r) (r->rsrc<0 && r->crtype&SPECULAR) |
537 |
– |
|
529 |
|
/* distglow * |
530 |
|
* |
531 |
|
* A distant glow is an object that sometimes acts as a light source, |
535 |
|
#define distglow(m, r) (m->otype==MAT_GLOW && \ |
536 |
|
r->rot > m->oargs.farg[3]) |
537 |
|
|
538 |
< |
/* badambient * |
538 |
> |
/* badcomponent * |
539 |
|
* |
540 |
< |
* We must avoid including counting light sources in the ambient calculation, |
540 |
> |
* We must avoid counting light sources in the ambient calculation, |
541 |
|
* since the direct component is handled separately. Therefore, any |
542 |
|
* ambient ray which hits an active light source must be discarded. |
543 |
+ |
* The same is true for stray specular samples, since the specular |
544 |
+ |
* contribution from light sources is calculated separately. |
545 |
|
*/ |
546 |
|
|
547 |
< |
#define badambient(m, r) ((r->crtype&(AMBIENT|SHADOW))==AMBIENT && \ |
548 |
< |
!distglow(m, r)) |
547 |
> |
#define badcomponent(m, r) (r->crtype&(AMBIENT|SPECULAR) && \ |
548 |
> |
!(r->crtype&SHADOW || r->rod < 0.0 || \ |
549 |
> |
distglow(m, r))) |
550 |
|
|
551 |
|
/* overcount * |
552 |
|
* |
553 |
|
* All overcounting possibilities are contained here. |
554 |
|
*/ |
555 |
|
|
556 |
< |
#define overcount(m, r) (badspecular(m,r) || wrongsource(m,r) || \ |
563 |
< |
badambient(m,r)) |
556 |
> |
#define overcount(m, r) (badcomponent(m,r) || wrongsource(m,r)) |
557 |
|
|
558 |
|
/* passillum * |
559 |
|
* |