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

Comparing ray/src/rt/pmapmat.h (file contents):
Revision 2.11 by rschregle, Wed Oct 28 12:32:53 2015 UTC vs.
Revision 2.12 by rschregle, Tue Feb 23 12:42:41 2016 UTC

# Line 1 | Line 1
1   /* RCSid $Id$ */
2   /*
3 <   ==================================================================
3 >   ======================================================================
4     Photon map support routines for scattering by materials.
5    
6     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
7     (c) Fraunhofer Institute for Solar Energy Systems,
8     (c) Lucerne University of Applied Sciences and Arts,
9 <   supported by the Swiss National Science Foundation (SNSF, #147053)
10 <   ==================================================================
9 >       supported by the Swiss National Science Foundation (SNSF, #147053)
10 >   ======================================================================
11    
12   */
13  
# Line 17 | Line 17
17  
18     #include "pmap.h"
19  
20 <  /*
21 <    ambRayInPmap():      Check for DIFFUSE -> (DIFFUSE|SPECULAR) -> *    
22 <                            subpaths.  These occur during the backward pass      
23 <                            when an ambient ray spawns an indirect diffuse or    
24 <                            specular ray.  These subpaths are already    
25 <                            accounted for in the global photon map.
26 <   */
27 <   #define ambRayInPmap(r)    ((r) -> crtype & AMBIENT && photonMapping && \
28 <                                 (ambounce < 0 || (r) -> rlvl > 1 || \
29 <                                  causticPhotonMapping || \
30 <                                  contribPhotonMapping))
31 <
32 <  /*
20 >   /*
21        Check for paths already accounted for in photon map to avoid
22        double-counting during backward raytracing.
23 <    
23 >      
24 >      ambRayInPmap():      Check for DIFFUSE -> (DIFFUSE|SPECULAR) -> *  
25 >                           subpaths.  These occur during the backward pass      
26 >                           when an ambient ray spawns an indirect diffuse or    
27 >                           specular ray.  These subpaths are already    
28 >                           accounted for in the global photon map.
29 >   */
30 >   #define ambRayInPmap(r) ((r) -> crtype & AMBIENT && photonMapping && \
31 >                              (ambounce < 0 || (r) -> rlvl > 1))
32 >
33 >   /*
34        shadowRayInPmap():   Check for DIFFUSE -> SPECULAR -> LIGHT
35                             subpaths. These occur during the backward pass
36                             when a shadow ray is transferred through a
37                             transparent material. These subpaths are already
38                             accounted for by caustic photons in the global,
39                             contrib, or dedicated caustic photon map.
40 +      
41 +      !!! DISABLED FOR TESTING PENDING REPLACEMENT BY srcRayInPmap() !!!                          
42     */
43 <   #define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \
44 <                                 (ambounce < 0 || \
45 <                                    ((r) -> crtype & AMBIENT \
46 <                                       ? photonMapping \
47 <                                       : causticPhotonMapping || \
48 <                                         contribPhotonMapping)))
43 > #if 1
44 >   #define shadowRayInPmap(r) 0
45 > #else  
46 >   #define shadowRayInPmap(r) (((globalPmap && ambounce < 0) || \
47 >                                 causticPmap || contribPmap) && \
48 >                                 (r) -> crtype & SHADOW)
49 > #endif
50  
51 <   /* Check if scattered ray spawns a caustic photon */
52 <   #define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR)
51 >   /* srcRayInPmap():      Check whether a source ray transferred through
52 >    *                      medium (e.g.  glass/dielectric) is already
53 >    *                      accounted for in the photon map.  This is used by
54 >    *                      badcomponent() in source.c when checking source
55 >    *                      hits (glows and lights, hence ambient and shadow
56 >    *                      rays).
57 >    */
58 >   #define srcRayInPmap(r)    (((globalPmap && ambounce < 0) || \
59 >                                 causticPmap || contribPmap) && \
60 >                                 (r) -> crtype & (AMBIENT | SHADOW) && \
61 >                                 (r) -> rtype & (TRANS | REFRACTED))
62 >                                
63 >   /* Check if scattered ray spawns a caustic photon;
64 >    * !!! NOTE this has to set bit 0 to properly handle caustic contrib
65 >    * !!! photons, so the explicit test against zero *IS* required!  */
66 >   #define PMAP_CAUSTICRAY(r)    (((r) -> rtype & SPECULAR) != 0)
67  
68  
69     /* Scattered photon ray types for photonRay() */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines