gpt4 book ai didi

graphics - 光线追踪中的区域照明

转载 作者:行者123 更新时间:2023-12-04 14:52:38 25 4
gpt4 key购买 nike

我有一个关于光线追踪中区域照明的快速问题。我正在从 Ray Tracing from the Ground Up 学习这个主题当没有应用抗锯齿时,我的区域光的结果是这样的:NO AA

如您所见,图像中有很多噪点。当我应用抗锯齿时,它看起来不错,应用 256x AA 时看起来像这样:

AA 256x

[阴影颜色的变化是微不足道的,我改变了阴影的一些属性]

我的问题是,这是区域灯的行为方式还是我做错了什么?因为渲染第一个只需要 4 ,而后一个需要将近 20 分钟。感觉哪里不对。

我的点光源类和面光源类之间的唯一区别是 get_direction 函数。

点光源的get_direction函数:

virtual Vec get_direction(ShadeRec& sr)
{
return Vec(position.x-sr.hit_point.x, position.y-sr.hit_point.y, position.z-sr.hit_point.z).norm();
}

区域光的get_direction函数:

virtual Vec get_direction(ShadeRec& sr)
{
Vec newLocation;
newLocation.x = position.x + radius * (2.0 * rand_float() - 1.0);
newLocation.y = position.y + radius * (2.0 * rand_float() - 1.0);
newLocation.z = position.z + radius * (2.0 * rand_float() - 1.0);
return ((newLocation - sr.hit_point).norm());
}

最佳答案

您发布的渲染时间对我来说非常有意义:

4 seconds * 256 ~= 17 minutes

随机数生成器引入的开销加起来就是其余部分。

关于graphics - 光线追踪中的区域照明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11953825/

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