gpt4 book ai didi

math - 蒙特卡罗路径追踪算法这部分的目的是什么?

转载 作者:行者123 更新时间:2023-12-02 04:59:24 25 4
gpt4 key购买 nike

在使用大量蒙特卡罗样本进行路径追踪的所有简单算法中,算法的追踪路径部分会随机选择返回当前表面的发射值和继续追踪来自该表面半球的另一条光线(例如幻灯片 here 中的示例)。就像这样:

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’)
  1. 这只是使用俄罗斯轮盘赌来终止路径同时保持公正的一种方式吗?当然,将所有光线路径的发射和反射属性一起计算并使用俄罗斯轮盘赌来决定是否继续跟踪会更有意义。

  2. 这是一个后续问题:为什么我看到的一些算法(例如《基于物理的渲染技术》一书中)只计算一次发射,而不是考虑所有发射属性在一个物体上?渲染方程基本上是

    L_o = L_e + 积分(从其他表面射出进入该表面半球的光)

    看起来它计算了这个 L_o 中的发射属性以及所有其他 L_o 的积分,因此算法应该遵循。

最佳答案

实际上,单次发射与反射的计算有点过于简单。为了回答第一个问题,抛硬币用于终止光线,但它会导致更大的偏差。第二个问题有点复杂......

摘要Shirley, Wang and Zimmerman TOG 94 ,作者简要总结了蒙特卡罗采样的好处和复杂性:

In a distribution ray tracer, the crucial part of the direct lighting calculation is the sampling strategy for shadow ray testing. Monte Carlo integration with importance sampling is used to carry out this calculation. Importance sampling involves the design of integrand-specific probability density functions which are used to generate sample points for the numerical quadrature. Probability density functions are presented that aid in the direct lighting calculation from luminaires of various simple shapes. A method for defining a probability density function over a set of luminaires is presented that allows the direct lighting calculation to be carried out with one sample, regardless of the number of luminaires.

如果我们开始剖析该摘要,以下是一些要点:

  1. 灯光不是点:在现实生活中,我们几乎从不处理点光源(例如单个 LED)。
  2. 阴影通常很柔和:这是非点光源的结果。在现实生活中很少见到真正棱角分明的影子。
  3. 噪声(尤其是明亮的采样伪影)会过度分散注意力:人类对事物的外观有很多直觉。请查看 OP 链接演示文稿中的幻灯片 5( table 上的玻璃球)。注意阴影中的亮点。

为了获得更真实的视觉效果而进行渲染时,必须根据表面的 bidirectional reflectance distribution function 对反射的可见性光线和照明计算光线进行采样和加权。 。

请注意,这是一种引导采样方法,与原始问题的“随机方向生成射线”方法明显不同,因为它是:

  1. 更准确:链接的 PDF 中的图像在 PDF 处理过程中受到了一些影响。图 10 是原始演示的合理表示 - 请注意,您有时会看到缺乏明亮散斑伪影(如原始演示的图 5 所示)。

  2. 速度明显更快:正如原始演示文稿所述,无引导蒙特卡罗采样可能需要相当长的时间才能收敛。更多采样光线 = 更多计算 = 更多时间。

关于math - 蒙特卡罗路径追踪算法这部分的目的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8410527/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com