示例#1
0
文件: bdpt.cpp 项目: wjakob/pbrt-v3
Spectrum G(const Scene &scene, Sampler &sampler, const Vertex &v0,
           const Vertex &v1) {
    Vector3f d = v0.p() - v1.p();
    Float g = 1 / d.LengthSquared();
    d *= std::sqrt(g);
    if (v0.IsOnSurface()) g *= AbsDot(v0.ns(), d);
    if (v1.IsOnSurface()) g *= AbsDot(v1.ns(), d);
    VisibilityTester vis(v0.GetInteraction(), v1.GetInteraction());
    return g * vis.Tr(scene, sampler);
}
示例#2
0
Spectrum GeometryTerm(const Scene &scene, Sampler &sampler, const Vertex &v0,
                      const Vertex &v1) {
    Vector3f d = v0.GetPosition() - v1.GetPosition();
    Float G = 1.f / d.LengthSquared();
    d *= std::sqrt(G);
    if (v0.IsOnSurface()) G *= Dot(v0.GetShadingNormal(), d);
    if (v1.IsOnSurface()) G *= Dot(v1.GetShadingNormal(), d);
    VisibilityTester vis(v0.GetInteraction(), v1.GetInteraction());
    return std::abs(G) * vis.T(scene, sampler);
}