68 |
|
FVECT pnorm; /* perturbed surface normal */ |
69 |
|
FVECT vray; /* local outgoing (return) vector */ |
70 |
|
double sr_vpsa[2]; /* sqrt of BSDF projected solid angle extrema */ |
71 |
< |
double thru_psa; /* through direction projected solid angle */ |
71 |
> |
double thru_r2; /* through rejection angle squared */ |
72 |
|
RREAL toloc[3][3]; /* world to local BSDF coords */ |
73 |
|
RREAL fromloc[3][3]; /* local BSDF coords to world */ |
74 |
|
double thick; /* surface thickness */ |
110 |
|
/* jitter query direction */ |
111 |
|
bsdf_jitter(vjit, ndp, 0); |
112 |
|
/* avoid indirect over-counting */ |
113 |
< |
if (ndp->thick != 0 && ndp->pr->crtype & (SPECULAR|AMBIENT) && |
114 |
< |
vsrc[2] > 0 ^ vjit[2] > 0) { |
113 |
> |
if (ndp->thru_r2 > FTINY && vsrc[2] > 0 ^ vjit[2] > 0) { |
114 |
|
double dx = vsrc[0] + vjit[0]; |
115 |
|
double dy = vsrc[1] + vjit[1]; |
116 |
< |
if (dx*dx + dy*dy <= ndp->thru_psa) |
116 |
> |
if (dx*dx + dy*dy <= ndp->thru_r2) |
117 |
|
return(0); |
118 |
|
} |
119 |
|
ec = SDevalBSDF(&sv, vjit, vsrc, ndp->sd); |
484 |
|
if (!ec) |
485 |
|
ec = SDsizeBSDF(nd.sr_vpsa, nd.vray, NULL, |
486 |
|
SDqueryMin+SDqueryMax, nd.sd); |
487 |
< |
nd.thru_psa = .0; |
487 |
> |
nd.thru_r2 = .0; |
488 |
|
if (!ec && nd.thick != 0 && r->crtype & (SPECULAR|AMBIENT)) { |
489 |
|
FVECT vthru; |
490 |
|
vthru[0] = -nd.vray[0]; |
491 |
|
vthru[1] = -nd.vray[1]; |
492 |
|
vthru[2] = -nd.vray[2]; |
493 |
< |
ec = SDsizeBSDF(&nd.thru_psa, nd.vray, vthru, |
493 |
> |
ec = SDsizeBSDF(&nd.thru_r2, nd.vray, vthru, |
494 |
|
SDqueryMin, nd.sd); |
495 |
+ |
nd.thru_r2 *= 1./PI; |
496 |
|
} |
497 |
|
if (ec) { |
498 |
|
objerror(m, WARNING, transSDError(ec)); |