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; |
142 |
|
goto baderror; |
143 |
|
cvt_sdcolor(vcol, &sv); |
144 |
|
addcolor(vsum, vcol); |
145 |
< |
if (bright(vcol) > bright(vpeak)) { |
145 |
> |
if (sv.cieY > bright(vpeak)) { |
146 |
|
copycolor(vpeak, vcol); |
147 |
|
VCOPY(pdir, tdir); |
148 |
|
} |
237 |
|
if ((vsrc[2] > 0) ^ (ndp->vray[2] > 0) && bright(ndp->cthru) > FTINY) { |
238 |
|
double dx = vsrc[0] + ndp->vray[0]; |
239 |
|
double dy = vsrc[1] + ndp->vray[1]; |
240 |
< |
if (dx*dx + dy*dy <= (4./PI)*(omega + tomega + |
240 |
> |
if (dx*dx + dy*dy <= (1.5*4./PI)*(omega + tomega + |
241 |
|
2.*sqrt(omega*tomega))) |
242 |
|
return(0); |
243 |
|
} |
442 |
|
sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int xmit) |
443 |
|
{ |
444 |
|
const int hasthru = (xmit && |
445 |
< |
!(ndp->pr->crtype & (SPECULAR|AMBIENT)) && |
446 |
< |
bright(ndp->cthru) > FTINY); |
445 |
> |
!(ndp->pr->crtype & (SPECULAR|AMBIENT)) |
446 |
> |
&& bright(ndp->cthru) > FTINY); |
447 |
|
int nstarget = 1; |
448 |
|
int nsent = 0; |
449 |
|
int n; |
490 |
|
if (xmit) /* apply pattern on transmit */ |
491 |
|
multcolor(sr.rcoef, ndp->pr->pcol); |
492 |
|
if (rayorigin(&sr, SPECULAR, ndp->pr, sr.rcoef) < 0) { |
493 |
< |
if (maxdepth > 0) |
494 |
< |
break; |
495 |
< |
continue; /* Russian roulette victim */ |
493 |
> |
if (!n & (nstarget > 1)) { |
494 |
> |
n = nstarget; /* avoid infinitue loop */ |
495 |
> |
nstarget = nstarget*sr.rweight/minweight; |
496 |
> |
if (n == nstarget) break; |
497 |
> |
n = -1; /* moved target */ |
498 |
> |
} |
499 |
> |
continue; /* try again */ |
500 |
|
} |
501 |
|
if (xmit && ndp->thick != 0) /* need to offset origin? */ |
502 |
|
VSUM(sr.rorg, sr.rorg, ndp->pr->ron, -ndp->thick); |
512 |
|
static int |
513 |
|
sample_sdf(BSDFDAT *ndp, int sflags) |
514 |
|
{ |
515 |
< |
int hasthru = (sflags == SDsampSpT |
516 |
< |
&& !(ndp->pr->crtype & (SPECULAR|AMBIENT)) |
517 |
< |
&& bright(ndp->cthru) > FTINY); |
515 |
> |
int hasthru = (sflags == SDsampSpT && |
516 |
> |
!(ndp->pr->crtype & (SPECULAR|AMBIENT)) |
517 |
> |
&& bright(ndp->cthru) > FTINY); |
518 |
|
int n, ntotal = 0; |
519 |
|
double b = 0; |
520 |
|
SDSpectralDF *dfp; |
680 |
|
if (r->crtype & SHADOW) { |
681 |
|
RAY tr; /* attempt to pass shadow ray */ |
682 |
|
if (rayorigin(&tr, TRANS, r, nd.cthru) < 0) |
683 |
< |
return(1); /* blocked */ |
683 |
> |
return(1); /* no through component */ |
684 |
|
VCOPY(tr.rdir, r->rdir); |
685 |
|
rayvalue(&tr); /* transmit with scaling */ |
686 |
|
multcolor(tr.rcol, tr.rcoef); |