106 |
|
{0, -1.6}, |
107 |
|
{1.6, 0}, |
108 |
|
}; |
109 |
< |
const double peak_over = 2.0; |
109 |
> |
const double peak_over = 1.5; |
110 |
|
SDSpectralDF *dfp; |
111 |
|
FVECT pdir; |
112 |
|
double tomega, srchrad; |
116 |
|
|
117 |
|
setcolor(ndp->cthru, 0, 0, 0); /* starting assumption */ |
118 |
|
|
119 |
+ |
if (ndp->pr->crtype & (SPECULAR|AMBIENT) && !(ndp->pr->crtype & SHADOW)) |
120 |
+ |
return; /* no need for through comp. */ |
121 |
+ |
|
122 |
|
if (ndp->pr->rod > 0) |
123 |
|
dfp = (ndp->sd->tf != NULL) ? ndp->sd->tf : ndp->sd->tb; |
124 |
|
else |
145 |
|
goto baderror; |
146 |
|
cvt_sdcolor(vcol, &sv); |
147 |
|
addcolor(vsum, vcol); |
148 |
< |
if (bright(vcol) > bright(vpeak)) { |
148 |
> |
if (sv.cieY > bright(vpeak)) { |
149 |
|
copycolor(vpeak, vcol); |
150 |
|
VCOPY(pdir, tdir); |
151 |
|
} |
277 |
|
if (tomega2 < .12*tomega) |
278 |
|
continue; /* not safe to include */ |
279 |
|
cvt_sdcolor(csmp, &sv); |
280 |
< |
/* weight average by Y */ |
281 |
< |
scalecolor(csmp, sv.cieY); |
280 |
> |
|
281 |
> |
if (sf < 2.5*tsr) { /* weight by Y for small sources */ |
282 |
> |
scalecolor(csmp, sv.cieY); |
283 |
> |
wtot += sv.cieY; |
284 |
> |
} else |
285 |
> |
wtot += 1.; |
286 |
|
addcolor(cval, csmp); |
280 |
– |
wtot += sv.cieY; |
287 |
|
} |
288 |
|
if (wtot <= FTINY) /* no valid specular samples? */ |
289 |
|
return(0); |
444 |
|
static int |
445 |
|
sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int xmit) |
446 |
|
{ |
447 |
< |
const int hasthru = (xmit && |
442 |
< |
!(ndp->pr->crtype & (SPECULAR|AMBIENT)) && |
443 |
< |
bright(ndp->cthru) > FTINY); |
447 |
> |
const int hasthru = (xmit && bright(ndp->cthru) > FTINY); |
448 |
|
int nstarget = 1; |
449 |
|
int nsent = 0; |
450 |
|
int n; |
509 |
|
static int |
510 |
|
sample_sdf(BSDFDAT *ndp, int sflags) |
511 |
|
{ |
512 |
< |
int hasthru = (sflags == SDsampSpT |
513 |
< |
&& !(ndp->pr->crtype & (SPECULAR|AMBIENT)) |
510 |
< |
&& bright(ndp->cthru) > FTINY); |
512 |
> |
int hasthru = (sflags == SDsampSpT && |
513 |
> |
bright(ndp->cthru) > FTINY); |
514 |
|
int n, ntotal = 0; |
515 |
|
double b = 0; |
516 |
|
SDSpectralDF *dfp; |
676 |
|
if (r->crtype & SHADOW) { |
677 |
|
RAY tr; /* attempt to pass shadow ray */ |
678 |
|
if (rayorigin(&tr, TRANS, r, nd.cthru) < 0) |
679 |
< |
return(1); /* blocked */ |
679 |
> |
return(1); /* no through component */ |
680 |
|
VCOPY(tr.rdir, r->rdir); |
681 |
|
rayvalue(&tr); /* transmit with scaling */ |
682 |
|
multcolor(tr.rcol, tr.rcoef); |