61 |
|
r->rweight = rw; |
62 |
|
r->crtype = r->rtype = rt; |
63 |
|
r->rsrc = -1; |
64 |
– |
#ifdef SSKIPOPT |
65 |
– |
r->scorr = 1.f; |
66 |
– |
#endif |
64 |
|
r->clipset = NULL; |
65 |
|
r->revf = raytrace; |
66 |
|
copycolor(r->cext, cextinction); |
74 |
|
} |
75 |
|
r->rlvl = ro->rlvl; |
76 |
|
r->rsrc = ro->rsrc; |
80 |
– |
#ifdef SSKIPOPT |
81 |
– |
r->scorr = ro->scorr; |
82 |
– |
#endif |
77 |
|
if (rt & RAYREFL) { |
78 |
|
r->rlvl++; |
79 |
|
if (r->rsrc >= 0) /* malfunctioning material? */ |
214 |
|
) |
215 |
|
{ |
216 |
|
if (m->otype != MAT_CLIP && ismaterial(m->otype)) { |
217 |
< |
if (istransp(m->otype) || isBSDFproxy(m)) { |
217 |
> |
if (istransp(m) || isBSDFproxy(m)) { |
218 |
|
raytrans(r); |
219 |
|
return(1); |
220 |
|
} |
284 |
|
/* PMAP: indirect inscattering accounted for by volume photons? */ |
285 |
|
if (!volumePhotonMapping) { |
286 |
|
setscolor(ca, |
287 |
< |
colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)), |
288 |
< |
colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)), |
289 |
< |
colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU))); |
287 |
> |
colval(r->albedo,RED)*colval(ambval,RED)*(1.-scolval(ce,RED)), |
288 |
> |
colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-scolval(ce,GRN)), |
289 |
> |
colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-scolval(ce,BLU))); |
290 |
|
saddscolor(r->rcol, ca); /* ambient in scattering */ |
291 |
|
} |
292 |
|
|
417 |
|
while (r != NULL && r->crtype&flags) { |
418 |
|
smultscolor(rc, r->rcoef); |
419 |
|
/* check for participating medium */ |
420 |
< |
if (!warnedPM && (bright(r->cext) > FTINY) | |
421 |
< |
(bright(r->albedo) > FTINY)) { |
420 |
> |
if (bright(r->cext) > FTINY) { |
421 |
> |
double re = r->rot*colval(r->cext,RED), |
422 |
> |
ge = r->rot*colval(r->cext,GRN), |
423 |
> |
be = r->rot*colval(r->cext,BLU); |
424 |
> |
SCOLOR ce; |
425 |
> |
setscolor(ce, re<=FTINY ? 1. : re>92. ? 0. : exp(-re), |
426 |
> |
ge<=FTINY ? 1. : ge>92. ? 0. : exp(-ge), |
427 |
> |
be<=FTINY ? 1. : be>92. ? 0. : exp(-be)); |
428 |
> |
smultscolor(rc, ce); |
429 |
> |
} |
430 |
> |
if (!warnedPM && bright(r->albedo) > FTINY) { |
431 |
|
error(WARNING, |
432 |
|
"ray contribution calculation does not support participating media"); |
433 |
|
warnedPM++; |
464 |
|
return(r->rod); |
465 |
|
} |
466 |
|
newdot = -DOT(norm, r->rdir); |
467 |
< |
if ((newdot > 0.0) != (r->rod > 0.0)) { /* fix orientation */ |
467 |
> |
if ((newdot > 0.0) ^ (r->rod > 0.0)) { /* fix orientation */ |
468 |
|
for (i = 0; i < 3; i++) |
469 |
|
norm[i] += 2.0*newdot*r->rdir[i]; |
470 |
|
newdot = -newdot; |
553 |
|
return(1); /* old has material, new does not */ |
554 |
|
} else if (mray == NULL) { |
555 |
|
return(0); /* new has material, old does not */ |
556 |
< |
} else if (istransp(mnew->otype)) { |
557 |
< |
if (!istransp(mray->otype)) |
556 |
> |
} else if (istransp(mnew)) { |
557 |
> |
if (!istransp(mray)) |
558 |
|
return(1); /* new is transparent, old is not */ |
559 |
< |
} else if (istransp(mray->otype)) { |
559 |
> |
} else if (istransp(mray)) { |
560 |
|
return(0); /* old is transparent, new is not */ |
561 |
|
} |
562 |
|
if (rod <= 0) { /* check which side we hit */ |