minor robustness improvements
parent
6aa7534d67
commit
e1ff84e0a9
|
@ -669,6 +669,8 @@ Float ManifoldPerturbation::Q(const Path &source, const Path &proposal,
|
|||
source.vertex(a)->pdf[mode] * m_probFactor * m_probFactor);
|
||||
|
||||
Float pdf = source.vertex(a+step)->perturbPositionPdf(proposal.vertex(a+step), stddev);
|
||||
if (pdf == 0)
|
||||
return 0.0f;
|
||||
|
||||
weight /= pdf;
|
||||
}
|
||||
|
|
|
@ -128,6 +128,11 @@ bool ShapeKDTree::rayIntersect(const Ray &ray, Intersection &its) const {
|
|||
if (EXPECT_TAKEN(maxt > mint)) {
|
||||
if (rayIntersectHavran<false>(ray, mint, maxt, its.t, temp)) {
|
||||
fillIntersectionRecord<true>(ray, temp, its);
|
||||
if (std::isnan(its.t)) {
|
||||
cout << ray.toString() << endl;
|
||||
cout << its.toString() << endl;
|
||||
Log(EError, "Whaat?!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,25 +134,26 @@ public:
|
|||
inline bool rayIntersect(const Ray &_ray, Float mint, Float maxt, Float &t, void *temp) const {
|
||||
Ray ray;
|
||||
m_worldToObject.transformAffine(_ray, ray);
|
||||
Float hit = -ray.o.z/ray.d.z;
|
||||
Float hit = -ray.o.z / ray.d.z;
|
||||
|
||||
if (hit < mint || hit > maxt)
|
||||
return false;
|
||||
|
||||
Point local = ray(hit);
|
||||
|
||||
if (local.x * local.x + local.y * local.y > 1)
|
||||
if (local.x * local.x + local.y * local.y <= 1) {
|
||||
t = hit;
|
||||
|
||||
if (temp) {
|
||||
Float *data = static_cast<Float *>(temp);
|
||||
data[0] = local.x;
|
||||
data[1] = local.y;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
t = hit;
|
||||
|
||||
if (temp) {
|
||||
Float *data = static_cast<Float *>(temp);
|
||||
data[0] = local.x;
|
||||
data[1] = local.y;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rayIntersect(const Ray &ray, Float mint, Float maxt) const {
|
||||
|
|
|
@ -125,25 +125,26 @@ public:
|
|||
inline bool rayIntersect(const Ray &_ray, Float mint, Float maxt, Float &t, void *temp) const {
|
||||
Ray ray;
|
||||
m_worldToObject.transformAffine(_ray, ray);
|
||||
Float hit = -ray.o.z/ray.d.z;
|
||||
Float hit = -ray.o.z / ray.d.z;
|
||||
|
||||
if (hit < mint || hit > maxt)
|
||||
return false;
|
||||
|
||||
Point local = ray(hit);
|
||||
|
||||
if (std::abs(local.x) > 1 || std::abs(local.y) > 1)
|
||||
return false;
|
||||
if (std::abs(local.x) <= 1 && std::abs(local.y) <= 1) {
|
||||
t = hit;
|
||||
|
||||
t = hit;
|
||||
if (temp) {
|
||||
Float *data = static_cast<Float *>(temp);
|
||||
data[0] = local.x;
|
||||
data[1] = local.y;
|
||||
}
|
||||
|
||||
if (temp) {
|
||||
Float *data = static_cast<Float *>(temp);
|
||||
data[0] = local.x;
|
||||
data[1] = local.y;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool rayIntersect(const Ray &ray, Float mint, Float maxt) const {
|
||||
|
|
Loading…
Reference in New Issue