| 19 |
|
#include "otypes.h" |
| 20 |
|
#include "source.h" |
| 21 |
|
#include "rcontrib.h" |
| 22 |
+ |
#include "random.h" |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 230 |
|
} |
| 231 |
|
|
| 232 |
|
/* Reject photon if normal faces away (ignored for volume photons) */ |
| 233 |
< |
if (norm && DOT(norm, p -> norm) <= 0) |
| 233 |
> |
if (norm && DOT(norm, p -> norm) <= 0.5 * frandom()) |
| 234 |
|
return; |
| 235 |
|
|
| 236 |
|
if (isContribPmap(pmap) && pmap -> srcContrib) { |
| 456 |
|
dv [2] = pos [2] - p -> pos [2]; |
| 457 |
|
d2 = DOT(dv, dv); |
| 458 |
|
|
| 459 |
< |
if (d2 < pmap -> maxDist && DOT(norm, p -> norm) > 0) { |
| 459 |
> |
if (d2 < pmap -> maxDist && DOT(norm, p -> norm) > 0.5 * frandom()) { |
| 460 |
|
/* Closest photon so far with similar normal */ |
| 461 |
|
pmap -> maxDist = d2; |
| 462 |
|
*photon = p; |