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.26 by greg, Wed Apr 17 14:06:35 1996 UTC vs.
Revision 2.31 by gwlarson, Wed Jun 17 12:53:06 1998 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1996 Regents of the University of California */
1 > /* Copyright (c) 1998 Silicon Graphics, Inc. */
2  
3   #ifndef lint
4 < static char SCCSid[] = "$SunId$ LBL";
4 > static char SCCSid[] = "$SunId$ SGI";
5   #endif
6  
7   /*
# Line 54 | Line 54 | register RAY  *r, *ro;
54   int  rt;
55   double  rw;
56   {
57 +        double  re;
58 +
59          if ((r->parent = ro) == NULL) {         /* primary ray */
60                  r->rlvl = 0;
61                  r->rweight = rw;
# Line 82 | Line 84 | double  rw;
84                  copycolor(r->albedo, ro->albedo);
85                  r->gecc = ro->gecc;
86                  r->slights = ro->slights;
85                r->rweight = ro->rweight * rw;
87                  r->crtype = ro->crtype | (r->rtype = rt);
88                  VCOPY(r->rorg, ro->rop);
89 +                r->rweight = ro->rweight * rw;
90 +                                                /* estimate absorption */
91 +                re = colval(ro->cext,RED) < colval(ro->cext,GRN) ?
92 +                                colval(ro->cext,RED) : colval(ro->cext,GRN);
93 +                if (colval(ro->cext,BLU) < re) re = colval(ro->cext,BLU);
94 +                if (re > 0.)
95 +                        r->rweight *= exp(-re*ro->rot);
96          }
97          rayclear(r);
98          return(r->rlvl <= maxdepth && r->rweight >= minweight ? 0 : -1);
# Line 96 | Line 104 | register RAY  *r;
104   {
105          r->rno = raynum++;
106          r->newcset = r->clipset;
107 +        r->robj = OVOID;
108          r->ro = NULL;
109 <        r->rot = FHUGE;
109 >        r->rt = r->rot = FHUGE;
110          r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
111          setcolor(r->pcol, 1.0, 1.0, 1.0);
112          setcolor(r->rcol, 0.0, 0.0, 0.0);
104        r->rt = 0.0;
113   }
114  
115  
# Line 189 | Line 197 | rayparticipate(r)                      /* compute ray medium participatio
197   register RAY  *r;
198   {
199          COLOR   ce, ca;
192        double  dist;
200          double  re, ge, be;
201  
202          if (intens(r->cext) <= 1./FHUGE)
203                  return;                         /* no medium */
204 <        if ((dist = r->rot) >= FHUGE)
205 <                dist = 2.*thescene.cusize;      /* what to use for infinity? */
206 <        re = dist*colval(r->cext,RED);
200 <        ge = dist*colval(r->cext,GRN);
201 <        be = dist*colval(r->cext,BLU);
204 >        re = r->rot*colval(r->cext,RED);
205 >        ge = r->rot*colval(r->cext,GRN);
206 >        be = r->rot*colval(r->cext,BLU);
207          if (r->crtype & SHADOW) {               /* no scattering for sources */
208                  re *= 1. - colval(r->albedo,RED);
209                  ge *= 1. - colval(r->albedo,GRN);
# Line 272 | Line 277 | double  coef;
277                  backmat = rayshade(&br, back);
278                                          /* check for transparency */
279          if (backmat ^ foremat)
280 <                if (backmat)
280 >                if (backmat && coef > FTINY)
281                          raytrans(&fr);
282 <                else
282 >                else if (foremat && coef < 1.0-FTINY)
283                          raytrans(&br);
284                                          /* mix perturbations */
285          for (i = 0; i < 3; i++)
# Line 557 | Line 562 | OBJECT  *cxs;
562          checkset(oset, cxs);                    /* eliminate double-checking */
563          for (i = oset[0]; i > 0; i--) {
564                  o = objptr(oset[i]);
565 <                (*ofun[o->otype].funp)(o, r);
565 >                if ((*ofun[o->otype].funp)(o, r))
566 >                        r->robj = oset[i];
567          }
568          if (r->ro == NULL)
569                  return(0);                      /* no scores yet */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines