ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/raytrace.c
(Generate patch)

Comparing ray/src/rt/raytrace.c (file contents):
Revision 2.94 by greg, Sat Jan 18 03:49:00 2025 UTC vs.
Revision 2.96 by greg, Fri Feb 7 16:32:56 2025 UTC

# Line 284 | Line 284 | rayparticipate(                        /* compute ray medium participation
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          
# Line 411 | Line 411 | raycontrib(            /* compute (cumulative) ray contribution
411   )
412   {
413          static int      warnedPM = 0;
414 +        double          re, ge, be;
415 +        SCOLOR          ce;
416  
417          setscolor(rc, 1., 1., 1.);
418 +        re = ge = be = 0.;
419  
420          while (r != NULL && r->crtype&flags) {
421 +                                        /* include this ray coefficient */
422                  smultscolor(rc, r->rcoef);
423 <                                        /* check for participating medium */
424 <                if (!warnedPM && (bright(r->cext) > FTINY) |
421 <                                (bright(r->albedo) > FTINY)) {
423 >                                        /* check participating medium */
424 >                if (!warnedPM && bright(r->albedo) > FTINY) {
425                          error(WARNING,
426          "ray contribution calculation does not support participating media");
427                          warnedPM++;
428                  }
429 +                                        /* sum PM extinction */
430 +                re += r->rot*colval(r->cext,RED);
431 +                ge += r->rot*colval(r->cext,GRN);
432 +                be += r->rot*colval(r->cext,BLU);
433 +                                        /* descend the tree */
434                  r = r->parent;
435          }
436 +                                        /* cumulative extinction */
437 +        setscolor(ce,   re<=FTINY ? 1. : re>92. ? 0. : exp(-re),
438 +                        ge<=FTINY ? 1. : ge>92. ? 0. : exp(-ge),
439 +                        be<=FTINY ? 1. : be>92. ? 0. : exp(-be));
440 +        smultscolor(rc, ce);
441   }
442  
443  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines