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

Comparing ray/src/rt/aniso.c (file contents):
Revision 2.57 by greg, Thu Dec 4 05:26:28 2014 UTC vs.
Revision 2.58 by greg, Tue Feb 24 19:39:26 2015 UTC

# Line 14 | Line 14 | static const char RCSid[] = "$Id$";
14   #include  "source.h"
15   #include  "func.h"
16   #include  "random.h"
17 + #include  "pmapmat.h"
18  
19   #ifndef  MAXITER
20   #define  MAXITER        10              /* maximum # specular ray attempts */
# Line 97 | Line 98 | diraniso(              /* compute source contribution */
98                  scalecolor(ctmp, dtmp);
99                  addcolor(cval, ctmp);
100          }
101 +
102 +        if ((ldot < -FTINY) & (np->tdiff > FTINY)) {
103 +                /*
104 +                 *  Compute diffuse transmission.
105 +                 */
106 +                copycolor(ctmp, np->mcolor);
107 +                dtmp = -ldot * omega * np->tdiff * (1.0/PI);
108 +                scalecolor(ctmp, dtmp);
109 +                addcolor(cval, ctmp);
110 +        }
111 +
112 +        /* PMAP: skip direct specular refl via ambient bounce if already
113 +         * accounted for in photon map */
114 +        if (ambRayInPmap(np->rp))
115 +                return;
116 +        
117          if (ldot > FTINY && np->specfl&SP_REFL) {
118                  /*
119                   *  Compute specular reflection coefficient using
# Line 130 | Line 147 | diraniso(              /* compute source contribution */
147                          addcolor(cval, ctmp);
148                  }
149          }
150 <        if ((ldot < -FTINY) & (np->tdiff > FTINY)) {
134 <                /*
135 <                 *  Compute diffuse transmission.
136 <                 */
137 <                copycolor(ctmp, np->mcolor);
138 <                dtmp = -ldot * omega * np->tdiff * (1.0/PI);
139 <                scalecolor(ctmp, dtmp);
140 <                addcolor(cval, ctmp);
141 <        }
150 >        
151          if (ldot < -FTINY && np->specfl&SP_TRAN) {
152                  /*
153                   *  Compute specular transmission.  Specular transmission
# Line 267 | Line 276 | m_aniso(                       /* shade ray that hit something anisotropic
276  
277          getacoords(&nd);                        /* set up coordinates */
278  
279 <        if (nd.specfl & (SP_REFL|SP_TRAN))
279 >        /* PMAP: skip indirect specular via ambient bounce if already accounted
280 >         * for in photon map */
281 >        if (!ambRayInPmap(r) && nd.specfl & (SP_REFL|SP_TRAN))
282                  agaussamp(&nd);
283  
284          if (nd.rdiff > FTINY) {         /* ambient from this side */
# Line 278 | Line 289 | m_aniso(                       /* shade ray that hit something anisotropic
289                  multambient(ctmp, r, nd.pnorm);
290                  addcolor(r->rcol, ctmp);        /* add to returned color */
291          }
292 +        
293          if (nd.tdiff > FTINY) {         /* ambient from other side */
294                  FVECT  bnorm;
295  
# Line 299 | Line 311 | m_aniso(                       /* shade ray that hit something anisotropic
311  
312          return(1);
313   }
302
314  
315   static void
316   getacoords(             /* set up coordinate system */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines