CN106251393B - A kind of gradual Photon Mapping optimization method eliminated based on sample - Google Patents
A kind of gradual Photon Mapping optimization method eliminated based on sample Download PDFInfo
- Publication number
- CN106251393B CN106251393B CN201610555035.0A CN201610555035A CN106251393B CN 106251393 B CN106251393 B CN 106251393B CN 201610555035 A CN201610555035 A CN 201610555035A CN 106251393 B CN106251393 B CN 106251393B
- Authority
- CN
- China
- Prior art keywords
- photon
- elimination
- photons
- point
- rendering
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 48
- 238000013507 mapping Methods 0.000 title claims abstract description 33
- 238000005457 optimization Methods 0.000 title claims abstract description 17
- 230000008030 elimination Effects 0.000 claims abstract description 64
- 238000003379 elimination reaction Methods 0.000 claims abstract description 64
- 238000009877 rendering Methods 0.000 claims abstract description 60
- 230000000750 progressive effect Effects 0.000 claims abstract description 25
- 238000004040 coloring Methods 0.000 claims abstract description 15
- 238000003384 imaging method Methods 0.000 claims abstract description 5
- 238000004422 calculation algorithm Methods 0.000 claims description 14
- 238000004364 calculation method Methods 0.000 claims description 9
- 230000002457 bidirectional effect Effects 0.000 claims description 3
- 238000005315 distribution function Methods 0.000 claims description 3
- 238000010521 absorption reaction Methods 0.000 claims description 2
- 230000000694 effects Effects 0.000 description 16
- 238000005286 illumination Methods 0.000 description 9
- 238000009826 distribution Methods 0.000 description 7
- 238000005070 sampling Methods 0.000 description 6
- 238000003860 storage Methods 0.000 description 4
- 238000003672 processing method Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000009825 accumulation Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000003518 caustics Substances 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/06—Ray-tracing
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Generation (AREA)
Abstract
本发明公开了一种基于样本消除的渐进式光子映射优化方法,包括光线跟踪阶段;光子跟踪阶段;光子消除阶段;渲染成像阶段:遍历着色点,查询着色点的光子搜索半径范围内且在光子图中的光子,利用着色点对屏幕空间的贡献参数计算着色点的贡献颜色,并将贡献颜色返回给屏幕空间以形成渲染图像;光子渲染迭代:缩小着色点的光子搜索半径范围,重复光子跟踪阶段至渲染成像阶段,直至达到设定的迭代渲染次数,将所有形成的渲染图像累加后求平均,得到最终渲染图像。本发明具有易实施,方法简单,蓝噪声属性好的特点。
The invention discloses a progressive photon mapping optimization method based on sample elimination, which includes a ray tracing stage; a photon tracing stage; a photon elimination stage; a rendering and imaging stage: traversing a coloring point, querying the photon search radius of the coloring point and within the photon The photon in the figure uses the contribution parameters of the shading point to the screen space to calculate the contribution color of the shading point, and returns the contribution color to the screen space to form a rendered image; photon rendering iteration: narrow the photon search radius of the shading point, and repeat photon tracking From the stage to the rendering and imaging stage, until the set number of iterative renderings is reached, all the rendered images formed are accumulated and averaged to obtain the final rendered image. The invention has the characteristics of easy implementation, simple method and good blue noise property.
Description
技术领域technical field
本发明涉及图形学真实感渲染领域,具体涉及一种基于样本消除的渐进式光子映射优化方法。The invention relates to the field of graphics realistic rendering, in particular to a progressive photon mapping optimization method based on sample elimination.
背景技术Background technique
光子映射算法是全局光照算法的一种,主要用来实现真实感的渲染效果达到照片级别的渲染图像质量(Photorealistic Rendering)。追求真实的照片级图像质量的渲染是目前影视制动领域的最核心的一种技术,称为真实感渲染。真实感渲染可以使三维影视动漫作品更加的逼真,表现出与现实生活中同样的真实性效果。真实感渲染的主要包括了全局光照算法,特效模拟等关键技术。全局光照算法实现了不只渲染光源对物体的照射效果,还渲染了光能在物体与物体之间的传播效果,包括色溢、焦散、环境遮挡等。Photon mapping algorithm is a kind of global illumination algorithm, which is mainly used to achieve realistic rendering effect and achieve photorealistic rendering image quality (Photorealistic Rendering). Rendering in pursuit of real photo-level image quality is the core technology in the field of film and television braking, which is called realistic rendering. Realistic rendering can make 3D film and television animation works more realistic, showing the same authentic effect as in real life. Realistic rendering mainly includes key technologies such as global illumination algorithm and special effect simulation. The global illumination algorithm not only renders the effect of the light source on the object, but also renders the propagation effect of light energy between objects, including color overflow, caustics, and ambient occlusion.
渐进式光子映射算法[Progressive photon mapping]是一种优化的光子映射算法,通过把光子渲染分为多次迭代取得渐进式的渲染效果,并解决光子渲染中的存储和偏差问题。第一步是光线追踪阶段,从摄像机出发,通过屏幕空间向场景中发射光线,追踪光线和场景的交点,记录这些交点和对屏幕空间的贡献参数,这些交点也被称为着色点。然后进行光子渲染的迭代阶段。每一遍光子渲染分为光子发射预处理阶段和光子收集两个阶段。Progressive photon mapping algorithm [Progressive photon mapping] is an optimized photon mapping algorithm, which achieves progressive rendering effects by dividing photon rendering into multiple iterations, and solves the problem of storage and deviation in photon rendering. The first step is the ray tracing stage, starting from the camera, sending rays to the scene through the screen space, tracing the intersection points of the rays and the scene, recording these intersection points and the contribution parameters to the screen space, these intersection points are also called shading points. The iterative phase of photon rendering then proceeds. Each pass of photon rendering is divided into photon emission preprocessing stage and photon collection stage.
现有的光子映射算法需要通过大规模的光子发射才能保证渲染精度,在光子跟踪阶段和渲染阶段都需要较大的系统执行时间和存储空间开销,使计算效率较低。而在选择发射一定数量的光子渲染时,光子的收集数目会影响渲染效果。在光子的收集数目的取值较小时,因为光子的随机分布出现噪声,而在光子的收集数目的取值较大时在特征边缘会出现偏差等问题。Existing photon mapping algorithms require large-scale photon emission to ensure rendering accuracy. Both the photon tracking stage and the rendering stage require a large system execution time and storage space overhead, resulting in low computational efficiency. When choosing to emit a certain number of photons for rendering, the number of photons collected will affect the rendering effect. When the number of collected photons is small, noise occurs due to the random distribution of photons, and when the number of collected photons is large, problems such as deviations will occur at the edge of the feature.
发明内容Contents of the invention
本发明针对现有的光子映射算法由于光子的随机发射和反弹而出现的噪声问题,提供一种基于样本消除的渐进式光子映射优化方法。本发明能够加速渐进式光子映射,优化渲染效果。Aiming at the noise problem in the existing photon mapping algorithm due to the random emission and rebound of photons, the invention provides a progressive photon mapping optimization method based on sample elimination. The invention can accelerate the progressive photon mapping and optimize the rendering effect.
为实现上述目的,本发明采用以下技术方案:To achieve the above object, the present invention adopts the following technical solutions:
一种基于样本消除的渐进式光子映射优化方法,包括:A progressive photon mapping optimization method based on sample elimination, comprising:
步骤一、光线跟踪阶段:追踪光线与场景的交点,记录这些交点和对屏幕空间的贡献参数;其中,这些交点为着色点;Step 1, ray tracing stage: trace the intersection points of rays and the scene, record these intersection points and the contribution parameters to the screen space; where these intersection points are coloring points;
步骤二、光子跟踪阶段:从场景中的光源出发,发射光子并进行正向光子跟踪,且将场景中的漫反射物体表面的光子存储到光子图中,由光子图构建一棵KD-树;Step 2, photon tracking stage: start from the light source in the scene, emit photons and perform forward photon tracking, and store the photons on the surface of the diffuse reflection object in the scene in the photon graph, and construct a KD-tree from the photon graph;
步骤三、光子消除阶段:计算KD-树中每一个光子的消除权重,根据消除权重来构建最大堆,筛选出消除权重最大的光子,消除当前消除权重最大的光子并更新其邻居的消除权重,更新最大堆,再次筛选消除权重最大的光子且进行消除和更新,直到达到设定消除光子数目;Step 3, photon elimination stage: Calculate the elimination weight of each photon in the KD-tree, build the maximum heap according to the elimination weight, filter out the photon with the largest elimination weight, eliminate the current photon with the largest elimination weight and update the elimination weight of its neighbors, Update the maximum heap, filter and eliminate the photon with the largest weight again and perform elimination and update until the set number of eliminated photons is reached;
步骤四、渲染成像阶段:遍历着色点,在光子图中查询着色点的光子搜索半径范围内的光子,利用着色点对屏幕空间的贡献参数来计算着色点的贡献颜色,并将贡献颜色返回给屏幕空间以形成渲染图像;Step 4: Rendering and imaging stage: Traversing the coloring point, querying the photon within the photon search radius of the coloring point in the photon graph, using the contribution parameter of the coloring point to the screen space to calculate the contribution color of the coloring point, and returning the contribution color to screen space to form the rendered image;
步骤五、光子渲染迭代:缩小着色点的光子搜索半径范围,重复步骤二至步骤四,直至达到设定的迭代渲染次数,将所有形成的渲染图像累加后求平均,得到最终渲染图像。Step 5. Photon rendering iteration: narrow down the photon search radius of the shading point, repeat steps 2 to 4 until the set number of iterative renderings is reached, accumulate all the formed rendered images and calculate the average to obtain the final rendered image.
所述步骤一光线跟踪阶段过程中,从摄像机出发,通过屏幕空间向场景中发射光线。In the process of step one of the ray tracing stage, starting from the camera, rays are emitted into the scene through the screen space.
所述步骤一光线跟踪阶段过程中,当光线与漫反射表面相交时,保存着色点和对屏幕空间的贡献参数。During the step one ray tracing stage, when the ray intersects the diffuse reflection surface, the shading point and the contribution parameters to the screen space are saved.
所述步骤一光线跟踪阶段过程中,当光线与非漫反射表面相交时,保存着色点和对屏幕空间的贡献参数,并继续追踪光线直至和漫反射表面相交。During the first ray tracing phase, when the ray intersects the non-diffuse reflection surface, save the shading point and the contribution parameters to the screen space, and continue to trace the ray until it intersects the diffuse reflection surface.
所述步骤二中,场景中的各个光源发射一定数量的光子,利用随机算法来确定光子的出射方向,并在场景中追踪光子光线。In the second step, each light source in the scene emits a certain number of photons, uses a random algorithm to determine the outgoing direction of the photons, and traces the light rays of the photons in the scene.
所述步骤二中,当光子在碰撞到非漫反射物体表面时,根据物体的属性被反射、折射、散射或吸收,同时保存光子的能量、方向、位置以及表面法向信息至光子图中。In the second step, when a photon collides with the surface of a non-diffuse reflective object, it is reflected, refracted, scattered or absorbed according to the properties of the object, and at the same time saves the energy, direction, position and surface normal information of the photon to the photon graph.
所述步骤二中,当光子碰撞在漫反射表面时光子发生漫反射或吸收,同时保存光子的能量、方向、位置以及表面法向信息至光子图中。In the second step, when the photon collides with the diffuse reflection surface, the photon undergoes diffuse reflection or absorption, and at the same time saves the energy, direction, position and surface normal information of the photon to the photon graph.
所述步骤三中,KD-树中一个光子的消除权重为当前光子所有邻居的权重之和,其中,当前光子的任一邻居的权重的计算过程为:In said step 3, the elimination weight of a photon in the KD-tree is the sum of the weights of all neighbors of the current photon, wherein the calculation process of the weight of any neighbor of the current photon is:
步骤(3.1):计算当前光子的任一邻居光子之间的距离与2倍的光子密度的影响参数的比值;Step (3.1): Calculate the ratio of the distance between any neighbor photons of the current photon to the influence parameter of 2 times the photon density;
步骤(3.2):利用1减去步骤(3.1)获得的比值,最后计算出当前光子的任一邻居的权重。Step (3.2): Use 1 to subtract the ratio obtained in step (3.1), and finally calculate the weight of any neighbor of the current photon.
当前光子的所有邻居的权重计算公式为:The weight calculation formula of all neighbors of the current photon is:
其中,wij是当前光子i和j个邻居光子之间的权重,j为大于等于1的整数;dij为当前光子i的第j个邻居光子之间的距离;rmax,i是光子密度的影响参数;Ai是最近邻的搜索半径; Ni为最近邻数目,其为大于等于1的整数。Among them, w ij is the weight between the current photon i and j neighbor photons, j is an integer greater than or equal to 1; d ij is the distance between the jth neighbor photon of the current photon i; r max,i is the photon density The influence parameter of ; A i is the search radius of the nearest neighbor; N i is the number of the nearest neighbor, which is an integer greater than or equal to 1.
所述步骤四中,着色点对屏幕空间的贡献参数包括着色点的出射辐照度,着色点的出射辐照度的计算公式为:In the step 4, the contribution parameter of the shading point to the screen space includes the outgoing irradiance of the shading point, and the calculation formula of the outgoing irradiance of the shading point is:
rt=α*rt-1 r t =α*r t-1
其中,表示在着色点位置x处计算的出射辐照度;w为着色点x的入射光线方向;k 为搜索半径内的光子数目,k为大于等于1的整数;wi为k个光子中第i个光子的方向;φi是第i 个光子能量;fr(x,w,wi)是双向反射分布函数,即表示入射辐照度和出射辐照度之间的比重; R为光子消除比例,即光子消除后剩余的数目除以发射的光子数目;rt为搜索着色点附近光子的半径范围;t是当前的迭代渲染次数,t为大于等于1的整数;α为控制参数,为常数。in, Indicates the outgoing irradiance calculated at the position x of the shading point; w is the incident ray direction of the shading point x; k is the number of photons within the search radius, and k is an integer greater than or equal to 1; w i is the i-th photon among the k photons φ i is the energy of the ith photon; f r (x,w,w i ) is the bidirectional reflectance distribution function, that is, the proportion between the incident irradiance and the outgoing irradiance; R is the photon elimination Ratio, that is, the remaining number after photon elimination is divided by the number of emitted photons; r t is the radius range of photons near the search shading point; t is the current iterative rendering times, and t is an integer greater than or equal to 1; α is the control parameter, which is constant.
本发明的有益效果为:The beneficial effects of the present invention are:
(1)本发明提出了基于样本消除的渐进式光子映射优化算法,将样本处理方法应用到光子映射方法中,可以是光子分布在保存随机性的同时具有一定的蓝噪声属性,使渲染所得的图片中的噪声减少;由于光子发射过程的随机性,使光子分布中出现很多不均匀的现象,在光子发射和光子渲染两个步骤之间,本发明增加一步光子消除,通过计算光子之间相对距离的权重,消除与其他光子距离最近的光子,并选择一个最优的消除比例,使渐进式光子映射方法中每一次光子计算使用的光子图都具有蓝噪声特性,使每一步使用的光子的分布都更优化,从而加速了渐进式光子映射,优化渲染效果。(1) The present invention proposes a progressive photon mapping optimization algorithm based on sample elimination, and applies the sample processing method to the photon mapping method, so that the photon distribution can have a certain blue noise attribute while preserving randomness, so that the resulting rendering The noise in the picture is reduced; due to the randomness of the photon emission process, many uneven phenomena appear in the photon distribution. Between the two steps of photon emission and photon rendering, the present invention adds a step of photon elimination, by calculating the relative The weight of distance, eliminate the photon closest to other photons, and choose an optimal elimination ratio, so that the photon map used in each photon calculation in the progressive photon mapping method has blue noise characteristics, so that the photon used in each step The distribution is more optimized, which speeds up the progressive photon mapping and optimizes the rendering effect.
(2)本发明的优化光子样本处理方法,根据光子分布的密度来控制光子的消除权重,保证全局光照亮度,同时全局的光子消除使基于样本方法的光子映射算法可以应用到全局光照的所有渲染效果的计算中;本发明采样的基于消除的样本方法,在流程上可以和渐进式的光子映射紧密结合,使基于样本方法的光子映射优化方法扩展到渐进式光子映射方法中;通过优化每一步迭代的光子分布,加快收敛,可达到减少一半迭代次数的效果。(2) The optimized photon sample processing method of the present invention controls the elimination weight of photons according to the density of photon distribution to ensure the brightness of the global illumination. At the same time, the global photon elimination enables the photon mapping algorithm based on the sample method to be applied to all renderings of the global illumination In the calculation of the effect; the sample method based on elimination of sampling in the present invention can be closely combined with the progressive photon mapping in the process, so that the photon mapping optimization method based on the sample method can be extended to the progressive photon mapping method; by optimizing each step The iterative photon distribution speeds up the convergence and can achieve the effect of reducing the number of iterations by half.
附图说明Description of drawings
图1为本发明的基于样本消除的渐进式光子映射优化方法流程图。FIG. 1 is a flow chart of the progressive photon mapping optimization method based on sample elimination in the present invention.
图2(a)为使用渐进式光子映射算法渲染Cornell Box场景64遍的渲染效果图。Fig. 2(a) is the rendering rendering of the Cornell Box scene rendered 64 times using the progressive photon mapping algorithm.
图2(b)为使用本发明的渲染Cornell Box场景32遍的渲染效果图。Fig. 2(b) is a rendering effect diagram of rendering a Cornell Box scene 32 times using the present invention.
图2(c)为使用本发明的渲染Cornell Box场景64遍的渲染效果图。Fig. 2(c) is a rendering effect diagram of 64 passes of rendering a Cornell Box scene using the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention.
样本消除的方法能够实现生产泊松样本几何,使样本具有更强的蓝噪声属性。样本消除的方法根据样本点之间的距离,为每两个样本点之间计算一个权重,相距越近的样本点之间权重越大,一个样本点的消除权重是他和周围邻居之间的权重的和。方法采用一种贪心策略每次从一些随机生成的样本中消除权重最大的那个样本点。并更新这个样本点周围邻居的消除权重。最后可以得到一个固定数目的有蓝噪声属性的样本点集。样本消除的方法作为一种新的样本处理方法,具有易实施,方法简单,蓝噪声属性好等特点。将光子映射方法中的光子集合看做是样本点集进行样本处理,处理后的光子集合可以一定程度上去除分布中的随机噪声。The method of sample elimination enables the production of Poisson sample geometries with stronger blue noise properties. The method of sample elimination calculates a weight between every two sample points according to the distance between the sample points. The closer the sample points are, the greater the weight is. The elimination weight of a sample point is the distance between him and the surrounding neighbors. sum of weights. The method adopts a greedy strategy to eliminate the sample point with the largest weight from some randomly generated samples each time. And update the elimination weights of the neighbors around this sample point. Finally, a fixed number of sample point sets with blue noise properties can be obtained. As a new sample processing method, the sample elimination method has the characteristics of easy implementation, simple method, and good blue noise properties. The photon set in the photon mapping method is regarded as a sample point set for sample processing, and the processed photon set can remove the random noise in the distribution to a certain extent.
对于一个渲染实例流程,即是将一个已经建模好的三维场景计算成图片的过程。在渲染任务开始前,将三维场景数据转化为渲染引擎可以识别的表达方式。一个包含完整信息的场景数据文件包中包含了渲染引擎可以识别的摄像机,几何体,光源,材质,贴图等信息。场景准备完毕后开始渲染。For a rendering instance process, it is the process of calculating a modeled 3D scene into a picture. Before the rendering task starts, the 3D scene data is converted into an expression that the rendering engine can recognize. A scene data file package containing complete information contains information such as cameras, geometry, light sources, materials, textures, etc. that can be recognized by the rendering engine. Rendering starts after the scene is ready.
Cornell Box场景(简称Box场景)是一个简单的渲染全局光照效果的实例。在这一场景中,这个盒子中放置了一个点光源在盒子的顶部位置,盒子的中间放置了两个小盒子。设置渲染变数为64遍,设置消除比例为30%,像素采样率为4。The Cornell Box scene (referred to as the Box scene) is a simple example of rendering global illumination effects. In this scene, a point light source is placed on the top of the box, and two small boxes are placed in the middle of the box. Set the rendering variable to 64 passes, set the elimination ratio to 30%, and the pixel sampling rate to 4.
图1为本发明的基于样本消除的渐进式光子映射优化方法流程图,如图所示,基于样本消除的渐进式光子映射优化方法,开始渲染后,具体步骤如下:Fig. 1 is a flowchart of the progressive photon mapping optimization method based on sample elimination of the present invention. As shown in the figure, after the rendering is started, the specific steps are as follows:
步骤1.光线跟踪阶段;从摄像机出发,通过屏幕空间向场景中发射光线,追踪光线和场景的交点,记录这些交点和对屏幕空间的贡献参数。Step 1. The ray tracing stage; start from the camera, emit light rays into the scene through the screen space, trace the intersection points of the light rays and the scene, and record these intersection points and the contribution parameters to the screen space.
步骤1具体如下:Step 1 is as follows:
从盒子正前方的摄像机,向场景内发射光线,通过摄像机和屏幕空间的联系确定光线方向,由于一个像素采样4个采样点,通过一个像素发射4条光线,追踪这些光线,场景中的物体都是漫反射表面,在光线和场景的第一个交点保存这个交点,并保存表面的对屏幕空间的贡献参数,这些交点也被称为着色点。From the camera directly in front of the box, emit light into the scene, and determine the direction of the light through the connection between the camera and the screen space. Since one pixel samples 4 sampling points, 4 light rays are emitted through one pixel, and these rays are traced. Objects in the scene are all It is a diffuse reflection surface, which saves this intersection point at the first intersection point of the light and the scene, and saves the contribution parameters of the surface to the screen space. These intersection points are also called shading points.
步骤2.光子跟踪阶段;通过从光源发出一定数量的光子并进行正向的光子跟踪来追踪光子,并且在漫反射物体表面存储光子到光子图中,构建一棵光子的KD-树。Step 2. Photon tracking stage: track photons by emitting a certain number of photons from the light source and performing forward photon tracking, and store photons in the photon graph on the surface of the diffuse reflection object to construct a KD-tree of photons.
具体如下:details as follows:
从盒子上方的光源处向场景中发射2万个光子,然后为每个光子产生一个随机的方向,在场景中追踪光子的运动轨迹。将与平面发生碰撞的光子的能量、位置、方向、平面发现信息保存到光子图中,光子在与物体表面发射碰撞时被吸收或者发生漫反射,漫反射后的光子在场景中继续被追踪。最大反弹次数用来结束光子追踪过程,完成光子图的生成。Send 20,000 photons into the scene from the light source above the box, then generate a random direction for each photon, and track the photon's trajectory in the scene. Save the energy, position, direction, and plane discovery information of the photons that collided with the plane into the photon graph. The photons are absorbed or diffusely reflected when they collide with the surface of the object. The diffusely reflected photons continue to be tracked in the scene. The maximum number of bounces is used to end the photon tracing process and complete the generation of the photon map.
步骤3.光子消除阶段;计算每一个光子的消除权重,根据消除权重构建最大堆选择消除权重最大的光子,消除这个光子并更新这个光子的邻居的消除权重,更新最大堆,再次选择消除权重最大的光子消除和更新,重复这个过程直到达到设定的光子消除数目。Step 3. Photon elimination stage; calculate the elimination weight of each photon, construct the maximum heap according to the elimination weight, select the photon with the largest elimination weight, eliminate this photon and update the elimination weight of the photon’s neighbors, update the maximum heap, and select the largest elimination weight again The photons are eliminated and updated, and this process is repeated until the set photon elimination number is reached.
具体如下:details as follows:
步骤(3.1):遍历每一个光子,搜素光子周围的最近10个邻居光子,按照公式(1)所示计算每个邻居光子和当前光子的权重,当前光子的消除权重为这些邻居权重的和;Step (3.1): Traverse each photon, search for the nearest 10 neighbor photons around the photon, and calculate the weight of each neighbor photon and the current photon according to the formula (1), and the elimination weight of the current photon is the sum of these neighbor weights ;
当前光子的所有邻居的权重计算公式为:The weight calculation formula of all neighbors of the current photon is:
其中,wij是当前光子i和j个邻居光子之间的权重,j为大于等于1的整数;dij为当前光子i的第j个邻居光子之间的距离;rmax,i是光子密度的影响参数;Ai是最近邻的搜索半径; Ni为最近邻数目,其为大于等于1的整数。Among them, w ij is the weight between the current photon i and j neighbor photons, j is an integer greater than or equal to 1; d ij is the distance between the jth neighbor photon of the current photon i; r max,i is the photon density The influence parameter of ; A i is the search radius of the nearest neighbor; N i is the number of the nearest neighbor, which is an integer greater than or equal to 1.
在本发明中,采用一种低采样树来保存rmax,i,每次根据当前光子的位置选择离他最近的rmax,i;rmax,i的初始值可以根据公式(1)的第二个公式算出,Ai是最近邻的搜索半径,Ni为最近邻数目,第一次迭代中直接使用计算出的r′max,i为rmax,i;在剩余的迭代次数中,根据查询的低采样树中的rmax,i值和当前计算出的r′max,i的值的平均数作为rmax,i,并在计算后更新低采样树中的数据值;In the present invention, a low-sampling tree is used to save r max,i , and the r max,i closest to him is selected according to the position of the current photon each time; the initial value of r max,i can be according to the first formula (1) Calculated by the two formulas, A i is the search radius of the nearest neighbor, N i is the number of the nearest neighbor, the calculated r′ max is directly used in the first iteration, and i is r max, i ; in the remaining iterations, according to The r max, i value in the queried low-sampling tree and the currently calculated r′ max, the average of the value of i are used as r max, i , and the data value in the low-sampling tree is updated after calculation;
步骤(3.2):根据所有光子的消除权重,建立一个最大堆;Step (3.2): According to the elimination weights of all photons, a maximum heap is established;
步骤(3.3):选择出消除权重最大的光子;Step (3.3): Select the photon with the largest elimination weight;
步骤(3.4):更新步骤(3.4)中选出的消除光子的邻居光子的消除权重,做法是从消除权重中,减去消除光子的这个邻居光子的权重:Step (3.4): Updating the elimination weight of the neighbor photon of the elimination photon selected in step (3.4), the method is to subtract the weight of the neighbor photon of the elimination photon from the elimination weight:
步骤(3.5):更新最大堆,重复步骤(3.3),步骤(3.4)和步骤(3.5)直到达到设定的消除比例30%,即消除了6000个光子。Step (3.5): update the maximum heap, repeat step (3.3), step (3.4) and step (3.5) until the set elimination ratio of 30% is reached, that is, 6000 photons are eliminated.
步骤4.渲染成像阶段;遍历步骤1记录的所有着色点,对每一个着色点查找光子图并找到这个着色点附近的半径为rt范围内的光子来估计光源的照射效果,其中包括了直接光照和间接光照的所有光子,t是当前迭代次数,并且通过控制参数,每次迭代缩小搜索半径来消除偏差。最后根据记录的着色点的贡献参数计算出颜色返回屏幕空间做累加。Step 4. Rendering imaging stage; traverse all the shading points recorded in step 1, search the photon graph for each shading point and find the photons near the shading point with a radius of r t to estimate the illumination effect of the light source, including the direct All photons of illumination and indirect illumination, t is the current iteration number, and by controlling the parameters, each iteration reduces the search radius to eliminate the deviation. Finally, the color is calculated according to the contribution parameters of the recorded shading points and returned to the screen space for accumulation.
具体如下:details as follows:
步骤(4.1):遍历每一个着色点,在一个着色点处,搜索这个着色点附近的半径为rt范围内的光子;t是当前的迭代渲染次数,t为大于等于1的整数;α为控制参数,为常数,实例运行中取值0.9;Step (4.1): traverse each shading point, and at a shading point, search for photons within the radius r t near the shading point; t is the current iterative rendering times, and t is an integer greater than or equal to 1; α is The control parameter is a constant, and the value is 0.9 during the running of the example;
rt=α*rt-1 公式(2)r t =α*r t-1 formula (2)
步骤(4.2):根据射辐射度的公式(3)计算出当前着色点的出射辐照度;Step (4.2): Calculate the outgoing irradiance of the current coloring point according to the formula (3) of the outgoing radiance;
其中,表示在着色点位置x处计算的出射辐照度;w为着色点x的入射光线方向;k 为搜索半径内的光子数目,k为大于等于1的整数;wi为k个光子中第i个光子的方向;φi是第i 个光子能量;fr(x,w,wi)是双向反射分布函数,即表示入射辐照度和出射辐照度之间的比重; R为光子消除比例,即光子消除后剩余的数目除以发射的光子数目。in, Indicates the outgoing irradiance calculated at the position x of the shading point; w is the incident ray direction of the shading point x; k is the number of photons within the search radius, and k is an integer greater than or equal to 1; w i is the i-th photon among the k photons φ i is the energy of the ith photon; f r (x,w,w i ) is the bidirectional reflectance distribution function, that is, the proportion between the incident irradiance and the outgoing irradiance; R is the photon elimination Ratio, which is the number remaining after photon elimination divided by the number of photons emitted.
步骤(4.3):利用着色点对屏幕空间的贡献信息计算出着色点的贡献颜色,将颜色返回给屏幕空间,和前次迭代的图像累加平均,形成图像,显示在渲染结果窗口中。Step (4.3): Use the contribution information of the shading point to the screen space to calculate the contribution color of the shading point, return the color to the screen space, and accumulate and average the image of the previous iteration to form an image, which is displayed in the rendering result window.
步骤5.光子渲染迭代,重复步骤2至步骤5,直至达到设定的迭代渲染次数64次,终止渲染。其中图2(c)是使用本方法渲染64遍得到的结果。Step 5. Photon rendering iterations, repeat steps 2 to 5 until the set number of iterative renderings reaches 64 times, and the rendering is terminated. Figure 2(c) is the result obtained by using this method to render 64 times.
图2(a)为使用渐进式光子映射算法渲染Cornell Box场景64遍的渲染效果图;图2(b) 为使用本专利的方法渲染Cornell Box场景32遍的渲染效果图。通过比较图2(a)~图2(c) 可知:本发明得到的图像更清晰且渲染效果更好。Fig. 2(a) is a rendering rendering of the Cornell Box scene rendered 64 times using the progressive photon mapping algorithm; Fig. 2(b) is a rendering rendering rendering of the Cornell Box scene 32 times using the method of this patent. By comparing Fig. 2(a) to Fig. 2(c), it can be known that the image obtained by the present invention is clearer and the rendering effect is better.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(RandomAccessMemory, RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the programs can be stored in a computer-readable storage medium. During execution, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM).
上述虽然结合附图对本发明的具体实施方式进行了描述,但并非对本发明保护范围的限制,所属领域技术人员应该明白,在本发明的技术方案的基础上,本领域技术人员不需要付出创造性劳动即可做出的各种修改或变形仍在本发明的保护范围以内。Although the specific implementation of the present invention has been described above in conjunction with the accompanying drawings, it does not limit the protection scope of the present invention. Those skilled in the art should understand that on the basis of the technical solution of the present invention, those skilled in the art do not need to pay creative work Various modifications or variations that can be made are still within the protection scope of the present invention.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610555035.0A CN106251393B (en) | 2016-07-14 | 2016-07-14 | A kind of gradual Photon Mapping optimization method eliminated based on sample |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610555035.0A CN106251393B (en) | 2016-07-14 | 2016-07-14 | A kind of gradual Photon Mapping optimization method eliminated based on sample |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106251393A CN106251393A (en) | 2016-12-21 |
CN106251393B true CN106251393B (en) | 2018-11-09 |
Family
ID=57613777
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610555035.0A Active CN106251393B (en) | 2016-07-14 | 2016-07-14 | A kind of gradual Photon Mapping optimization method eliminated based on sample |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106251393B (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107909647B (en) * | 2017-11-22 | 2020-09-15 | 长春理工大学 | Light field projection image rendering method for realistic virtual 3D scene based on spatial multiplexing |
CN109509246B (en) * | 2018-03-25 | 2022-08-02 | 哈尔滨工程大学 | Photon map clustering method based on self-adaptive sight division |
CN108961372B (en) * | 2018-03-27 | 2022-10-14 | 北京大学 | A Progressive Photon Mapping Method Based on Statistical Model Checking |
US10748248B2 (en) * | 2018-05-15 | 2020-08-18 | Adobe Inc. | Image down-scaling with pixel sets selected via blue noise sampling |
CN109509248B (en) * | 2018-09-28 | 2023-07-18 | 北京大学 | A Neural Network-Based Photon Mapping Rendering Method and System |
CN110211197B (en) * | 2019-05-29 | 2020-10-02 | 山东大学 | A photon mapping optimization method, device and system based on polygon space division |
CN110599579B (en) * | 2019-09-20 | 2023-02-24 | 山东师范大学 | Photon resampling-based random asymptotic photon mapping image rendering method and system |
CN111445422B (en) * | 2020-04-17 | 2022-06-07 | 山东大学 | Random asymptotic photon mapping image noise reduction method and system based on neural network |
CN114549730A (en) * | 2020-11-27 | 2022-05-27 | 华为技术有限公司 | Light source sampling weight determination method for multi-light source scene rendering and related equipment |
CN114066721B (en) * | 2021-11-03 | 2024-02-02 | 抖音视界有限公司 | Display method and device and electronic equipment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101080508B1 (en) * | 2011-09-14 | 2011-11-04 | 인하대학교 산학협력단 | Multilevel progressive photon mapping method |
CN104200509A (en) * | 2014-08-19 | 2014-12-10 | 山东大学 | Photon mapping accelerating method based on point cache |
CN104700448A (en) * | 2015-03-23 | 2015-06-10 | 山东大学 | Self adaption photon mapping optimization algorithm based on gradient |
-
2016
- 2016-07-14 CN CN201610555035.0A patent/CN106251393B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101080508B1 (en) * | 2011-09-14 | 2011-11-04 | 인하대학교 산학협력단 | Multilevel progressive photon mapping method |
CN104200509A (en) * | 2014-08-19 | 2014-12-10 | 山东大学 | Photon mapping accelerating method based on point cache |
CN104700448A (en) * | 2015-03-23 | 2015-06-10 | 山东大学 | Self adaption photon mapping optimization algorithm based on gradient |
Non-Patent Citations (1)
Title |
---|
Progressive Photon Mapping with Sample Elimination;Chunmeng Kang,et al;《ACM SIGGRAPH Symposium on Interactive 3d Graphics and Games》;20160227;正文201页第1节第2-3段,公式1 * |
Also Published As
Publication number | Publication date |
---|---|
CN106251393A (en) | 2016-12-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106251393B (en) | A kind of gradual Photon Mapping optimization method eliminated based on sample | |
CN104700448B (en) | A kind of self adaptation Photon Mapping optimized algorithm based on gradient | |
KR102164541B1 (en) | Apparatus and method for generating acceleration structure in a ray tracing system | |
CN108090947B (en) | Ray tracing optimization method for 3D scene | |
US9355491B2 (en) | Ray tracing apparatus and method | |
US8797322B2 (en) | Systems and methods of defining rays for ray tracing rendering | |
US8717358B2 (en) | Image processing apparatus and method | |
US20110032256A1 (en) | Image processing apparatus and method | |
US9123162B2 (en) | Integration cone tracing | |
JP5695746B2 (en) | Mipmap level selection method and texture mapping system using the same | |
US20140292757A1 (en) | Prediction method, generation method and storage medium | |
CN106469463A (en) | A kind of rendering intent being mixed with GPU based on CPU | |
CN106776028A (en) | A kind of ray tracing method based on GPU | |
US20240412447A1 (en) | Using directional radiance for interactions in path tracing | |
KR20110032366A (en) | Image processing apparatus and method | |
CN113298925B (en) | A Dynamic Scene Rendering Acceleration Method Based on Ray Path Multiplexing | |
Rasmuson et al. | A low-cost, practical acquisition and rendering pipeline for real-time free-viewpoint video communication | |
KR102193683B1 (en) | Apparatus and method for traversing acceleration structure in a ray tracing system | |
CN116596985B (en) | Self-adaptive illumination model modeling method and system | |
CN109509246B (en) | Photon map clustering method based on self-adaptive sight division | |
CN104463943B (en) | A kind of multiple light courcess accelerated method towards programmable shader | |
CN108182685B (en) | Image segmentation method and device combining belief propagation idea and PCNN | |
WO2023165175A1 (en) | Rendering processing method and apparatus, device and storage medium | |
CN116805348A (en) | Resampling global illumination method based on sample space filtering | |
CN114529660B (en) | Drawing method and system based on photon storage structure |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |