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 (r->crtype & AMBIENT && photonMapping) |
112 |
+ |
return(-1); |
113 |
|
if (maxdepth <= 0 && rc != NULL) { /* Russian roulette */ |
114 |
|
if (minweight <= 0.0) |
115 |
|
error(USER, "zero ray weight in Russian roulette"); |
185 |
|
{ |
186 |
|
RAY tr; |
187 |
|
|
188 |
< |
if (rayorigin(&tr, TRANS, r, NULL) == 0) { |
189 |
< |
VCOPY(tr.rdir, r->rdir); |
190 |
< |
rayvalue(&tr); |
191 |
< |
copycolor(r->rcol, tr.rcol); |
192 |
< |
r->rt = r->rot + tr.rt; |
189 |
< |
} |
188 |
> |
rayorigin(&tr, TRANS, r, NULL); /* always continue */ |
189 |
> |
VCOPY(tr.rdir, r->rdir); |
190 |
> |
rayvalue(&tr); |
191 |
> |
copycolor(r->rcol, tr.rcol); |
192 |
> |
r->rt = r->rot + tr.rt; |
193 |
|
} |
194 |
|
|
195 |
|
|
252 |
|
multcolor(r->rcol, ce); /* path extinction */ |
253 |
|
if (r->crtype & SHADOW || intens(r->albedo) <= FTINY) |
254 |
|
return; /* no scattering */ |
255 |
< |
setcolor(ca, |
256 |
< |
colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)), |
257 |
< |
colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)), |
258 |
< |
colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU))); |
259 |
< |
addcolor(r->rcol, ca); /* ambient in scattering */ |
255 |
> |
|
256 |
> |
/* PMAP: indirect inscattering accounted for by volume photons? */ |
257 |
> |
if (!volumePhotonMapping) { |
258 |
> |
setcolor(ca, |
259 |
> |
colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)), |
260 |
> |
colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)), |
261 |
> |
colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU))); |
262 |
> |
addcolor(r->rcol, ca); /* ambient in scattering */ |
263 |
> |
} |
264 |
> |
|
265 |
|
srcscatter(r); /* source in scattering */ |
266 |
|
} |
267 |
|
|