ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapmat.h
Revision: 2.2
Committed: Fri May 8 13:20:22 2015 UTC (9 years ago) by rschregle
Content type: text/plain
Branch: MAIN
Changes since 2.1: +8 -6 lines
Log Message:
Double-counting bugfix for glow sources (thanks DGM!), revised copyright

File Contents

# Content
1 /*
2 ==================================================================
3 Photon map support routines for scattering by materials.
4
5 Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
6 (c) Fraunhofer Institute for Solar Energy Systems,
7 (c) Lucerne University of Applied Sciences and Arts,
8 supported by the Swiss National Science Foundation (SNSF, #147053)
9 ==================================================================
10
11 $Id: pmapmat.h,v 4.12 2015/05/08 13:13:53 taschreg Exp taschreg $
12 */
13
14
15 #ifndef PMAPMAT_H
16 #define PMAPMAT_H
17
18 #include "pmap.h"
19
20 /*
21 Checks for paths already accounted for in photon map to avoid
22 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.
29
30 shadowRayInPmap(): Check for DIFFUSE -> SPECULAR -> LIGHT
31 subpaths. These occur during the backward pass
32 when a shadow ray is transferred through a
33 transparent material. These subpaths are already
34 accounted for by caustic photons in the global,
35 contrib, or dedicated caustic photon map.
36 */
37 #define ambRayInPmap(r) ((r) -> crtype & AMBIENT && \
38 ((photonMapping && \
39 (ambounce < 0 || (r) -> rlvl > 1)) || \
40 causticPhotonMapping || contribPhotonMapping))
41 #define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \
42 ((photonMapping && ambounce < 0) || \
43 causticPhotonMapping || contribPhotonMapping))
44
45 /* Check if scattered ray spawns a caustic photon */
46 #define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR)
47
48
49 /* Scattered photon ray types for photonRay() */
50 #define PMAP_DIFFREFL (REFLECTED | AMBIENT)
51 #define PMAP_DIFFTRANS (REFLECTED | AMBIENT | TRANS)
52 #define PMAP_SPECREFL (REFLECTED | SPECULAR)
53 #define PMAP_SPECTRANS (REFLECTED | SPECULAR | TRANS)
54 #define PMAP_REFRACT (REFRACTED | SPECULAR)
55 #define PMAP_XFER (TRANS)
56
57
58
59 /* Dispatch table for photon scattering functions */
60 extern int (*photonScatter []) (OBJREC*, RAY*);
61
62 /* List of antimatter sensor modifier names */
63 extern char *photonSensorList [MAXSET + 1];
64
65
66
67 /* Spawn a new photon ray from a previous one; this is effectively a
68 * customised rayorigin(). */
69 void photonRay (const RAY *rayIn, RAY *rayOut, int rayOutType,
70 COLOR fluxAtten);
71
72 /* Init photonScatter[] dispatch table with material specific scattering
73 routines */
74 void initPhotonScatterFuncs ();
75
76 /* Find antimatter geometry declared as photon sensors */
77 void getPhotonSensors (char **sensorList);
78
79 #endif