adaptive ray epsilon
parent
0b8863f2cb
commit
9fcc46643b
|
@ -108,9 +108,7 @@ public:
|
|||
|
||||
/// Cast a shadow ray
|
||||
inline bool isOccluded(const Point &p1, const Point &p2) const {
|
||||
Intersection its;
|
||||
Vector direction = p2 - p1;
|
||||
Ray ray(p1, direction);
|
||||
Ray ray(p1, p2-p1);
|
||||
ray.mint = ShadowEpsilon;
|
||||
ray.maxt = 1-ShadowEpsilon;
|
||||
return m_kdtree->rayIntersect(ray);
|
||||
|
|
|
@ -211,8 +211,15 @@ bool KDTree::rayIntersect(const Ray &ray, Intersection &its) const {
|
|||
++raysTraced;
|
||||
if (m_rootBounds.rayIntersect(ray, mint, maxt)) {
|
||||
its.t = std::numeric_limits<Float>::infinity();
|
||||
if (ray.mint > mint)
|
||||
mint = ray.mint;
|
||||
|
||||
/* Adaptive ray epsilon */
|
||||
Float rayMinT = ray.mint;
|
||||
if (rayMinT == Epsilon)
|
||||
rayMinT *= std::max(std::max(std::abs(ray.o.x),
|
||||
std::abs(ray.o.y)), std::abs(ray.o.z));
|
||||
|
||||
if (rayMinT > mint)
|
||||
mint = rayMinT;
|
||||
if (ray.maxt < maxt)
|
||||
maxt = ray.maxt;
|
||||
if (maxt <= mint)
|
||||
|
|
Loading…
Reference in New Issue