首页 理论教育光线跟踪算法:虚拟现实开发实践中的核心技术

光线跟踪算法:虚拟现实开发实践中的核心技术

【摘要】:1)辐照度Total amount of energy received per unit area of a surface。2)照明度Essentially same as irradiance,the difference is that illuminance measures the amount of visible light energy in photometric terms。3)辐射Measure of energy that is reflected by the surface。4)亮度Measure of photometrically weighted light energy that leaves the surface。5)Amount of light energy that is emitted by the surface in a given direction。实际上称为反向光线追踪,因为计算是从camera开始发射光线,而不是从光源发射光线。图3-9胶片被分成离散网格对于每一个像素,从camera位置追踪一条光线,指向该像素点。

1)辐照度(Irradiance)

Total amount of energy received per unit area of a surface。

2)照明度(Illuminance)

Essentially same as irradiance,the difference is that illuminance measures the amount of visible light energy in photometric terms。

3)辐射(Radiance)

Measure of energy that is reflected by the surface。

4)亮度(Luminance)

Measure of photometrically weighted light energy that leaves the surface。

5) (Luminous intensity)

Amount of light energy that is emitted by the surface in a given direction。

实际上称为反向光线追踪(backward raytracing),因为计算是从camera开始发射光线,而不是从光源发射光线。

反向光线追踪步骤:

(1)camera的胶片被分成离散的网格(即像素点),我们的目标是确定每一个像素点的颜色值(见图3-9)。

(www.chuimin.cn)

图3-9 胶片被分成离散网格

(2)对于每一个像素,从camera位置追踪一条光线,指向该像素点(见图3-10)。

图3-10 每一个像素追踪一条光线

(3)对于这束光线,判断其是否和场景中的物体相交。如果相交,则转到步骤(4);否则,将背景色填充到当前像素中去,回到步骤(2),继续处理下一个像素。

(4)如果光线和物体相交,计算物体表面交点的颜色值。该点的颜色值即为该像素的颜色值。

①首先检查每个光源在该交点的贡献值。追踪一条新光线去光源,用来确定交点是被全部照亮、部分照亮还是没有被照亮,同时确定了阴影(见图3-11)。

图3-11 追踪新光线至光源

②如果物体表面具有反射性质,计算初始光线的反射光线,然后追踪这条反射光线,转到步骤(3)。

③如果物体表面具有折射性质,计算初始光线的折射光线,然后追踪这条折射光线,转到步骤(3)。

④最终,根据表面性质(反射率、折射率),和不同类型光线计算得出的颜色值,来确定交点的颜色值,即当前像素点的颜色值。

(5)回到步骤(2),继续下一个像素点。重复这个过程直到像素点都遍历完成。