109 |
|
/* transform source direction */ |
110 |
|
if (SDmapDir(vsrc, ndp->toloc, ldir) != SDEnone) |
111 |
|
return(0); |
112 |
+ |
/* assign number of samples */ |
113 |
+ |
ec = SDsizeBSDF(&tomega, ndp->vray, vsrc, SDqueryMin, ndp->sd); |
114 |
+ |
if (ec) |
115 |
+ |
goto baderror; |
116 |
|
/* check indirect over-counting */ |
117 |
|
if (ndp->thick != 0 && ndp->pr->crtype & (SPECULAR|AMBIENT) |
118 |
|
&& vsrc[2] > 0 ^ ndp->vray[2] > 0) { |
119 |
|
double dx = vsrc[0] + ndp->vray[0]; |
120 |
|
double dy = vsrc[1] + ndp->vray[1]; |
121 |
< |
if (dx*dx + dy*dy <= omega*(1./PI)) |
121 |
> |
if (dx*dx + dy*dy <= omega+tomega) |
122 |
|
return(0); |
123 |
|
} |
120 |
– |
/* assign number of samples */ |
121 |
– |
ec = SDsizeBSDF(&tomega, ndp->vray, vsrc, SDqueryMin, ndp->sd); |
122 |
– |
if (ec) |
123 |
– |
goto baderror; |
124 |
|
sf = specjitter * ndp->pr->rweight; |
125 |
|
if (25.*tomega <= omega) |
126 |
|
nsamp = 100.*sf + .5; |
157 |
|
return(ok); |
158 |
|
baderror: |
159 |
|
objerror(ndp->mp, USER, transSDError(ec)); |
160 |
+ |
return(0); /* gratis return */ |
161 |
|
} |
162 |
|
|
163 |
|
/* Compute source contribution for BSDF (reflected & transmitted) */ |
557 |
|
bnorm[2] = -nd.pnorm[2]; |
558 |
|
if (nd.thick != 0) { /* proxy with offset? */ |
559 |
|
VCOPY(vtmp, r->rop); |
560 |
< |
VSUM(r->rop, vtmp, r->ron, -nd.thick); |
560 |
> |
VSUM(r->rop, vtmp, r->ron, nd.thick); |
561 |
|
multambient(ctmp, r, bnorm); |
562 |
|
VCOPY(r->rop, vtmp); |
563 |
|
} else |