1 |
+ |
/* RCSid $Id$ */ |
2 |
|
/* |
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 |
< |
Lucerne University of Applied Sciences & Arts |
8 |
> |
(c) Lucerne University of Applied Sciences and Arts, |
9 |
> |
supported by the Swiss National Science Foundation (SNSF, #147053) |
10 |
|
================================================================== |
11 |
|
|
12 |
|
$Id$ |
19 |
|
#include "pmap.h" |
20 |
|
|
21 |
|
/* |
22 |
< |
Checks for paths already accounted for in photon map to avoid |
22 |
> |
Check for paths already accounted for in photon map to avoid |
23 |
|
double-counting during backward raytracing. |
24 |
|
|
23 |
– |
ambRayInPmap(): Check for DIFFUSE -> (DIFFUSE|SPECULAR) -> * |
24 |
– |
subpaths. These occur during the backward pass |
25 |
– |
when an ambient ray spawns an indirect diffuse or |
26 |
– |
specular ray. These subpaths are already |
27 |
– |
accounted for in the global photon map. |
28 |
– |
|
25 |
|
shadowRayInPmap(): Check for DIFFUSE -> SPECULAR -> LIGHT |
26 |
|
subpaths. These occur during the backward pass |
27 |
|
when a shadow ray is transferred through a |
29 |
|
accounted for by caustic photons in the global, |
30 |
|
contrib, or dedicated caustic photon map. |
31 |
|
*/ |
32 |
< |
#define ambRayInPmap(r) ((r) -> crtype & AMBIENT && photonMapping) |
33 |
< |
|
32 |
> |
/* |
33 |
> |
#define ambRayInPmap(r) ((r) -> crtype & AMBIENT && \ |
34 |
> |
((photonMapping && \ |
35 |
> |
(ambounce < 0 || (r) -> rlvl > 1)) || \ |
36 |
> |
causticPhotonMapping || contribPhotonMapping)) |
37 |
> |
*/ |
38 |
> |
#define ambRayInPmap(r) 0 |
39 |
|
#define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \ |
40 |
< |
((photonMapping && ambounce < 0) || \ |
41 |
< |
(causticPhotonMapping || \ |
41 |
< |
contribPhotonMapping))) |
40 |
> |
(ambounce < 0 || ((r) -> crtype & AMBIENT ? \ |
41 |
> |
photonMapping : causticPhotonMapping))) |
42 |
|
|
43 |
|
/* Check if scattered ray spawns a caustic photon */ |
44 |
|
#define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR) |