Skip to content
Snippets Groups Projects
Commit 23efb01b authored by johannes hanika's avatar johannes hanika Committed by Wenzel Jakob
Browse files

hslt: always use a consistent edge direction in the bidirectional abstraction layer

parent 7e705a62
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,8 @@ struct MTS_EXPORT_BIDIR PathEdge {
/**
* \brief Normalized direction vector associated with this edge
*
* The direction always points along the light path (from the light)
*/
Vector d;
......
......@@ -63,6 +63,9 @@ bool PathEdge::sampleNext(const Scene *scene, Sampler *sampler,
weight[1-mode] = mRec.transmittance / pdf[1-mode];
}
d = ray.d;
/* Direction always points along the light path (from the light source along the path) */
if(mode == ERadiance)
d = -d;
return true;
}
......@@ -105,6 +108,9 @@ bool PathEdge::perturbDirection(const Scene *scene,
return false;
}
d = ray.d;
/* Direction always points along the light path (from the light source along the path) */
if(mode == ERadiance)
d = -d;
if (length == 0)
return false;
......@@ -274,6 +280,9 @@ bool PathEdge::connect(const Scene *scene,
}
}
/* Direction always points along the light path (from the light source along the path) */
d = -d;
return true;
}
......@@ -330,7 +339,8 @@ bool PathEdge::pathConnect(const Scene *scene, const PathEdge *predEdge,
result.append(edge);
edge->length = std::min(its.t, remaining);
edge->medium = medium;
edge->d = d;
/* Direction always points along the light path (from the light source along the path) */
edge->d = -d;
if (medium) {
MediumSamplingRecord mRec;
......@@ -557,6 +567,9 @@ bool PathEdge::pathConnectAndCollapse(const Scene *scene, const PathEdge *predEd
}
}
/* Direction always points along the light path (from the light source along the path) */
d = -d;
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment