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.2 by rschregle, Fri May 8 13:20:22 2015 UTC vs.
Revision 2.14 by rschregle, Mon Feb 22 13:27:49 2021 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 +       supported by the German Research Foundation
9 +       (DFG LU-204/10-2, "Fassadenintegrierte Regelsysteme FARESYS")
10     (c) Lucerne University of Applied Sciences and Arts,
11 <   supported by the Swiss National Science Foundation (SNSF, #147053)
12 <   ==================================================================
11 >       supported by the Swiss National Science Foundation
12 >       (SNSF #147053, "Daylight Redirecting Components")
13 >   ======================================================================
14    
11   $Id$
15   */
16  
17  
# Line 18 | Line 21
21     #include "pmap.h"
22  
23     /*
24 <      Checks for paths already accounted for in photon map to avoid
24 >      Check for paths already accounted for in photon map to avoid
25        double-counting during backward raytracing.
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.
26        
27 +      ambRayInPmap():      Check for DIFFUSE -> (DIFFUSE|SPECULAR) -> *  
28 +                           subpaths.  These occur during the backward pass      
29 +                           when an ambient ray spawns an indirect diffuse or    
30 +                           specular ray.  These subpaths are already    
31 +                           accounted for in the global photon map.
32 +   */
33 +   #define ambRayInPmap(r) ((r) -> crtype & AMBIENT && photonMapping && \
34 +                              (ambounce < 0 || (r) -> rlvl > 1))
35 +
36 +   /*
37        shadowRayInPmap():   Check for DIFFUSE -> SPECULAR -> LIGHT
38                             subpaths. These occur during the backward pass
39                             when a shadow ray is transferred through a
40                             transparent material. These subpaths are already
41                             accounted for by caustic photons in the global,
42                             contrib, or dedicated caustic photon map.
43 +      
44 +      !!! DISABLED FOR TESTING PENDING REPLACEMENT BY srcRayInPmap() !!!                          
45     */
46 <   #define ambRayInPmap(r)    ((r) -> crtype & AMBIENT && \
47 <                               ((photonMapping && \
48 <                                 (ambounce < 0 || (r) -> rlvl > 1)) || \
49 <                                 causticPhotonMapping || contribPhotonMapping))
50 <   #define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \
51 <                               ((photonMapping && ambounce < 0) || \
52 <                                causticPhotonMapping || contribPhotonMapping))
53 <  
54 <   /* Check if scattered ray spawns a caustic photon */
55 <   #define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR)
46 > #if 1
47 >   #define shadowRayInPmap(r) 0
48 > #else  
49 >   #define shadowRayInPmap(r) (((globalPmap && ambounce < 0) || \
50 >                                 causticPmap || contribPmap) && \
51 >                                 (r) -> crtype & SHADOW)
52 > #endif
53 >
54 >   /* srcRayInPmap():      Check whether a source ray transferred through
55 >    *                      medium (e.g.  glass/dielectric) is already
56 >    *                      accounted for in the photon map.  This is used by
57 >    *                      badcomponent() in source.c when checking source
58 >    *                      hits (glows and lights, hence ambient and shadow
59 >    *                      rays).
60 >    */
61 >   #define srcRayInPmap(r)    (((globalPmap && ambounce < 0) || \
62 >                                 causticPmap || contribPmap) && \
63 >                                 (r) -> crtype & (AMBIENT | SHADOW) && \
64 >                                 (r) -> rtype & (TRANS | REFRACTED))
65 >
66 >   /* Check if scattered ray spawns a caustic photon;
67 >    * !!! NOTE this returns a single bit as boolean value (0|1), rather
68 >    * !!! than the original short int, hence the explicit test against zero.
69 >    * !!! This allows the macro the be used in a conditional statement
70 >    * !!! and when setting a photon's caustic flag in newPhoton(). */
71 >   #define PMAP_CAUSTICRAY(r)    (((r) -> rtype & SPECULAR) != 0)
72  
73  
74     /* Scattered photon ray types for photonRay() */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines