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

Comparing ray/src/rt/normal.c (file contents):
Revision 2.70 by greg, Thu May 21 05:54:54 2015 UTC vs.
Revision 2.76 by greg, Wed Jan 10 04:08:50 2018 UTC

# Line 112 | Line 112 | dirnorm(               /* compute source contribution */
112                  scalecolor(ctmp, dtmp);
113                  addcolor(cval, ctmp);
114          }
115 <        
115 >
116          if (ldot < -FTINY && ltdiff > FTINY) {
117                  /*
118                   *  Compute diffuse transmission.
# Line 122 | Line 122 | dirnorm(               /* compute source contribution */
122                  scalecolor(ctmp, dtmp);
123                  addcolor(cval, ctmp);
124          }
125 <        
126 <        /* PMAP: skip direct specular via ambient bounce if already accounted for
127 <         * in photon map */
125 >
126          if (ambRayInPmap(np->rp))
127 <                return;
127 >                return;         /* specular already in photon map */
128  
129          if (ldot > FTINY && (np->specfl&(SP_REFL|SP_PURE)) == SP_REFL) {
130                  /*
# Line 192 | Line 190 | m_normal(                      /* color a ray that hit something normal *
190          int  i;
191  
192          /* PMAP: skip transmitted shadow ray if accounted for in photon map */
193 <        if (shadowRayInPmap(r))
194 <                return(1);
193 >        /* No longer needed?
194 >        if (shadowRayInPmap(r) || ambRayInPmap(r))
195 >                return(1); */          
196 >                
197                                                  /* easy shadow test */
198          if (r->crtype & SHADOW && m->otype != MAT_TRANS)
199                  return(1);
# Line 257 | Line 257 | m_normal(                      /* color a ray that hit something normal *
257                                  VCOPY(nd.prdir, r->rdir);
258                                  transtest = 2;
259                          } else {
260 <                                for (i = 0; i < 3; i++)         /* perturb */
261 <                                        nd.prdir[i] = r->rdir[i] - r->pert[i];
260 >                                                        /* perturb */
261 >                                VSUB(nd.prdir, r->rdir, r->pert);
262                                  if (DOT(nd.prdir, r->ron) < -FTINY)
263                                          normalize(nd.prdir);    /* OK */
264                                  else
# Line 269 | Line 269 | m_normal(                      /* color a ray that hit something normal *
269                  nd.tdiff = nd.tspec = nd.trans = 0.0;
270                                                  /* transmitted ray */
271  
272 <        /* PMAP: skip indirect specular trans via ambient bounce if already
273 <         * accounted for in photon map */
274 <        if (!ambRayInPmap(r) &&
275 <                    (nd.specfl&(SP_TRAN|SP_PURE|SP_TBLT)) == (SP_TRAN|SP_PURE)) {
272 >        if ((nd.specfl&(SP_TRAN|SP_PURE|SP_TBLT)) == (SP_TRAN|SP_PURE)) {
273                  RAY  lr;
274                  copycolor(lr.rcoef, nd.mcolor); /* modified by color */
275                  scalecolor(lr.rcoef, nd.tspec);
# Line 317 | Line 314 | m_normal(                      /* color a ray that hit something normal *
314                  checknorm(nd.vrefl);
315          }
316                                                  /* reflected ray */
317 <        /* PMAP: skip indirect specular refl via ambient ray if already accounted
321 <         * for in photon map */
322 <        if (!ambRayInPmap(r) &&
323 <                    (nd.specfl&(SP_REFL|SP_PURE|SP_RBLT)) == (SP_REFL|SP_PURE)) {
317 >        if ((nd.specfl&(SP_REFL|SP_PURE|SP_RBLT)) == (SP_REFL|SP_PURE)) {
318                  RAY  lr;
319                  if (rayorigin(&lr, REFLECTED, r, nd.scolor) == 0) {
320                          VCOPY(lr.rdir, nd.vrefl);
# Line 337 | Line 331 | m_normal(                      /* color a ray that hit something normal *
331                                                  /* diffuse reflection */
332          nd.rdiff = 1.0 - nd.trans - nd.rspec;
333  
334 <        if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY)
334 >        if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY) {
335 >                if (mirtest > transtest+FTINY)
336 >                        r->rt = mirdist;
337 >                else if (transtest > FTINY)
338 >                        r->rt = transdist;
339                  return(1);                      /* 100% pure specular */
340 <
341 <        /* PMAP: skip indirect gaussian via ambient bounce if already accounted
342 <         * for in photon map */
345 <        if (!ambRayInPmap(r))  
346 <                if (!(nd.specfl & SP_PURE))
347 <                        gaussamp(&nd);          /* checks *BLT flags */
340 >        }
341 >        if (!(nd.specfl & SP_PURE))
342 >                gaussamp(&nd);                  /* checks *BLT flags */
343  
344          if (nd.rdiff > FTINY) {         /* ambient from this side */
345                  copycolor(ctmp, nd.mcolor);     /* modified by material color */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines