刘成浩(北京理工大学信息与电子学院, 北京 100081)
目的 基于双向反射分布函数的重要性采样方法在渲染物体材质表面时有极佳的拟真度，但采样方式存在复杂和高硬件存储开销的问题。针对上述问题，提出了一种基于权重生成和向量线性插值的采样方法用于解决该问题。方法 在对出射光线方向进行计算时，通过给定的入射光方向、法线方向与物体表面材质光滑度参数，首先计算镜面反射光线方向，再结合余弦与指数函数二者的函数特性生成具有一定分布特征的权重值，并将镜面反射方向与随机生成的漫反射方向进行线性插值，其插值权重即为上述生成的权重值，最后规范化得到具有一定分布特征的新的出射方向。结果 本文基于该快速采样方法，给出了路径追踪渲染算法的一套完整实现，并利用本文算法，从常见各类物体表面中抽取9种进行渲染，将所得实验结果与通过原始双向反射分布函数采样算法所渲染得到的实际结果进行比较，发现利用快速采样算法后渲染速度可提升1.521.99倍，且由于近似所造成的相对误差可控制在8%以内，并将原本用于描述物体表面的34 MB数据量降为仅几个浮点数的数据量，可知上述采样方法既具有极低硬件存储开销的特点，其渲染的图片又能保有较高的拟真度。随着光滑度参数的连续变化，可使得被渲染的物体表面由理想漫反射到理想镜面反射之间均匀过渡，从而统一了漫反射、高光反射与镜面反射三者的采样形式。结论 本文使用简化的出射光方向采样算法替代传统BRDF重要性采样算法，并配套给出基于新采样算法实现的一套完整的路径追踪渲染方法，使得在不失真实度的情况下使得计算机在模拟漫反射、高光反射与镜面反射的形式得以简化与统一。本文方法亦可作为现有诸多采样方法的替代方案，其极低的存储开销优势可用于渲染含有大量不同材质的复杂场景；在渲染一般的粗糙表面、瓷器以及金属等常见各向同性材质时也有较佳的表现力。上述的完整实现方式可以在需要的时候对静态场景做不失真实度的快速渲染。
Fast sampling method for determining the direction of reflected light in path tracing algorithm
Liu Chenghao(Beijing Institute of Technology-School of Information and Electronics, Beijing 100081, China)
Objective An importance sampling method based on bidirectional reflectance distribution function (BRDF) has excellent fidelity when rendering the surface of an object. However, this sampling method has a complicated form and can lead to heavy hardware storage cost, which can cause many problems when applied to practical use. These problems include high implementation complexity, low execution efficiency, and high debugging difficulty. Owing to these problems, this study provides a new method for computing the reflection direction of a light path. The new method uses weight generation technique and vector linear interpolation. This method not only reduces the complexity of the algorithm but also reduces the computational complexity of many previous sampling algorithms. The new method is also easy to implement. Method The algorithm initially calculates the direction of reflected light and subsequently combines the features of cosine and exponential functions given the direction of incident light and surface normal. This algorithm generates a weight value that has a certain distribution characteristic. The algorithm defines a parameter called ε to enable the distribution characteristic to be controllable. The surface tends to exhibit a diffuse reflection for each incoming light ray when ε is relatively small. Otherwise, the surface tends to exhibit an ideal mirror reflection. The new algorithm performs a linear interpolation between a mirror and diffuse reflection directions to obtain a new vector after the weight generation process, and the weight that was generated previously was used in this process. Finally, the algorithm obtains the desired reflection direction of a light ray by normalizing the new vector. This method efficiently simulates glossy surfaces, which exist vastly in real life. Result This study conducts a full implementation of the path tracing algorithm. The new algorithm is based on the new sampling method described previously. Nine kinds of common surface materials are selected for the rendering test through this algorithm. Experimental results are compared with the actual results obtained by the original BRDF sampling algorithm. The original data size for the BRDF parameter of each actual surface is approximately 34 MB. Notably, storing the raw BRDF data when the scene contains various material surfaces is infeasible. The rendering speed can be increased by 1.521.99 times using the fast sampling algorithm, and the relative error caused by approximation can be controlled within 8%. Moreover, the original 34 MB data used to describe the surface of the object can be replaced by only storing few floating-point numbers, which can apparently reduce hardware storage overhead considerably. This sampling method has a low hardware storage cost, and its rendered picture can still retain a high degree of realism. These features are favorable for modern hardware that is specifically designed for solving high computational complexity problems but limited to memory bandwidth. The object being rendered can achieve a smooth transition from an ideal diffuse to specular reflection and ideal mirror reflection because a smoothness parameter changes continuously. Moreover, the new algorithm unifies the sampling method used in many path tracing renderers. These renderers frequently use different sampling models when rendering various types of material surfaces to improve rendering quality. This improvement will inevitably increase thread divergence when rendering and considerably reduce the operating efficiency of the rendering program. These drawbacks are particularly evident on parallel hardware, such as GPUs, and must be avoided to a feasible extent. Thus, this algorithm condenses different rendering models used by various types of renderers and obtains a unified sampling method, even when the material properties of the surface are relatively complex to render correctly. The algorithm can also be appropriately extended and approximated by a multilayer fitting technique to simulate the material properties of the rendered surface. The algorithm has favorable scalability and practicality. Conclusion This study uses a simplified algorithm to compute the exit direction of light to replace the traditional method used in path tracing renderers without sacrificing the authenticity of the rendered image. This study also fully implements the path tracing algorithm to enable its practical application. This algorithm can effectively simulate mirror, diffuse, and glossy reflection, has extensive applications when rendering various kinds of objects that exist in real life, and can be used as an alternative approach to replace existing sampling methods. This algorithm has a low storage overhead, which is an advantage when rendering complex scenes that contain various materials without consuming numerous memory resources. This algorithm also exhibits excellent performance when rendering common isotropic materials, such as rough or diffuse surfaces, porcelain, and metals.