蒙特卡罗路径追踪算法这部分的目的是什么?
在使用大量蒙特卡罗样本进行路径追踪的所有简单算法中,算法的追踪路径部分会随机选择返回当前表面的发射值和继续追踪来自该表面半球的另一条光线(例如在幻灯片此处)。就像这样:
TracePath(p, d) returns (r,g,b) [and calls itself recursively]:
Trace ray (p, d) to find nearest intersection p’
Select with probability (say) 50%:
Emitted:
return 2 * (Le_red, Le_green, Le_blue) // 2 = 1/(50%)
Reflected:
generate ray in random direction d’
return 2 * fr(d ->d’) * (n dot d’) * TracePath(p’, d’)
这只是使用俄罗斯轮盘赌来终止路径同时保持公正的一种方式吗?当然,将所有光线路径的发射和反射属性一起计算并使用俄罗斯轮盘赌来决定是否继续跟踪会更有意义。
这里有一个后续问题:为什么我看到的一些算法(例如《基于物理的渲染技术》一书中)只计算发射一次,而不是考虑对象上的所有发射属性?渲染方程基本上是
L_o = L_e + (光线从其他表面射入该表面的半球)
这似乎计算了这个 L_o 和所有其他 L_o 的积分中的发射属性,因此算法应该遵循。
In all of the simple algorithms for path tracing using lots of monte carlo samples the tracing the path part of the algorithm randomly chooses between returning with the emitted value for the current surface and continuing by tracing another ray from that surface's hemisphere (for example in the slides here). Like so:
TracePath(p, d) returns (r,g,b) [and calls itself recursively]:
Trace ray (p, d) to find nearest intersection p’
Select with probability (say) 50%:
Emitted:
return 2 * (Le_red, Le_green, Le_blue) // 2 = 1/(50%)
Reflected:
generate ray in random direction d’
return 2 * fr(d ->d’) * (n dot d’) * TracePath(p’, d’)
Is this just a way of using russian roulette to terminate a path while remaining unbiased? Surely it would make more sense to count the emissive and reflective properties for all ray paths together and use russian roulette just to decide whether to continue tracing or not.
And here's a follow up question: why do some of these algorithms I'm seeing (like in the book 'Physically Based Rendering Techniques') only compute emission once, instead of taking in to account all the emissive properties on an object? The rendering equation is basically
L_o = L_e + integral of (light exiting other surfaces in to the hemisphere of this surface)
which seems like it counts the emissive properties in both this L_o and the integral of all the other L_o's, so the algorithms should follow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
实际上,单次发射与反射的计算有点过于简单。为了回答第一个问题,抛硬币用于终止光线,但它会导致更大的偏差。第二个问题有点复杂......
在 Shirley 的摘要中, Wang 和 Zimmerman TOG 94,作者简要总结了蒙特卡罗采样的好处和复杂性:
如果我们开始剖析这个抽象概念,以下是一些要点:
当渲染以获得更真实的视觉效果时,必须根据表面的 双向反射率分布函数。
请注意,这是一种引导采样方法,与原始问题的“随机方向生成射线”方法明显不同,因为它具有:
更准确:链接 PDF 中的图像会受到 PDF 处理的影响。图 10 是原始演示文稿的合理表示 - 请注意,您有时会看到缺乏明亮斑点伪像(如原始演示文稿的图 5 所示)。
速度明显加快:正如原始演示文稿所述,无引导蒙特卡罗采样可能需要相当长的时间才能收敛。更多采样光线 = 更多计算 = 更多时间。
In reality, the single emission vs. reflection calculation is a bit too simplistic. To answer the first question, the coin-flip is used to terminate the ray but it leads to much greater biases. The second question is a bit more complex....
In the abstract of Shirley, Wang and Zimmerman TOG 94, the authors briefly summarize the benefits and complexities of Monte Carlo sampling:
If we start dissecting that abstract, here are some of the important points:
When rendering for more visual realism, both of the sets of reflected visibility rays and lighting calculation rays must be sampled and weighted according to the surface's bidirectional reflectance distribution function.
Note that this is a guided sampling method that's distinctly different from the original question's "generate ray in random direction" method in that it is both:
More accurate: the images in the linked PDF suffer a bit from the PDF process. Figure 10 is a reasonable representation of the original - note that lack of bright speckle artifacts that you will sometimes see (as in figure 5 of the original presentation).
Significantly faster: as the original presentation notes, unguided Monte Carlo sampling can take quite a while to converge. More sampling rays = much more computation = more time.
阅读幻灯片后(感谢您的发帖),我将尽力修改我的答案。
同时保持公正?当然,计算起来更有意义
所有光线路径的发射和反射属性一起
并使用俄罗斯轮盘赌来决定是否继续追踪
或不。
也许发射和反射属性的处理方式不同,因为反射路径依赖于入射路径,而发射路径则不然(至少对于光谱表面而言)。该算法是否采用贝叶斯方法并使用有关入射角的先验信息作为预测反射角的先验信息?或者这是对所有路径进行费曼积分以得出概率?如果不深入研究该理论的细节,很难说清楚。
我之前对黑体的评论是非常不正确的。我看到幻灯片讨论了(R、G、B)组件;黑体发射率在所有波长上积分。
这是一个后续问题:为什么我要使用其中一些算法
看到(就像在“基于物理的渲染技术”一书中)
只计算一次发射,而不是考虑所有
物体的发射特性?渲染方程为
基本上
L_o = L_e + (从其他表面射出的光进入
这个表面的半球)
表面的单一发射率将假设波长或方向上不存在函数关系。我不知道它对于渲染逼真的图像有多大意义。
发布的内容肯定令人印象深刻。我想知道如果将您想到的复杂性包括在内,它们看起来会有何不同?
感谢您提出一个好问题 - 我正在投票。我已经很久没有思考过这样的问题了。我希望我能提供更多帮助。
After reading the slides (thank you for posting), I'll amend my answer as best I can.
while remaining unbiased? Surely it would make more sense to count
the emissive and reflective properties for all ray paths together
and use russian roulette just to decide whether to continue tracing
or not.
Perhaps the emitted and reflected properties are treated differently because the reflected path depends on the incident path in a way that emitted paths do not (at least for a spectral surface). Does the algorithm take a Bayesian approach and use prior information about the incidence angle as a prior for predicting the reflective angle? Or is this a Feynman integration over all paths to come up with a probability? It's hard to tell without digging deeper into the details of the theory.
My earlier black body comment is quite incorrect. I see that the slides talk about (R, G, B) components; black body emissivities are integrated over all wavelengths.
And here's a follow up question: why do some of these algorithms I'm
seeing (like in the book 'Physically Based Rendering Techniques')
only compute emission once, instead of taking in to account all the
emissive properties on an object? The rendering equation is
basically
L_o = L_e + integral of (light exiting other surfaces in to the
hemisphere of this surface)
A single emissivity for the surface would assume that there's no functional relationship on wavelength or direction. I don't know how significant it is for rendering photo-realistic images.
The ones that are posted are certainly impressive. I wonder how different they would look if the complexities that you have in mind were included?
Thank you for posting a nice question - I'm voting it up. It's been a long time since I've thought about this kind of problem. I wish I could be more helpful.