路径追踪中出射光线方向的快速采样方法

刘成浩(北京理工大学信息与电子学院)

摘 要

**目的**基于双向反射分布函数的重要性采样方法在渲染物体材质表面时有极佳的拟真度，但采样方式存在复杂和高硬件存储开销的问题。针对上述问题，提出了一种基于权重生成和向量线性插值的采样方法用于解决该问题。

**方法**在对出射光线方向进行计算时，通过给定的入射光方向、法线方向与物体表面材质光滑度参数，首先计算镜面反射光线方向，再结合余弦与指数函数二者的函数特性生成具有一定分布特征的权重值，并将镜面反射方向与随机生成的漫反射方向进行线性插值，其插值权重即为上述生成的权重值，最后规范化得到具有一定分布特征的新的出射方向。

**结果**本文基于该快速采样方法，给出了路径追踪渲染算法的一套完整实现，并利用本文算法，从常见各类物体表面中抽取9种进行渲染，将所得实验结果与通过原始BRDF采样算法所渲染得到的实际结果进行比较，发现利用快速采样算法后渲染速度可提升1.52到1.99倍，且由于近似所造成的相对误差可控制在8%以内，并将原本用于描述物体表面的34MB数据量降为仅几个浮点数的数据量，可知上述采样方法既具有极低硬件存储开销的特点，其渲染的图片又能保有较高的拟真度。随着光滑度参数的连续变化，可使得被渲染的物体表面由理想漫反射到理想镜面反射之间均匀过渡，从而统一了漫反射、高光反射与镜面反射三者的采样形式。

**结论**本文使用简化的出射光方向采样算法替代传统BRDF重要性采样算法，并配套给出基于新采样算法实现的一套完整的路径追踪渲染方法，使得在不失真实度的情况下使得计算机在模拟漫反射、高光反射与镜面反射的形式得以简化与统一。本文所述方法亦可作为现有诸多采样方法的替代方案，其极低的存储开销优势可用于渲染含有大量不同材质的复杂场景；在渲染一般的粗糙表面、瓷器以及金属等常见各向同性材质时也有较佳的表现力。上述的完整实现方式可以在需要的时候对静态场景做不失真实度的快速渲染。

关键词

A fast sampling method for determining the direction ofreflect light in path tracing algorithm

Liu Chenghao()

Abstract

**Objective**Importance sampling method based on bidirectional reflectance distribution function has excellent fidelity when rendering the surface of the object, but this sampling method has a complicated form and can also lead to heavy hardware storage cost, which can cause many problems when applied to practical use. These problems include high implementation complexity; low execute efficiency and high debugging difficulty. Due to these problems, this paper provides a new method for computing the reflect direction of the light path. And the new method is by using weight generation technique and vector linear interpolation. This not only reduces the complexity of the algorithm but also reduces the computational complexity of many previous sampling algorithms. And it is very easy to implement.

**Method**By given the direction of incident light and surface normal, the algorithm first calculates the direction of reflection light, then by combining the features of cosine and exponential function, this algorithm generates a weight value which has a certain distribution characteristic. In order to make the distribution characteristic controllable, the algorithm defines a parameter named

**Result**This paper gives a full implementation of the path tracing algorithm. And the new algorithm is based on the new sampling method as described before. By using this algorithm, 9 kinds of common surface materials are selected for render testing and the experimental results are compared with the actual results obtained by the original BRDF sampling algorithm. The original data size for each actual surface’s BRDF parameter is about 34MB. Obviously, it"s not possible to store their raw BRDF data when the scene contains a large number of different material surfaces. And it was found that the rendering speed can be increased by 1.52 to 1.99 times using the fast sampling algorithm, and the relative error caused by approximation can be controlled within 8%. Also, the original 34MB data used to describe the surface of the object can be replaced by only storing a few amounts of floating-point numbers. Apparently, it can greatly reduce hardware storage overhead. It can be seen that this sampling method has the characteristics of extremely low hardware storage cost, and the rendered picture can still retain a high degree of realism. These features are very friendly to modern hardware which are specially designed for solving high computational complexity problems but limited to memory bandwidth. As the smoothness parameter changes continuously, the object being rendered can perform a smooth transition from ideal diffuse, specular reflection, finally to ideal mirror reflection. Also, the new algorithm actually unifies the sampling method used in many path tracing renderers. In order to achieve better rendering quality, these renderers above often use different sampling models when rendering different types of material surfaces. This will inevitably increase thread divergence when rendering, which will also greatly reduce the operating efficiency of the rendering program. These drawbacks are particularly evident on parallel hardware such as GPUs and should be avoided as much as possible. So this algorithm sums up different rendering models used by various types of renderers and obtains a unified sampling method, even when the material properties of the surface are too complex to render correctly, the algorithm can also be appropriately extended, and can be approximated by a multi-layer fitting technique to simulate material properties of the rendered surface. The algorithm mentioned above has good scalability and practicality.

**Conclusion**This paper uses a simplified algorithm for computing the exit direction of light to replace the old style method used in path tracing renderers without sacrificing authenticity of the rendered image. And it also gives a full implementation of the path tracing algorithm to make it into practical application. This algorithm can effectively simulate mirror, diffuse, glossy reflection and has a wide range of applications when rendering various kinds of objects which exist in real life, which can also be used as an alternative way to replace current existing sampling methods. Its extremely low storage overhead can be used as an advantage to render complex scenes which contain a large number of different materials without consuming too much memory resources; it also has excellent performance when rendering common isotropic materials such as rough or diffuse surfaces, porcelain, and metals.

Keywords