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.69 by greg, Tue Feb 24 19:39:26 2015 UTC vs.
Revision 2.73 by greg, Wed Oct 28 15:45:58 2015 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))
193 >        if (shadowRayInPmap(r) || ambRayInPmap(r))
194                  return(1);
195                                                  /* easy shadow test */
196          if (r->crtype & SHADOW && m->otype != MAT_TRANS)
# Line 269 | Line 267 | m_normal(                      /* color a ray that hit something normal *
267                  nd.tdiff = nd.tspec = nd.trans = 0.0;
268                                                  /* transmitted ray */
269  
270 <        /* 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)) {
270 >        if ((nd.specfl&(SP_TRAN|SP_PURE|SP_TBLT)) == (SP_TRAN|SP_PURE)) {
271                  RAY  lr;
272                  copycolor(lr.rcoef, nd.mcolor); /* modified by color */
273                  scalecolor(lr.rcoef, nd.tspec);
# Line 317 | Line 312 | m_normal(                      /* color a ray that hit something normal *
312                  checknorm(nd.vrefl);
313          }
314                                                  /* reflected ray */
315 <        /* 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)) {
315 >        if ((nd.specfl&(SP_REFL|SP_PURE|SP_RBLT)) == (SP_REFL|SP_PURE)) {
316                  RAY  lr;
317                  if (rayorigin(&lr, REFLECTED, r, nd.scolor) == 0) {
318                          VCOPY(lr.rdir, nd.vrefl);
# Line 340 | Line 332 | m_normal(                      /* color a ray that hit something normal *
332          if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY)
333                  return(1);                      /* 100% pure specular */
334  
335 <        /* PMAP: skip indirect gaussian via ambient bounce if already accounted
336 <         * for in photon map */
345 <        if (!ambRayInPmap(r))  
346 <                if (!(nd.specfl & SP_PURE))
347 <                        gaussamp(&nd);          /* checks *BLT flags */
335 >        if (!(nd.specfl & SP_PURE))
336 >                gaussamp(&nd);                  /* checks *BLT flags */
337  
338          if (nd.rdiff > FTINY) {         /* ambient from this side */
339                  copycolor(ctmp, nd.mcolor);     /* modified by material color */
# Line 402 | Line 391 | gaussamp(                      /* sample Gaussian specular */
391                          (np->specfl & (SP_TRAN|SP_TBLT)) != SP_TRAN)
392                  return;
393                                          /* set up sample coordinates */
394 <        getperpendicular(u, np->pnorm);
394 >        getperpendicular(u, np->pnorm, rand_samp);
395          fcross(v, np->pnorm, u);
396                                          /* compute reflection */
397          if ((np->specfl & (SP_REFL|SP_RBLT)) == SP_REFL &&

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines