1 |
+ |
/* RCSid $Id$ */ |
2 |
|
/* |
3 |
|
================================================================== |
4 |
|
Photon map support routines for scattering by materials. |
9 |
|
supported by the Swiss National Science Foundation (SNSF, #147053) |
10 |
|
================================================================== |
11 |
|
|
11 |
– |
$Id$ |
12 |
|
*/ |
13 |
|
|
14 |
|
|
18 |
|
#include "pmap.h" |
19 |
|
|
20 |
|
/* |
21 |
< |
Checks for paths already accounted for in photon map to avoid |
21 |
> |
Check 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 |
– |
|
24 |
|
shadowRayInPmap(): Check for DIFFUSE -> SPECULAR -> LIGHT |
25 |
|
subpaths. These occur during the backward pass |
26 |
|
when a shadow ray is transferred through a |
28 |
|
accounted for by caustic photons in the global, |
29 |
|
contrib, or dedicated caustic photon map. |
30 |
|
*/ |
31 |
< |
/* |
31 |
> |
/* |
32 |
|
#define ambRayInPmap(r) ((r) -> crtype & AMBIENT && \ |
33 |
|
((photonMapping && \ |
34 |
|
(ambounce < 0 || (r) -> rlvl > 1)) || \ |
35 |
|
causticPhotonMapping || contribPhotonMapping)) |
36 |
< |
*/ |
36 |
> |
*/ |
37 |
|
#define ambRayInPmap(r) 0 |
38 |
|
#define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \ |
39 |
< |
(ambounce < 0 || causticPhotonMapping)) |
39 |
> |
(ambounce < 0 || ((r) -> crtype & AMBIENT ? \ |
40 |
> |
photonMapping : causticPhotonMapping))) |
41 |
|
|
42 |
|
/* Check if scattered ray spawns a caustic photon */ |
43 |
|
#define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR) |