| 261 |
|
RAY *r |
| 262 |
|
) |
| 263 |
|
{ |
| 264 |
< |
SCOLOR ce, ca; |
| 264 |
> |
COLOR ce; |
| 265 |
|
double re, ge, be; |
| 266 |
|
|
| 267 |
|
if (intens(r->cext) <= 1./FHUGE) |
| 274 |
|
ge *= 1. - colval(r->albedo,GRN); |
| 275 |
|
be *= 1. - colval(r->albedo,BLU); |
| 276 |
|
} |
| 277 |
< |
setscolor(ce, re<=FTINY ? 1. : re>92. ? 0. : exp(-re), |
| 277 |
> |
setcolor(ce, re<=FTINY ? 1. : re>92. ? 0. : exp(-re), |
| 278 |
|
ge<=FTINY ? 1. : ge>92. ? 0. : exp(-ge), |
| 279 |
|
be<=FTINY ? 1. : be>92. ? 0. : exp(-be)); |
| 280 |
< |
smultscolor(r->rcol, ce); /* path extinction */ |
| 280 |
> |
smultcolor(r->rcol, ce); /* path extinction */ |
| 281 |
|
if (r->crtype & SHADOW || intens(r->albedo) <= FTINY) |
| 282 |
|
return; /* no scattering */ |
| 283 |
|
|
| 284 |
|
/* PMAP: indirect inscattering accounted for by volume photons? */ |
| 285 |
|
if (!volumePhotonMapping) { |
| 286 |
+ |
SCOLOR ca; |
| 287 |
|
setscolor(ca, |
| 288 |
|
colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)), |
| 289 |
|
colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)), |
| 290 |
|
colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU))); |
| 291 |
< |
saddscolor(r->rcol, ca); /* ambient in scattering */ |
| 291 |
> |
saddscolor(r->rcol, ca); /* ambient in scattering */ |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
srcscatter(r); /* source in scattering */ |
| 412 |
|
) |
| 413 |
|
{ |
| 414 |
|
static int warnedPM = 0; |
| 415 |
+ |
double re, ge, be; |
| 416 |
+ |
SCOLOR ce; |
| 417 |
|
|
| 418 |
|
setscolor(rc, 1., 1., 1.); |
| 419 |
+ |
re = ge = be = 0.; |
| 420 |
|
|
| 421 |
|
while (r != NULL && r->crtype&flags) { |
| 422 |
+ |
/* include this ray coefficient */ |
| 423 |
|
smultscolor(rc, r->rcoef); |
| 424 |
< |
/* check for participating medium */ |
| 425 |
< |
if (!warnedPM && (bright(r->cext) > FTINY) | |
| 421 |
< |
(bright(r->albedo) > FTINY)) { |
| 424 |
> |
/* check participating medium */ |
| 425 |
> |
if (!warnedPM && bright(r->albedo) > FTINY) { |
| 426 |
|
error(WARNING, |
| 427 |
|
"ray contribution calculation does not support participating media"); |
| 428 |
|
warnedPM++; |
| 429 |
|
} |
| 430 |
+ |
/* sum PM extinction */ |
| 431 |
+ |
re += r->rot*colval(r->cext,RED); |
| 432 |
+ |
ge += r->rot*colval(r->cext,GRN); |
| 433 |
+ |
be += r->rot*colval(r->cext,BLU); |
| 434 |
+ |
/* descend the tree */ |
| 435 |
|
r = r->parent; |
| 436 |
|
} |
| 437 |
+ |
/* cumulative extinction */ |
| 438 |
+ |
setscolor(ce, re<=FTINY ? 1. : re>92. ? 0. : exp(-re), |
| 439 |
+ |
ge<=FTINY ? 1. : ge>92. ? 0. : exp(-ge), |
| 440 |
+ |
be<=FTINY ? 1. : be>92. ? 0. : exp(-be)); |
| 441 |
+ |
smultscolor(rc, ce); |
| 442 |
|
} |
| 443 |
|
|
| 444 |
|
|