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.25 by greg, Sat Mar 30 11:18:36 1996 UTC vs.
Revision 2.27 by greg, Wed Apr 24 16:27:56 1996 UTC

# Line 27 | Line 27 | extern int  do_irrad;                  /* compute irradiance? */
27   extern COLOR  ambval;                   /* ambient value */
28  
29   extern COLOR  cextinction;              /* global extinction coefficient */
30 < extern double  salbedo;                 /* global scattering albedo */
30 > extern COLOR  salbedo;                  /* global scattering albedo */
31   extern double  seccg;                   /* global scattering eccentricity */
32   extern double  ssampdist;               /* scatter sampling distance */
33  
# Line 62 | Line 62 | double  rw;
62                  r->clipset = NULL;
63                  r->revf = raytrace;
64                  copycolor(r->cext, cextinction);
65 <                r->albedo = salbedo;
65 >                copycolor(r->albedo, salbedo);
66                  r->gecc = seccg;
67                  r->slights = NULL;
68          } else {                                /* spawned ray */
# Line 79 | Line 79 | double  rw;
79                  }
80                  r->revf = ro->revf;
81                  copycolor(r->cext, ro->cext);
82 <                r->albedo = ro->albedo;
82 >                copycolor(r->albedo, ro->albedo);
83                  r->gecc = ro->gecc;
84                  r->slights = ro->slights;
85                  r->rweight = ro->rweight * rw;
# Line 189 | Line 189 | rayparticipate(r)                      /* compute ray medium participatio
189   register RAY  *r;
190   {
191          COLOR   ce, ca;
192        double  dist;
192          double  re, ge, be;
193  
194          if (intens(r->cext) <= 1./FHUGE)
195                  return;                         /* no medium */
196 <        if ((dist = r->rot) >= FHUGE)
197 <                dist = 2.*thescene.cusize;      /* what to use for infinity? */
198 <        if (r->crtype & SHADOW)
199 <                dist *= 1. - r->albedo;         /* no scattering for sources */
200 <        if (dist <= FTINY)
201 <                return;                         /* no effective ray travel */
202 <        re = dist*colval(r->cext,RED);
203 <        ge = dist*colval(r->cext,GRN);
204 <        be = dist*colval(r->cext,BLU);
205 <        setcolor(ce,    re>92. ? 0. : exp(-re),
206 <                        ge>92. ? 0. : exp(-ge),
208 <                        be>92. ? 0. : exp(-be));
196 >        re = r->rot*colval(r->cext,RED);
197 >        ge = r->rot*colval(r->cext,GRN);
198 >        be = r->rot*colval(r->cext,BLU);
199 >        if (r->crtype & SHADOW) {               /* no scattering for sources */
200 >                re *= 1. - colval(r->albedo,RED);
201 >                ge *= 1. - colval(r->albedo,GRN);
202 >                be *= 1. - colval(r->albedo,BLU);
203 >        }
204 >        setcolor(ce,    re<=0. ? 1. : re>92. ? 0. : exp(-re),
205 >                        ge<=0. ? 1. : ge>92. ? 0. : exp(-ge),
206 >                        be<=0. ? 1. : be>92. ? 0. : exp(-be));
207          multcolor(r->rcol, ce);                 /* path absorption */
208 <        if (r->albedo <= FTINY || r->crtype & SHADOW)
208 >        if (r->crtype & SHADOW || intens(r->albedo) <= FTINY)
209                  return;                         /* no scattering */
210 <        setcolor(ca,    r->albedo*colval(ambval,RED)*(1.-colval(ce,RED)),
211 <                        r->albedo*colval(ambval,GRN)*(1.-colval(ce,GRN)),
212 <                        r->albedo*colval(ambval,BLU)*(1.-colval(ce,BLU)));
210 >        setcolor(ca,
211 >                colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)),
212 >                colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)),
213 >                colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU)));
214          addcolor(r->rcol, ca);                  /* ambient in scattering */
215          srcscatter(r);                          /* source in scattering */
216   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines