lec16
目录
2 蒙特卡洛积分Monte Carlo Integration
3.1 Whitted-Style Ray Tracing存在的问题
3.2 Path Tracing —— 利用蒙特卡洛方法解渲染方程
原文链接:https://blog.csdn.net/Motarookie/article/details/122353183
1 概率论复习
2 蒙特卡洛积分Monte Carlo Integration
3 蒙特卡洛路径追踪Path Tracing
3.1 Whitted-Style Ray Tracing存在的问题
到此我们可以得出,Whitted-Style光追是“错”的,渲染方程是对的。
3.2 Path Tracing —— 利用蒙特卡洛方法解渲染方程
Shade(p,wo)
{
// 1、来自光源的贡
对光源均匀采样,即随机选择光源表面一个点x'; //pdf_light = 1 / A
shoot a ray form p to x';
L_dir = 0.0;
if (the ray is not blocked in the middle) // 判断是否被遮挡
L_dir = L_i * f_r * cosθ * cosθ' / |x' - p|^2 / pdf_light;
//2、来自其他物体的反射光
L_indir = 0.0;
Test Russian Roulette with probability P_RR;
Uniformly sample the hemisphere toward wi; //pdf_hemi = 1 / 2π
Trace a ray r(p,wi);
if (ray r hit a non-emitting object at q)
L_indir = shade(q, -wi) * f_r * cosθ / pdf_hemi / P_RR;
return L_dir + L_indir;
}
路径追踪不好做点光源的计算,建议把点光源做成有很小面积的面光源。
4 Path Tracing 结语
- 路径追踪的学习确实比较难。涉及到物理、概率论、微积分、编码
- 路径追踪是现代正在使用的前沿技术
- 路径追踪几乎是100%正确的算法
原文链接:https://blog.csdn.net/Motarookie/article/details/122353183