在使用MIS时,我们总是希望用一个统一的方法来表示PDF值,以避免它们之间的比值变得毫无意义。然而,当我阅读PBR书的第16章时,我对如何选择正确的测量方法感到困惑。
首先,我看到在子路径连接 s == 1 (仅使用光路径上的一个顶点)情况下,如果光顶点是可连接的,我们首先需要采样(有点类似)直接组件:
Spectrum lightWeight = light->Sample_Li(pt.GetInteraction(), sampler.Get2D(),
&wi, &pdf, &vis);在这里,pdf是在Sample_Li方法中计算的,它后来被用于
sampled = Vertex::CreateLight(ei, lightWeight / (pdf * lightPdf), 0);典型的MC估计步骤,对吗?在单向路径跟踪中,pdf * lightPdf定义为立体角测量,因此在对区域源上的一个顶点进行采样后(用pdf = 1. / area),我们应该使用length^2 / cos将其转换为实心角测量。然而,在pbrt-v3中,Sample_Li似乎返回了面积度量中定义的pdf。在这里,我引用lights/diffusive.cpp在pbrt-v3中的代码:
Interaction pShape = shape->Sample(ref, u, pdf);以及示例方法(例如,如果形状为三角形):
Interaction Triangle::Sample(const Point2f &u, Float *pdf) const {
/** ... */
*pdf = 1 / Area();
/** ... */
}在我看来,转换似乎还没有完成。更令人困惑的是,pbr-book说:
与Sample_Li()一样,此方法返回的PDF值是根据参考点的实心角度定义的。[参考]
是的,Sample_Wi()确实返回了以实心角度度量定义的pdf:
// pdf calculation defined in Sample_Wi
*pdf = (dist * dist) / (AbsDot(lensIntr.n, *wi) * lensArea);然而,lightWeight似乎被Sample_Li()返回的pdf除以,这似乎是用面积度量来定义的。这让我很困惑?这里有什么误会吗?这是BDPT的一种奇怪的机制吗?
发布于 2023-03-11 12:39:09
实际上,shape-> sample (ref,u,pdf)返回实心角度的measure.The样本函数中的pdf实际上就是这样。
Interaction Shape::Sample(const Interaction &ref, const Point2f &u,
Float *pdf) const {
Interaction intr = Sample(u, pdf);
Vector3f wi = intr.p - ref.p;
if (wi.LengthSquared() == 0)
*pdf = 0;
else {
wi = Normalize(wi);
// Convert from area measure, as returned by the Sample() call
// above, to solid angle measure.
*pdf *= DistanceSquared(ref.p, intr.p) / AbsDot(intr.n, -wi);
if (std::isinf(*pdf)) *pdf = 0.f;
}
return intr;
}此函数将调用虚拟函数示例( virtual Interaction Sample(const Point2f &u, Float *pdf) const = 0;),它也是三角example.So中的函数--虚拟函数在面积测量中计算pdf,而非虚拟函数组合成实心角度测量。
https://computergraphics.stackexchange.com/questions/13320
复制相似问题