diff --git a/src/shapes/hair.cpp b/src/shapes/hair.cpp index 4aef8248..39e3bce4 100644 --- a/src/shapes/hair.cpp +++ b/src/shapes/hair.cpp @@ -840,6 +840,11 @@ void HairShape::fillIntersectionRecord(const Ray &ray, const Vector relHitPoint = its.p - m_kdtree->firstVertex(iv); its.geoFrame.n = Normal(normalize(relHitPoint - dot(axis, relHitPoint) * axis)); its.geoFrame.t = cross(its.geoFrame.n, its.geoFrame.s); + + /* Migitate roundoff error issues by a normal shift of the computed intersection point */ + const Vector local = its.geoFrame.toLocal(relHitPoint); + its.p += its.geoFrame.n * (m_kdtree->getRadius() - std::sqrt(local.y*local.y+local.z*local.z)); + its.shFrame = its.geoFrame; its.wi = its.toLocal(-ray.d); its.hasUVPartials = false;