ported cylinder.cpp improvements to hair.cpp

metadata
Wenzel Jakob 2014-03-20 12:57:31 +01:00
parent 0c20766291
commit 923069f877
1 changed files with 5 additions and 0 deletions

View File

@ -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;