14 |
|
#include "otypes.h" |
15 |
|
#include "otspecial.h" |
16 |
|
#include "random.h" |
17 |
+ |
#include "pmap.h" |
18 |
|
|
19 |
|
#define MAXCSET ((MAXSET+1)*2-1) /* maximum check set size */ |
20 |
|
|
107 |
|
return(-1); |
108 |
|
if (r->crtype & SHADOW) /* shadow commitment */ |
109 |
|
return(0); |
110 |
+ |
/* ambient in photon map? */ |
111 |
+ |
if (ro != NULL && ro->crtype & AMBIENT) { |
112 |
+ |
if (causticPhotonMapping) |
113 |
+ |
return(-1); |
114 |
+ |
if (photonMapping && rt != TRANS) |
115 |
+ |
return(-1); |
116 |
+ |
} |
117 |
|
if (maxdepth <= 0 && rc != NULL) { /* Russian roulette */ |
118 |
|
if (minweight <= 0.0) |
119 |
|
error(USER, "zero ray weight in Russian roulette"); |
189 |
|
{ |
190 |
|
RAY tr; |
191 |
|
|
192 |
< |
if (rayorigin(&tr, TRANS, r, NULL) == 0) { |
193 |
< |
VCOPY(tr.rdir, r->rdir); |
194 |
< |
rayvalue(&tr); |
195 |
< |
copycolor(r->rcol, tr.rcol); |
196 |
< |
r->rt = r->rot + tr.rt; |
189 |
< |
} |
192 |
> |
rayorigin(&tr, TRANS, r, NULL); /* always continue */ |
193 |
> |
VCOPY(tr.rdir, r->rdir); |
194 |
> |
rayvalue(&tr); |
195 |
> |
copycolor(r->rcol, tr.rcol); |
196 |
> |
r->rt = r->rot + tr.rt; |
197 |
|
} |
198 |
|
|
199 |
|
|
256 |
|
multcolor(r->rcol, ce); /* path extinction */ |
257 |
|
if (r->crtype & SHADOW || intens(r->albedo) <= FTINY) |
258 |
|
return; /* no scattering */ |
259 |
< |
setcolor(ca, |
260 |
< |
colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)), |
261 |
< |
colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)), |
262 |
< |
colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU))); |
263 |
< |
addcolor(r->rcol, ca); /* ambient in scattering */ |
259 |
> |
|
260 |
> |
/* PMAP: indirect inscattering accounted for by volume photons? */ |
261 |
> |
if (!volumePhotonMapping) { |
262 |
> |
setcolor(ca, |
263 |
> |
colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)), |
264 |
> |
colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)), |
265 |
> |
colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU))); |
266 |
> |
addcolor(r->rcol, ca); /* ambient in scattering */ |
267 |
> |
} |
268 |
> |
|
269 |
|
srcscatter(r); /* source in scattering */ |
270 |
|
} |
271 |
|
|