37 |
|
* Reflection is ignored on the hidden side, as those rays pass through. |
38 |
|
* When thickness is set to zero, shadow rays will be blocked unless |
39 |
|
* a BTDF has a strong "through" component in the source direction. |
40 |
< |
* A separate test prevents over-counting by dropping specular & ambient |
41 |
< |
* samples that are too close to this "through" direction. The same |
42 |
< |
* restriction applies for the proxy case (thickness != 0). |
40 |
> |
* A separate test prevents over-counting by dropping samples that are |
41 |
> |
* too close to this "through" direction. BSDFs with such a through direction |
42 |
> |
* will also have a view component, meaning they are somewhat see-through. |
43 |
|
* The "up" vector for the BSDF is given by three variables, defined |
44 |
|
* (along with the thickness) by the named function file, or '.' if none. |
45 |
|
* Together with the surface normal, this defines the local coordinate |
79 |
|
COLOR cthru; /* "through" component multiplier */ |
80 |
|
SDData *sd; /* loaded BSDF data */ |
81 |
|
COLOR rdiff; /* diffuse reflection */ |
82 |
+ |
COLOR runsamp; /* BSDF hemispherical reflection */ |
83 |
|
COLOR tdiff; /* diffuse transmission */ |
84 |
+ |
COLOR tunsamp; /* BSDF hemispherical transmission */ |
85 |
|
} BSDFDAT; /* BSDF material data */ |
86 |
|
|
87 |
|
#define cvt_sdcolor(cv, svp) ccy2rgb(&(svp)->spec, (svp)->cieY, cv) |
111 |
|
FVECT pdir; |
112 |
|
double tomega, srchrad; |
113 |
|
COLOR vpeak, vsum; |
114 |
< |
int nsum, i; |
114 |
> |
int i; |
115 |
|
SDError ec; |
116 |
|
|
117 |
< |
setcolor(ndp->cthru, .0, .0, .0); /* starting assumption */ |
117 |
> |
setcolor(ndp->cthru, 0, 0, 0); /* starting assumption */ |
118 |
|
|
119 |
|
if (ndp->pr->rod > 0) |
120 |
|
dfp = (ndp->sd->tf != NULL) ? ndp->sd->tf : ndp->sd->tb; |
126 |
|
if (bright(ndp->pr->pcol) <= FTINY) |
127 |
|
return; /* pattern is black, here */ |
128 |
|
srchrad = sqrt(dfp->minProjSA); /* else search for peak */ |
129 |
< |
setcolor(vpeak, .0, .0, .0); |
130 |
< |
setcolor(vsum, .0, .0, .0); |
129 |
< |
nsum = 0; |
129 |
> |
setcolor(vpeak, 0, 0, 0); |
130 |
> |
setcolor(vsum, 0, 0, 0); |
131 |
|
for (i = 0; i < NDIR2CHECK; i++) { |
132 |
|
FVECT tdir; |
133 |
|
SDValue sv; |
135 |
|
tdir[0] = -ndp->vray[0] + dir2check[i][0]*srchrad; |
136 |
|
tdir[1] = -ndp->vray[1] + dir2check[i][1]*srchrad; |
137 |
|
tdir[2] = -ndp->vray[2]; |
138 |
< |
if (normalize(tdir) == 0) |
138 |
< |
continue; |
138 |
> |
normalize(tdir); |
139 |
|
ec = SDevalBSDF(&sv, tdir, ndp->vray, ndp->sd); |
140 |
|
if (ec) |
141 |
|
goto baderror; |
142 |
|
cvt_sdcolor(vcol, &sv); |
143 |
|
addcolor(vsum, vcol); |
144 |
– |
++nsum; |
144 |
|
if (bright(vcol) > bright(vpeak)) { |
145 |
|
copycolor(vpeak, vcol); |
146 |
|
VCOPY(pdir, tdir); |
151 |
|
goto baderror; |
152 |
|
if (tomega > 1.5*dfp->minProjSA) |
153 |
|
return; /* not really a peak? */ |
154 |
< |
if ((bright(vpeak) - ndp->sd->tLamb.cieY*(1./PI))*tomega <= .007) |
155 |
< |
return; /* < 0.7% transmission */ |
154 |
> |
if ((bright(vpeak) - ndp->sd->tLamb.cieY*(1./PI))*tomega <= .001) |
155 |
> |
return; /* < 0.1% transmission */ |
156 |
|
for (i = 3; i--; ) /* remove peak from average */ |
157 |
|
colval(vsum,i) -= colval(vpeak,i); |
158 |
< |
--nsum; |
160 |
< |
if (peak_over*bright(vsum) >= nsum*bright(vpeak)) |
158 |
> |
if (peak_over*bright(vsum) >= (NDIR2CHECK-1)*bright(vpeak)) |
159 |
|
return; /* not peaky enough */ |
160 |
|
copycolor(ndp->cthru, vpeak); /* else use it */ |
161 |
|
scalecolor(ndp->cthru, tomega); |
186 |
|
{ |
187 |
|
int nsamp, ok = 0; |
188 |
|
FVECT vsrc, vsmp, vjit; |
189 |
< |
double tomega; |
189 |
> |
double tomega, tomega2; |
190 |
|
double sf, tsr, sd[2]; |
191 |
|
COLOR csmp, cdiff; |
192 |
|
double diffY; |
193 |
|
SDValue sv; |
194 |
|
SDError ec; |
195 |
|
int i; |
196 |
+ |
/* in case we fail */ |
197 |
+ |
setcolor(cval, 0, 0, 0); |
198 |
|
/* transform source direction */ |
199 |
|
if (SDmapDir(vsrc, ndp->toloc, ldir) != SDEnone) |
200 |
|
return(0); |
220 |
|
diffY = sv.cieY *= 1./PI; |
221 |
|
cvt_sdcolor(cdiff, &sv); |
222 |
|
} else { |
223 |
< |
diffY = .0; |
224 |
< |
setcolor(cdiff, .0, .0, .0); |
223 |
> |
diffY = 0; |
224 |
> |
setcolor(cdiff, 0, 0, 0); |
225 |
|
} |
226 |
< |
/* assign number of samples */ |
226 |
> |
/* need projected solid angles */ |
227 |
> |
omega *= fabs(vsrc[2]); |
228 |
|
ec = SDsizeBSDF(&tomega, ndp->vray, vsrc, SDqueryMin, ndp->sd); |
229 |
|
if (ec) |
230 |
|
goto baderror; |
231 |
|
/* check indirect over-counting */ |
232 |
< |
if ((ndp->thick != 0 || bright(ndp->cthru) > FTINY) |
232 |
< |
&& ndp->pr->crtype & (SPECULAR|AMBIENT) |
233 |
< |
&& (vsrc[2] > 0) ^ (ndp->vray[2] > 0)) { |
232 |
> |
if ((vsrc[2] > 0) ^ (ndp->vray[2] > 0) && bright(ndp->cthru) > FTINY) { |
233 |
|
double dx = vsrc[0] + ndp->vray[0]; |
234 |
|
double dy = vsrc[1] + ndp->vray[1]; |
235 |
< |
if (dx*dx + dy*dy <= omega+tomega) |
235 |
> |
if (dx*dx + dy*dy <= (4./PI)*(omega + tomega + |
236 |
> |
2.*sqrt(omega*tomega))) |
237 |
|
return(0); |
238 |
|
} |
239 |
+ |
/* assign number of samples */ |
240 |
|
sf = specjitter * ndp->pr->rweight; |
241 |
< |
if (tomega <= .0) |
241 |
> |
if (tomega <= 0) |
242 |
|
nsamp = 1; |
243 |
|
else if (25.*tomega <= omega) |
244 |
|
nsamp = 100.*sf + .5; |
245 |
|
else |
246 |
|
nsamp = 4.*sf*omega/tomega + .5; |
247 |
|
nsamp += !nsamp; |
248 |
< |
setcolor(cval, .0, .0, .0); /* sample our source area */ |
248 |
< |
sf = sqrt(omega); |
248 |
> |
sf = sqrt(omega); /* sample our source area */ |
249 |
|
tsr = sqrt(tomega); |
250 |
|
for (i = nsamp; i--; ) { |
251 |
|
VCOPY(vsmp, vsrc); /* jitter query directions */ |
253 |
|
multisamp(sd, 2, (i + frandom())/(double)nsamp); |
254 |
|
vsmp[0] += (sd[0] - .5)*sf; |
255 |
|
vsmp[1] += (sd[1] - .5)*sf; |
256 |
< |
if (normalize(vsmp) == 0) { |
257 |
< |
--nsamp; |
258 |
< |
continue; |
259 |
< |
} |
256 |
> |
normalize(vsmp); |
257 |
|
} |
258 |
|
bsdf_jitter(vjit, ndp, tsr); |
259 |
|
/* compute BSDF */ |
260 |
|
ec = SDevalBSDF(&sv, vjit, vsmp, ndp->sd); |
261 |
|
if (ec) |
262 |
|
goto baderror; |
263 |
< |
if (sv.cieY - diffY <= FTINY) { |
267 |
< |
addcolor(cval, cdiff); |
263 |
> |
if (sv.cieY - diffY <= FTINY) |
264 |
|
continue; /* no specular part */ |
265 |
< |
} |
265 |
> |
/* check for variable resolution */ |
266 |
> |
ec = SDsizeBSDF(&tomega2, vjit, vsmp, SDqueryMin, ndp->sd); |
267 |
> |
if (ec) |
268 |
> |
goto baderror; |
269 |
> |
if (tomega2 < .12*tomega) |
270 |
> |
continue; /* not safe to include */ |
271 |
|
cvt_sdcolor(csmp, &sv); |
272 |
|
addcolor(cval, csmp); /* else average it in */ |
273 |
|
++ok; |
274 |
|
} |
275 |
< |
if (!ok) { |
276 |
< |
setcolor(cval, .0, .0, .0); |
277 |
< |
return(0); /* no valid specular samples */ |
278 |
< |
} |
278 |
< |
sf = 1./(double)nsamp; |
275 |
> |
if (!ok) /* no valid specular samples? */ |
276 |
> |
return(0); |
277 |
> |
|
278 |
> |
sf = 1./(double)ok; /* compute average BSDF */ |
279 |
|
scalecolor(cval, sf); |
280 |
|
/* subtract diffuse contribution */ |
281 |
|
for (i = 3*(diffY > FTINY); i--; ) |
282 |
< |
if ((colval(cval,i) -= colval(cdiff,i)) < .0) |
283 |
< |
colval(cval,i) = .0; |
282 |
> |
if ((colval(cval,i) -= colval(cdiff,i)) < 0) |
283 |
> |
colval(cval,i) = 0; |
284 |
|
return(1); |
285 |
|
baderror: |
286 |
|
objerror(ndp->mp, USER, transSDError(ec)); |
301 |
|
double dtmp; |
302 |
|
COLOR ctmp; |
303 |
|
|
304 |
< |
setcolor(cval, .0, .0, .0); |
304 |
> |
setcolor(cval, 0, 0, 0); |
305 |
|
|
306 |
|
ldot = DOT(np->pnorm, ldir); |
307 |
|
if ((-FTINY <= ldot) & (ldot <= FTINY)) |
309 |
|
|
310 |
|
if (ldot > 0 && bright(np->rdiff) > FTINY) { |
311 |
|
/* |
312 |
< |
* Compute added diffuse reflected component. |
312 |
> |
* Compute diffuse reflected component |
313 |
|
*/ |
314 |
|
copycolor(ctmp, np->rdiff); |
315 |
|
dtmp = ldot * omega * (1./PI); |
318 |
|
} |
319 |
|
if (ldot < 0 && bright(np->tdiff) > FTINY) { |
320 |
|
/* |
321 |
< |
* Compute added diffuse transmission. |
321 |
> |
* Compute diffuse transmission |
322 |
|
*/ |
323 |
|
copycolor(ctmp, np->tdiff); |
324 |
|
dtmp = -ldot * omega * (1.0/PI); |
328 |
|
if (ambRayInPmap(np->pr)) |
329 |
|
return; /* specular already in photon map */ |
330 |
|
/* |
331 |
< |
* Compute specular scattering coefficient using BSDF. |
331 |
> |
* Compute specular scattering coefficient using BSDF |
332 |
|
*/ |
333 |
|
if (!direct_specular_OK(ctmp, ldir, omega, np)) |
334 |
|
return; |
355 |
|
double dtmp; |
356 |
|
COLOR ctmp, ctmp1, ctmp2; |
357 |
|
|
358 |
< |
setcolor(cval, .0, .0, .0); |
358 |
> |
setcolor(cval, 0, 0, 0); |
359 |
|
|
360 |
|
ldot = DOT(np->pnorm, ldir); |
361 |
|
|
364 |
|
|
365 |
|
if (bright(np->rdiff) > FTINY) { |
366 |
|
/* |
367 |
< |
* Compute added diffuse reflected component. |
367 |
> |
* Compute diffuse reflected component |
368 |
|
*/ |
369 |
|
copycolor(ctmp, np->rdiff); |
370 |
|
dtmp = ldot * omega * (1./PI); |
374 |
|
if (ambRayInPmap(np->pr)) |
375 |
|
return; /* specular already in photon map */ |
376 |
|
/* |
377 |
< |
* Compute specular reflection coefficient using BSDF. |
377 |
> |
* Compute specular reflection coefficient using BSDF |
378 |
|
*/ |
379 |
|
if (!direct_specular_OK(ctmp, ldir, omega, np)) |
380 |
|
return; |
397 |
|
double dtmp; |
398 |
|
COLOR ctmp; |
399 |
|
|
400 |
< |
setcolor(cval, .0, .0, .0); |
400 |
> |
setcolor(cval, 0, 0, 0); |
401 |
|
|
402 |
|
ldot = DOT(np->pnorm, ldir); |
403 |
|
|
406 |
|
|
407 |
|
if (bright(np->tdiff) > FTINY) { |
408 |
|
/* |
409 |
< |
* Compute added diffuse transmission. |
409 |
> |
* Compute diffuse transmission |
410 |
|
*/ |
411 |
|
copycolor(ctmp, np->tdiff); |
412 |
|
dtmp = -ldot * omega * (1.0/PI); |
416 |
|
if (ambRayInPmap(np->pr)) |
417 |
|
return; /* specular already in photon map */ |
418 |
|
/* |
419 |
< |
* Compute specular scattering coefficient using BSDF. |
419 |
> |
* Compute specular scattering coefficient using BSDF |
420 |
|
*/ |
421 |
|
if (!direct_specular_OK(ctmp, ldir, omega, np)) |
422 |
|
return; |
429 |
|
|
430 |
|
/* Sample separate BSDF component */ |
431 |
|
static int |
432 |
< |
sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int usepat) |
432 |
> |
sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int xmit) |
433 |
|
{ |
434 |
+ |
int hasthru = (xmit && !(ndp->pr->crtype & (SPECULAR|AMBIENT)) |
435 |
+ |
&& bright(ndp->cthru) > FTINY); |
436 |
|
int nstarget = 1; |
437 |
< |
int nsent; |
437 |
> |
int nsent = 0; |
438 |
> |
int n; |
439 |
|
SDError ec; |
440 |
|
SDValue bsv; |
441 |
|
double xrand; |
442 |
< |
FVECT vsmp; |
442 |
> |
FVECT vsmp, vinc; |
443 |
|
RAY sr; |
444 |
|
/* multiple samples? */ |
445 |
|
if (specjitter > 1.5) { |
447 |
|
nstarget += !nstarget; |
448 |
|
} |
449 |
|
/* run through our samples */ |
450 |
< |
for (nsent = 0; nsent < nstarget; nsent++) { |
450 |
> |
for (n = 0; n < nstarget; n++) { |
451 |
|
if (nstarget == 1) { /* stratify random variable */ |
452 |
|
xrand = urand(ilhash(dimlist,ndims)+samplendx); |
453 |
|
if (specjitter < 1.) |
454 |
|
xrand = .5 + specjitter*(xrand-.5); |
455 |
|
} else { |
456 |
< |
xrand = (nsent + frandom())/(double)nstarget; |
456 |
> |
xrand = (n + frandom())/(double)nstarget; |
457 |
|
} |
458 |
|
SDerrorDetail[0] = '\0'; /* sample direction & coef. */ |
459 |
|
bsdf_jitter(vsmp, ndp, ndp->sr_vpsa[0]); |
460 |
+ |
VCOPY(vinc, vsmp); /* to compare after */ |
461 |
|
ec = SDsampComponent(&bsv, vsmp, xrand, dcp); |
462 |
|
if (ec) |
463 |
|
objerror(ndp->mp, USER, transSDError(ec)); |
464 |
|
if (bsv.cieY <= FTINY) /* zero component? */ |
465 |
|
break; |
466 |
< |
/* map vector to world */ |
466 |
> |
if (hasthru) { /* check for view ray */ |
467 |
> |
double dx = vinc[0] + vsmp[0]; |
468 |
> |
double dy = vinc[1] + vsmp[1]; |
469 |
> |
if (dx*dx + dy*dy <= ndp->sr_vpsa[0]*ndp->sr_vpsa[0]) |
470 |
> |
continue; /* exclude view sample */ |
471 |
> |
} |
472 |
> |
/* map non-view sample->world */ |
473 |
|
if (SDmapDir(sr.rdir, ndp->fromloc, vsmp) != SDEnone) |
474 |
|
break; |
475 |
|
/* spawn a specular ray */ |
476 |
|
if (nstarget > 1) |
477 |
|
bsv.cieY /= (double)nstarget; |
478 |
|
cvt_sdcolor(sr.rcoef, &bsv); /* use sample color */ |
479 |
< |
if (usepat) /* apply pattern? */ |
479 |
> |
if (xmit) /* apply pattern on transmit */ |
480 |
|
multcolor(sr.rcoef, ndp->pr->pcol); |
481 |
|
if (rayorigin(&sr, SPECULAR, ndp->pr, sr.rcoef) < 0) { |
482 |
|
if (maxdepth > 0) |
483 |
|
break; |
484 |
|
continue; /* Russian roulette victim */ |
485 |
|
} |
486 |
< |
/* need to offset origin? */ |
477 |
< |
if (ndp->thick != 0 && (ndp->pr->rod > 0) ^ (vsmp[2] > 0)) |
486 |
> |
if (xmit && ndp->thick != 0) /* need to offset origin? */ |
487 |
|
VSUM(sr.rorg, sr.rorg, ndp->pr->ron, -ndp->thick); |
488 |
|
rayvalue(&sr); /* send & evaluate sample */ |
489 |
|
multcolor(sr.rcol, sr.rcoef); |
490 |
|
addcolor(ndp->pr->rcol, sr.rcol); |
491 |
+ |
++nsent; |
492 |
|
} |
493 |
|
return(nsent); |
494 |
|
} |
497 |
|
static int |
498 |
|
sample_sdf(BSDFDAT *ndp, int sflags) |
499 |
|
{ |
500 |
+ |
int hasthru = (sflags == SDsampSpT |
501 |
+ |
&& !(ndp->pr->crtype & (SPECULAR|AMBIENT)) |
502 |
+ |
&& bright(ndp->cthru) > FTINY); |
503 |
|
int n, ntotal = 0; |
504 |
+ |
double b = 0; |
505 |
|
SDSpectralDF *dfp; |
506 |
|
COLORV *unsc; |
507 |
|
|
508 |
|
if (sflags == SDsampSpT) { |
509 |
< |
unsc = ndp->tdiff; |
509 |
> |
unsc = ndp->tunsamp; |
510 |
|
if (ndp->pr->rod > 0) |
511 |
|
dfp = (ndp->sd->tf != NULL) ? ndp->sd->tf : ndp->sd->tb; |
512 |
|
else |
513 |
|
dfp = (ndp->sd->tb != NULL) ? ndp->sd->tb : ndp->sd->tf; |
514 |
|
} else /* sflags == SDsampSpR */ { |
515 |
< |
unsc = ndp->rdiff; |
515 |
> |
unsc = ndp->runsamp; |
516 |
|
if (ndp->pr->rod > 0) |
517 |
|
dfp = ndp->sd->rf; |
518 |
|
else |
519 |
|
dfp = ndp->sd->rb; |
520 |
|
} |
521 |
+ |
setcolor(unsc, 0, 0, 0); |
522 |
|
if (dfp == NULL) /* no specular component? */ |
523 |
|
return(0); |
524 |
< |
/* below sampling threshold? */ |
525 |
< |
if (dfp->maxHemi <= specthresh+FTINY) { |
526 |
< |
if (dfp->maxHemi > FTINY) { /* XXX no color from BSDF */ |
527 |
< |
FVECT vjit; |
528 |
< |
double d; |
529 |
< |
COLOR ctmp; |
530 |
< |
bsdf_jitter(vjit, ndp, ndp->sr_vpsa[1]); |
531 |
< |
d = SDdirectHemi(vjit, sflags, ndp->sd); |
524 |
> |
|
525 |
> |
dimlist[ndims++] = (int)(size_t)ndp->mp; |
526 |
> |
if (hasthru) { /* separate view sample? */ |
527 |
> |
RAY tr; |
528 |
> |
if (rayorigin(&tr, TRANS, ndp->pr, ndp->cthru) == 0) { |
529 |
> |
VCOPY(tr.rdir, ndp->pr->rdir); |
530 |
> |
rayvalue(&tr); |
531 |
> |
multcolor(tr.rcol, tr.rcoef); |
532 |
> |
addcolor(ndp->pr->rcol, tr.rcol); |
533 |
> |
++ntotal; |
534 |
> |
b = bright(ndp->cthru); |
535 |
> |
} else |
536 |
> |
hasthru = 0; |
537 |
> |
} |
538 |
> |
ndims--; |
539 |
> |
if (dfp->maxHemi - b <= FTINY) { /* how specular to sample? */ |
540 |
> |
b = 0; |
541 |
> |
} else { |
542 |
> |
FVECT vjit; |
543 |
> |
bsdf_jitter(vjit, ndp, ndp->sr_vpsa[1]); |
544 |
> |
b = SDdirectHemi(vjit, sflags, ndp->sd) - b; |
545 |
> |
if (b < 0) b = 0; |
546 |
> |
} |
547 |
> |
if (b <= specthresh+FTINY) { /* below sampling threshold? */ |
548 |
> |
if (b > FTINY) { /* XXX no color from BSDF */ |
549 |
|
if (sflags == SDsampSpT) { |
550 |
< |
copycolor(ctmp, ndp->pr->pcol); |
551 |
< |
scalecolor(ctmp, d); |
550 |
> |
copycolor(unsc, ndp->pr->pcol); |
551 |
> |
scalecolor(unsc, b); |
552 |
|
} else /* no pattern on reflection */ |
553 |
< |
setcolor(ctmp, d, d, d); |
522 |
< |
addcolor(unsc, ctmp); |
553 |
> |
setcolor(unsc, b, b, b); |
554 |
|
} |
555 |
< |
return(0); |
555 |
> |
return(ntotal); |
556 |
|
} |
557 |
< |
/* else need to sample */ |
527 |
< |
dimlist[ndims++] = (int)(size_t)ndp->mp; |
528 |
< |
ndims++; |
557 |
> |
ndims += 2; /* else sample specular */ |
558 |
|
for (n = dfp->ncomp; n--; ) { /* loop over components */ |
559 |
|
dimlist[ndims-1] = n + 9438; |
560 |
|
ntotal += sample_sdcomp(ndp, &dfp->comp[n], sflags==SDsampSpT); |
585 |
|
/* get thickness */ |
586 |
|
nd.thick = evalue(mf->ep[0]); |
587 |
|
if ((-FTINY <= nd.thick) & (nd.thick <= FTINY)) |
588 |
< |
nd.thick = .0; |
588 |
> |
nd.thick = 0; |
589 |
|
/* check backface visibility */ |
590 |
|
if (!hitfront & !backvis) { |
591 |
|
raytrans(r); |
692 |
|
/* sample transmission */ |
693 |
|
sample_sdf(&nd, SDsampSpT); |
694 |
|
/* compute indirect diffuse */ |
695 |
< |
if (bright(nd.rdiff) > FTINY) { /* ambient from reflection */ |
695 |
> |
copycolor(ctmp, nd.rdiff); |
696 |
> |
addcolor(ctmp, nd.runsamp); |
697 |
> |
if (bright(ctmp) > FTINY) { /* ambient from reflection */ |
698 |
|
if (!hitfront) |
699 |
|
flipsurface(r); |
669 |
– |
copycolor(ctmp, nd.rdiff); |
700 |
|
multambient(ctmp, r, nd.pnorm); |
701 |
|
addcolor(r->rcol, ctmp); |
702 |
|
if (!hitfront) |
703 |
|
flipsurface(r); |
704 |
|
} |
705 |
< |
if (bright(nd.tdiff) > FTINY) { /* ambient from other side */ |
705 |
> |
copycolor(ctmp, nd.tdiff); |
706 |
> |
addcolor(ctmp, nd.tunsamp); |
707 |
> |
if (bright(ctmp) > FTINY) { /* ambient from other side */ |
708 |
|
FVECT bnorm; |
709 |
|
if (hitfront) |
710 |
|
flipsurface(r); |
711 |
|
bnorm[0] = -nd.pnorm[0]; |
712 |
|
bnorm[1] = -nd.pnorm[1]; |
713 |
|
bnorm[2] = -nd.pnorm[2]; |
682 |
– |
copycolor(ctmp, nd.tdiff); |
714 |
|
if (nd.thick != 0) { /* proxy with offset? */ |
715 |
|
VCOPY(vtmp, r->rop); |
716 |
|
VSUM(r->rop, vtmp, r->ron, nd.thick); |