CN101763649B - Method for drawing enhanced model contour surface point - Google Patents
Method for drawing enhanced model contour surface point Download PDFInfo
- Publication number
- CN101763649B CN101763649B CN200910243262XA CN200910243262A CN101763649B CN 101763649 B CN101763649 B CN 101763649B CN 200910243262X A CN200910243262X A CN 200910243262XA CN 200910243262 A CN200910243262 A CN 200910243262A CN 101763649 B CN101763649 B CN 101763649B
- Authority
- CN
- China
- Prior art keywords
- point
- splat
- coordinate
- screen
- sampled point
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 50
- 238000005070 sampling Methods 0.000 claims abstract description 60
- 239000013598 vector Substances 0.000 claims abstract description 42
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 16
- 239000011159 matrix material Substances 0.000 claims abstract description 10
- 230000004927 fusion Effects 0.000 claims abstract description 6
- 238000011426 transformation method Methods 0.000 claims abstract description 5
- 238000013507 mapping Methods 0.000 claims abstract description 4
- 230000008569 process Effects 0.000 claims description 15
- 238000004364 calculation method Methods 0.000 claims description 11
- 238000005286 illumination Methods 0.000 claims description 11
- 238000010606 normalization Methods 0.000 claims description 4
- 238000001914 filtration Methods 0.000 claims description 2
- 239000000463 material Substances 0.000 claims description 2
- 239000000203 mixture Substances 0.000 claims 2
- 241000197727 Euscorpius alpha Species 0.000 claims 1
- 238000004040 coloring Methods 0.000 claims 1
- 230000007613 environmental effect Effects 0.000 claims 1
- 230000000007 visual effect Effects 0.000 claims 1
- 238000009877 rendering Methods 0.000 abstract description 20
- 238000007781 pre-processing Methods 0.000 abstract description 11
- 238000012545 processing Methods 0.000 abstract description 8
- 230000001133 acceleration Effects 0.000 abstract description 3
- 230000000694 effects Effects 0.000 description 10
- 238000012952 Resampling Methods 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 3
- 230000003111 delayed effect Effects 0.000 description 2
- 239000012634 fragment Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000000052 comparative effect Effects 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
Images
Landscapes
- Image Generation (AREA)
Abstract
一种增强模型轮廓的表面点绘制方法,在预处理阶段,读取并存储采样点的空间坐标、法向量、半径、颜色信息,根据给定的层次数生成splat模板,再按照用户指定的阈值对采样点进行空间划分,求解出每个采样点的k个近邻,最后利用k近邻,由坐标转换法求解出各点的曲率。在运行阶段,首先根据采样点法向量与视线夹角判断其是否为轮廓点,若是,则计算出一系列组成以采样点为中心的曲面splat的顶点坐标。若不是轮廓采样点,则利用Surface Splatting算法进行绘制:求解采样点处的2D空间映射的雅可比矩阵;再对投影到屏幕的各个splat进行可见性判定及融合;利用光照模型和明暗处理计算出屏幕某像素点的空间光强;最后进行归一化。本绘制速度快,不需要硬件加速即可较好的满足实时需要,且绘制质量高。
A surface point drawing method that enhances the outline of the model. In the preprocessing stage, the space coordinates, normal vectors, radius, and color information of the sampling points are read and stored, and the splat template is generated according to the given number of layers, and then the threshold value specified by the user is used. Divide the sampling points into space, and obtain the k nearest neighbors of each sampling point, and finally use the k nearest neighbors to obtain the curvature of each point by the coordinate transformation method. In the running stage, first judge whether it is a contour point according to the angle between the normal vector of the sampling point and the line of sight, and if so, calculate a series of vertex coordinates that form a surface splat centered on the sampling point. If it is not a contour sampling point, use the Surface Splatting algorithm to draw: solve the Jacobian matrix of the 2D space mapping at the sampling point; then perform visibility judgment and fusion on each splat projected to the screen; use the lighting model and shade processing to calculate Spatial light intensity of a certain pixel on the screen; finally normalized. The rendering speed is fast, it can better meet real-time needs without hardware acceleration, and the rendering quality is high.
Description
技术领域 technical field
本发明属于计算机虚拟现实和计算机图形学技术领域,特别是涉及计算机图形学真实感绘制中的点绘制方法。The invention belongs to the technical field of computer virtual reality and computer graphics, in particular to a point drawing method in realistic drawing of computer graphics.
背景技术 Background technique
计算机图形学是把计算机应用于图形的显示及绘制方面而逐渐形成的一门学科。它从诞生发展到现在,已经在许多领域扮演着越来越重要的角色,发挥着越来越重要的作用。真实感图形绘制是计算机图形学的一个重要组成部分(参见王健,真实感图形的离散点绘制方法,吉林大学,硕士学位论文,2006)。它综合利用数学、物理学、计算机科学和其它科学知识在计算机图形设备上生成像照片那样的真实感图形。Computer graphics is a subject gradually formed by applying computers to the display and rendering of graphics. From its birth to the present, it has played an increasingly important role in many fields and is playing an increasingly important role. Realistic graphics rendering is an important part of computer graphics (see Wang Jian, Discrete Point Rendering Method for Realistic Graphics, Jilin University, Master Thesis, 2006). It combines mathematics, physics, computer science and other scientific knowledge to generate photo-realistic graphics on computer graphics devices.
根据绘制图元的不同,真实感图形绘制分为基于几何图元的绘制技术(GBR)、基于图像的绘制技术(IBR)和基于点的绘制技术(PBR)(参见张武,基于点的绘制技术的研究与应用,浙江大学,硕士学位论文,2006)。GBR是传统的图形绘制技术,通常将场景模型分解成三角面片,虽然可生成高度逼真的真实感图形,但是随着物体模型复杂度的不断提高,表征模型的三角片数量也急剧增加,对其处理造成了带宽瓶颈和过度的浮点计算。IBR通过预先生成的图像,对接近于视点或视线方向的画面进行变换、插值与变形,从而快速得到当前视点处的场景画面。与场景复杂度无关,但是缺点在于预处理时间长,需要大量的存储空间,且视点移动时会产生明显的人工痕迹。PBR在点的基础上进行造型、绘制以及其他图形学上的处理。它抛弃了传统的三角面片表示方法,只记录点的信息,由这些点直接重构出最终的图像。随着研究与应用的不断深入,模型及几何场景变得越来越复杂,以点元作为最基本和最简单的图元,不需要存储和维护拓扑结构,便于重取样,具有冗余少,存储空间小,绘制速度快的优点。According to the different drawing primitives, realistic graphics drawing is divided into geometric primitive-based rendering (GBR), image-based rendering (IBR) and point-based rendering (PBR) (see Zhang Wu, point-based rendering Research and Application of Technology, Zhejiang University, Master Thesis, 2006). GBR is a traditional graphics rendering technology. It usually decomposes the scene model into triangular patches. Although it can generate highly realistic and realistic graphics, as the complexity of the object model continues to increase, the number of triangular patches representing the model also increases sharply. Its processing creates bandwidth bottlenecks and excessive floating-point calculations. IBR transforms, interpolates, and deforms images close to the viewpoint or line of sight through pre-generated images, so as to quickly obtain the scene image at the current viewpoint. It has nothing to do with the complexity of the scene, but the disadvantage is that the preprocessing time is long, a large amount of storage space is required, and obvious artifacts will be produced when the viewpoint moves. PBR performs modeling, drawing, and other graphics processing on a point-by-point basis. It abandons the traditional triangular patch representation method, only records the point information, and directly reconstructs the final image from these points. With the deepening of research and application, models and geometric scenes become more and more complex. Point elements are used as the most basic and simplest primitives. There is no need to store and maintain topology structures, which is convenient for resampling and has less redundancy. The advantages of small storage space and fast drawing speed.
基于点的绘制技术使用离散的三维密集点云来表征模型表面,目标是采用点元作为图元在三维密集点云中重构出连续、视觉等价的模型表面。适合绘制表面几何高度复杂或具有复杂表面光照细节的模型。目前成熟的点绘制技术有基于绘制速度的方法:QSplat(Szymon Rusinkiewicz,Marc Levoy,QSplat:A Multiresolution PointRendering System for Large Meshes,Siggraph 2000,New Orleans,LA USA),它利用层次包围球数据结构,用于快速的视域裁剪和背面剔除及细节层次绘制。Point-based rendering techniques use discrete 3D dense point clouds to represent model surfaces, and the goal is to use point elements as primitives to reconstruct a continuous, visually equivalent model surface in 3D dense point clouds. Suitable for drawing models with highly complex surface geometry or complex surface lighting details. The current mature point drawing technology has a method based on drawing speed: QSplat (Szymon Rusinkiewicz, Marc Levoy, QSplat: A Multiresolution PointRendering System for Large Meshes, Siggraph 2000, New Orleans, LA USA), which uses a hierarchical enclosing ball data structure, using Draw on fast viewshed clipping and backface culling and level of detail.
Dachsbacher等提出了一种将层次结构序列化为一个线性数组的方法(参见C.Dachsbacher,C.Vogelgsang,and M.Stamminger.Sequential point trees.Siggraph2003 Conference Proceedings),在此基础上将绘制算法由层次树的遍历转化为线性数组的遍历,从而实现了QSplat的GPU硬件加速。基于绘制效果的方法:Pfister等率先提出用点面元(surfel)(参见C.Dachsbacher,C.Vogelgsang,and M.Stamminger.Sequential point trees.Siggraph 2003 Conference Proceedings)来表示采样点。每个点被表示为位于点切向上的一个圆盘,各圆盘相互重叠形成紧密的物体表面。zwicker等将信号处理的思想应用到点的绘制中,提出了椭圆加权(EWA)算法,获得了高质量的绘制结果(参见Matthias Zwicker,Pfister.Surface Splatting.ACM Siggraph2001,Los Angeles,CA,USA)。Dachsbacher et al. proposed a method to serialize the hierarchical structure into a linear array (see C.Dachsbacher, C.Vogelgsang, and M.Stamminger.Sequential point trees.Siggraph2003 Conference Proceedings), on this basis, the drawing algorithm is divided into hierarchical The traversal of the tree is converted into the traversal of the linear array, thus realizing the GPU hardware acceleration of QSplat. Method based on rendering effect: Pfister et al. first proposed to use surfel (see C.Dachsbacher, C.Vogelgsang, and M.Stamminger.Sequential point trees. Siggraph 2003 Conference Proceedings) to represent sampling points. Each point is represented as a disk tangential to the point, and the disks overlap each other to form a compact object surface. zwicker et al. applied the idea of signal processing to the drawing of points, and proposed the ellipse weighted (EWA) algorithm, which obtained high-quality drawing results (see Matthias Zwicker, Pfister.Surface Splatting.ACM Siggraph2001, Los Angeles, CA, USA) .
综上,基于速度的方法没有考虑透明度以及反走样问题,绘制质量一般,而具有高质量绘制效果的EWA算法是基于软件实现,因而不具备实时性。In summary, the speed-based method does not consider transparency and anti-aliasing issues, and the rendering quality is average, while the EWA algorithm with high-quality rendering effects is based on software implementation, so it does not have real-time performance.
发明内容 Contents of the invention
本发明的技术解决问题:针对传统点绘制中的走样以及绘制效率的问题,提供一种增强模型轮廓的表面点绘制方法,该方法即可重构出保留模型边缘高频信号的连续表面,同时能较好地满足实时绘制的要求。The technology of the present invention solves the problem: Aiming at the problems of aliasing and drawing efficiency in traditional point drawing, a surface point drawing method for enhancing the model outline is provided, which can reconstruct a continuous surface that retains high-frequency signals at the edge of the model, and at the same time It can better meet the requirements of real-time rendering.
为完成发明目的,本发明采用的技术方案是:在预处理阶段,首先读取并存储采样点的空间坐标、法向量、半径、颜色等信息,根据给定的层次数生成面元在屏幕空间的投影,即splat模板,再按照用户指定的阈值对采样点空间坐标形成的长方体包围盒进行空间划分,根据上一步中空间划分得到的小立方体栅格求解出每个采样点的k个邻居,最后利用k近邻,由坐标转换法求解出各采样点的曲率,包括轮廓采样点和非轮廓采样点的曲率。In order to accomplish the purpose of the invention, the technical solution adopted by the present invention is: in the preprocessing stage, at first read and store information such as the spatial coordinates, normal vectors, radius, and color of the sampling point, and generate surface elements in the screen space according to the given number of layers. projection, that is, the splat template, and then space-divides the cuboid bounding box formed by the spatial coordinates of the sampling points according to the threshold specified by the user, and calculates the k neighbors of each sampling point according to the small cube grid obtained by the space division in the previous step. Finally, using k-nearest neighbors, the curvature of each sampling point, including the curvature of contour sampling points and non-contour sampling points, is solved by the coordinate transformation method.
在运行阶段,当视点改变时,首先根据采样点法向量与视线夹角判断该采样点是否为轮廓点,若是,则结合预处理阶段得到的某轮廓采样点的曲率,计算出一系列组成以此采样点为中心的曲面splat(面元在屏幕空间的投影)的顶点坐标。若不是轮廓采样点,则利用Surface Splatting算法进行绘制:求解采样点处的2D空间映射的雅可比矩阵;对投影到屏幕的各个splat进行可见性判定,再对于预处理时第一步获取的颜色、法向量、空间坐标进行融合;利用光照模型和明暗处理计算出屏幕某像素点的空间光强;最后进行归一化,消除高斯函数截取及采样点分布不均匀对图像的影响。In the running phase, when the viewpoint changes, first judge whether the sampling point is a contour point according to the angle between the normal vector of the sampling point and the line of sight. If so, combine the curvature of a contour sampling point obtained in the preprocessing stage to calculate a series of components. The vertex coordinates of the surface splat (the projection of the surface element in the screen space) centered on this sampling point. If it is not a contour sampling point, use the Surface Splatting algorithm to draw: solve the Jacobian matrix of the 2D space mapping at the sampling point; determine the visibility of each splat projected to the screen, and then for the color obtained in the first step of preprocessing , normal vector, and spatial coordinates are fused; the spatial light intensity of a certain pixel on the screen is calculated by using the illumination model and shading processing; finally, normalization is performed to eliminate the influence of Gaussian function interception and uneven distribution of sampling points on the image.
本发明的点绘制方法与现有方法相比的优点在于:绘制速度快,不需要硬件加速即可较好的满足实时需要;绘制质量高,在反走样的同时可保留模型轮廓边缘的高频信号。首先,Surface Splatting算法主要时间消耗在实时计算投影到屏幕上splat的形状和大小,通过预处理时生成splat模板以及运行时选取模板可极大提高绘制速度,其次,Surface Splatting算法利用椭圆加权平均的思想,能够得到高质量的splat融合效果,最后,利用曲面splat绘制边缘,曲率能够较好保存模型边缘的细节特征,较使用切平面近似的平面splat改善了锯齿现象。Compared with the existing method, the point drawing method of the present invention has the advantages of fast drawing speed, which can better meet real-time needs without hardware acceleration; high drawing quality, and can retain the high frequency of the edge of the model outline while anti-aliasing Signal. First of all, the Surface Splatting algorithm mainly consumes time in calculating the shape and size of the splat projected on the screen in real time. The drawing speed can be greatly improved by generating the splat template during preprocessing and selecting the template at runtime. Secondly, the Surface Splatting algorithm uses ellipse weighted average The idea is to get a high-quality splat fusion effect. Finally, the surface splat is used to draw the edge. The curvature can better preserve the details of the model edge, and the aliasing phenomenon is improved compared with the plane splat approximated by the tangent plane.
附图说明 Description of drawings
图1为本发明整体流程图;Fig. 1 is the overall flowchart of the present invention;
图2为本发明的空间splat与屏幕的参数关系;Fig. 2 is the parameter relation of space splat and screen of the present invention;
图3为本发明的曲面splat的形状;Fig. 3 is the shape of the curved surface splat of the present invention;
图4a和图4b为本发明的添加光照计算的模型;Fig. 4a and Fig. 4b are the model of adding illumination calculation of the present invention;
图5为本发明中与传统算法绘制效果的比较图;a为绘制出的模型,圈出的区域为传统算法与本发明方法的对比部分,b为传统算法;Fig. 5 is the comparative figure of drawing effect with traditional algorithm among the present invention; A is the model drawn, and the area circled is the comparison part of traditional algorithm and the method of the present invention, and b is traditional algorithm;
图6为本发明中采样点为中心的面元的空间坐标、法向量、半径和颜色信息;Fig. 6 is the spatial coordinates, normal vector, radius and color information of the surfel centered on the sampling point in the present invention;
图7为本发明中的立方体为包括采样点所在小立方体的(3*3*3)栅格示意图;Fig. 7 is that the cube among the present invention is the (3*3*3) grid schematic diagram that comprises the small cube where the sampling point is located;
图8为本发明的片元深度值计算示意图;Fig. 8 is a schematic diagram of the calculation of the depth value of the fragment in the present invention;
图9为本发明的可见性判断计算示意图。FIG. 9 is a schematic diagram of visibility judgment calculation in the present invention.
具体实施方式 Detailed ways
如图1所示,本发明实施过程包括预处理阶段和运行时阶段两个部分。As shown in FIG. 1 , the implementation process of the present invention includes two parts: a preprocessing stage and a runtime stage.
第一阶段:预处理部分。包括读取采样点、模板生成、空间划分、求解k近邻、计算曲率五个步骤。The first stage: the preprocessing part. It includes five steps of reading sampling points, template generation, space division, solving k-nearest neighbors, and calculating curvature.
第一步:读取采样点。Step 1: Read the sampling point.
读取并存储采样点的空间坐标、法向量、半径、颜色等信息。通过物体坐标系中采样点的空间坐标和法向量可以知道模型表面此点的位置和朝向,采样点半径可以保证splat(面元在二维屏幕上的投影)相互覆盖无空洞,颜色信息可更好表现模型的细节。Read and store the space coordinates, normal vector, radius, color and other information of the sampling point. The position and orientation of this point on the model surface can be known through the space coordinates and normal vectors of the sampling point in the object coordinate system. The radius of the sampling point can ensure that the splat (the projection of the surface element on the two-dimensional screen) covers each other without holes, and the color information can be changed. Well presented model details.
图6给出以采样点为中心的面元(Surfel,即Surface elements,曲面元素)的空间坐标、法向量、半径和颜色信息,并且足够大的半径可以保证投影到屏幕的splat相互覆盖无空洞。Figure 6 shows the space coordinates, normal vector, radius and color information of the surface element (Surfel, Surface elements, surface elements) centered on the sampling point, and the radius is large enough to ensure that the splats projected to the screen cover each other without holes .
第二步:模板生成。The second step: template generation.
为了消除采样点间的空洞,在物体空间将采样点表示为面元(重构核),此步骤用于计算空间splat投影到屏幕的形状。图2给出了切平面投影到屏幕的splat形状。根据用户指定的层次数,将第一步中读取及存储的采样点的半径分为n1,n1越大,splat模板越多,绘制效果越好;第i层的半径ri=(rmax-rmin)/n1·i,rmax,rmin分别代表所读取采样点的最大半径和最小半径,采样点切平面与屏幕夹角为θ,0≤θ<90,将θ分为n2个区间,椭圆与屏幕空间x轴的夹角为ω,0≤ω<180,将ω分为n3个区间,则可生成n1·n2·n3个splat模板,模板生成的过程如下:In order to eliminate the holes between the sampling points, the sampling points are represented as surfels (reconstruction kernels) in the object space, and this step is used to calculate the shape of the space splat projected to the screen. Figure 2 shows the splat shape of the tangent plane projected onto the screen. According to the number of layers specified by the user, the radius of the sampling points read and stored in the first step is divided into n 1 , the larger n 1 is, the more splat templates are, and the better the drawing effect is; the radius r i of the i-th layer =( r max -r min )/n 1 i, r max , r min respectively represent the maximum radius and minimum radius of the sample point read, the angle between the tangent plane of the sample point and the screen is θ, 0≤θ<90, and θ Divide it into n2 intervals, the angle between the ellipse and the x-axis of the screen space is ω, 0≤ω<180, divide ω into n3 intervals, then n1 n2 n3 splat templates can be generated, the process of template generation is as follows:
(1)遍历半径生成的n1个区间,对于半径的第i个区间,执行第二步的操作;(1) Traversing the n1 intervals generated by the radius, for the i-th interval of the radius, perform the operation of the second step;
(2)对于n2和n3个区间,以deltang的步长进行遍历,对于n2中的第j个区间,n3中的第k个区间,执行第三步的操作生成模板;(2) For n2 and n3 intervals, traverse with the step size of deltang, and for the jth interval in n2 and the kth interval in n3, execute the operation of the third step to generate a template;
(3)对于左下角坐标及右上角坐标分别为(-ri,-ri)、(ri,ri)的矩阵中某一像素点(x,y),若其满足(x·cosωk-y·sinωk)2/(ri·cosθj)2+(y·cosωk+x·sinωk)2/ri 2≤1则此像素点被splat覆盖,遍历矩阵中所有像素点,即计算出此椭圆的形状;椭圆与屏幕空间x轴的夹角
(4)循环执行(1)、(2)、(3)步操作,直到所有区间都遍历过一次,就可生成所有splat模板(4) Perform steps (1), (2), and (3) in a loop until all intervals have been traversed once, and all splat templates can be generated
第三步:空间划分。The third step: space division.
由第一步读取的空间坐标得到采样点的长方体包围盒,根据用户指定的边长a,将此包围盒分为m·n·l个小立方体,m、n、l分别为x、y、z轴上小立方体的个数;以采用链地址法处理冲突的哈希表HashList[m·n·l]存储每个立方体中的点;求解各个采样点在x、y、z方向的索引i为nx、ny、nz,其中nx代表某采样点在x方向所处的小立方体的索引,ny代表某采样点在y方向所处的小立方体的索引,nz代表某采样点在z方向所处的小立方体的索引,其中0≤nx<m、0≤ny<n、0≤nz<l,存储到 The cuboid bounding box of the sampling point is obtained from the spatial coordinates read in the first step. According to the side length a specified by the user, this bounding box is divided into m·n·l small cubes, m, n, and l are x, y respectively , the number of small cubes on the z-axis; the hash table HashList[m n l] that uses the chain address method to deal with conflicts stores the points in each cube; solves the index of each sampling point in the x, y, and z directions i is n x , n y , n z , where n x represents the index of a small cube where a sampling point is located in the x direction, n y represents the index of a small cube where a sampling point is located in the y direction, and n z represents a certain The index of the small cube where the sampling point is located in the z direction, where 0≤n x <m, 0≤n y <n, 0≤n z <l, stored in
第四步:求解k近邻Step 4: Solve k-Nearest Neighbors
在某采样点所在小立方体的相关栅格(3*3*3)中寻找所有邻近点,根据采样点与邻近点的距离由小到大的顺序进行插入排序,选取前k个点存储在邻接表中,此处的k是用户设定的,用于后面步骤中求局部区域的曲率,一般设为20--30。Find all adjacent points in the relevant grid (3*3*3) of the small cube where a sampling point is located, perform insertion sorting according to the order of the distance between the sampling point and the adjacent points from small to large, and select the first k points to store in the adjacency In the table, k here is set by the user, and is used to calculate the curvature of the local area in the following steps, and is generally set to 20--30.
如7图所示,此立方体为包括采样点所在小立方体的(3*3*3)栅格,中心小立方体为采样点所在立方体,已知此小立方体的索引号,便可知道(3*3*3)栅格中所有小立体的索引,即可在哈希表中查找出这些小立体中的所有邻近点的空间坐标,因而可计算出采样点与邻近点的距离。As shown in Figure 7, this cube is a (3*3*3) grid including the small cube where the sampling point is located, and the central small cube is the cube where the sampling point is located. Knowing the index number of this small cube, you can know (3* 3*3) Indexes of all small solids in the grid, the spatial coordinates of all adjacent points in these small solids can be found in the hash table, so the distance between the sampling point and the neighboring points can be calculated.
第五步:计算曲率。Step 5: Calculate the curvature.
根据坐标转换法计算曲率的过程如下:The process of calculating the curvature according to the coordinate transformation method is as follows:
(1)将k个邻近点投影到采样点切平面上,选取采样点到最远投影点方向的单位向量作为u轴,通过u与法向量叉乘计算向量v,从而计算出邻近点的u、v值以及在法向量方向的坐标值h;(1) Project k neighboring points onto the tangent plane of the sampling point, select the unit vector from the sampling point to the farthest projection point as the u axis, and calculate the vector v by cross multiplying u and the normal vector, so as to calculate the u of the neighboring point , v value and the coordinate value h in the direction of the normal vector;
(2)根据u、v及h坐标值,在采样点的局部邻近区域,利用最小二乘法进行抛物面拟合。拟合的抛物面为s(u,v)=au^2+bu*v+cv^2,利用最小二乘法即可求解出系数a、b、c;(2) According to the u, v and h coordinate values, in the local adjacent area of the sampling point, use the least square method to carry out paraboloid fitting. The fitted paraboloid is s(u, v)=au^2+bu*v+cv^2, and the coefficients a, b, and c can be obtained by using the least square method;
(3)拟合出的抛物面在原点的平均曲率即为采样点曲率,平均曲率=a+c;(3) The average curvature of the fitted paraboloid at the origin is the sampling point curvature, and the average curvature=a+c;
第二阶段:运行时部分。首先判断是否为轮廓采样点,若此点法向量与视线夹角在[ε,90]范围内则是轮廓点,否则不是轮廓点,需要分别处理。因而分为曲面splat绘制与Surface Splatting绘制两个子阶段。The second stage: the runtime part. First judge whether it is a contour sampling point. If the angle between the normal vector and the line of sight is within the range of [ε, 90], it is a contour point. Otherwise, it is not a contour point and needs to be processed separately. Therefore, it is divided into two sub-stages: surface splat drawing and Surface Splatting drawing.
第一子阶段:曲面splat绘制。图3给出了曲面splat的形状。The first sub-stage: surface splat drawing. Figure 3 shows the shape of the surface splat.
第一步:计算曲面splat的顶点。Step 1: Calculate the vertices of the surface splat.
对于曲面splat的某个顶点,此顶点表示它是第is层,第ks条边上的顶点,此处的is、ks是用户所设,一般is、ks越大,表示曲面splat的复杂度越高,绘制效果越好。根据预处理时计算出的曲率c,局部坐标为,其中For a vertex of the surface splat , this vertex indicates that it is the vertex on the i s layer and the k s edge, where i s and k s are set by the user, generally the larger the i s and k s , the higher the complexity of the surface splat , the better the drawing effect. According to the curvature c calculated during preprocessing, the local coordinates are ,in
ns代表曲面splat的总边数,表示第is层的半径,
第二步:纹理映射。Step two: texture mapping.
顶点的纹理坐标为其中ns代表曲面splat的总边数。vertex The texture coordinates of where n s represents the total number of sides of the surface splat.
第二子阶段:Surface Splatting(此方法是Zwicker提出的,为本领域通用术语,无中文解释)绘制。包括确定重采样核、Splatting、光照计算和归一化四个步骤。The second sub-stage: Surface Splatting (this method was proposed by Zwicker, which is a general term in this field and has no Chinese explanation) drawing. It includes four steps of determining the resampling kernel, Splatting, lighting calculation and normalization.
第一步:确定重采样核。Step 1: Determine the resampling kernel.
重采样核即为投影到屏幕上的重构核与低通滤波的卷积。因为椭圆高斯函数在仿射变换以及卷积下的闭合性,二者都采用其表示,因而重采样核也可以表示成椭圆高斯函数的形式,通过选取合适的方差矩阵就可达到较好的反走样效果。The resampling kernel is the convolution of the reconstruction kernel projected onto the screen and the low-pass filter. Because the closure of the elliptic Gaussian function under affine transformation and convolution are both expressed, the resampling kernel can also be expressed in the form of an elliptic Gaussian function, and a better inversion can be achieved by selecting an appropriate variance matrix. Aliasing effect.
椭圆高斯函数的表达式为:
由椭圆高斯函数的性质,重采样核的表达式为:According to the properties of the elliptic Gaussian function, the expression of the resampling kernel is:
上式中,J为物体空间到屏幕空间映射的雅可比矩阵,V为采样点处的协方差矩阵,一般表示为
第二步:Splatting(将空间面元投影到屏幕上形成splat的过程)The second step: Splatting (the process of projecting spatial elements onto the screen to form a splat)
此步骤确定投影到屏幕像素的各个splat的可见性判定及融合。处理过程如下:This step determines the visibility determination and fusion of each splat projected onto the screen pixels. The process is as follows:
(1)模板的选取。不需要实时计算投影到屏幕上splat的形状和大小,而是对预处理生成的模板进行选取:根据物体空间重构核的半径、法向量与视线夹角θ、法向量投影在x、y轴分量的反正切值
(2)利用z-threshold方法进行可见性判定:计算splat投影到屏幕,所覆盖像素点沿视线方向的z深度值,根据透视投影变换模型,可以将屏幕片元反投影到采样点Pk所表示的空间Surfel上得到点Qp。Qp和视点C之间的距离即为所求深度值如图8所示,若z与此像素存储的深度值在某阈值范围内则融合,若小于像素深度则可看作遮挡,即用其颜色和权重代替像素当前的颜色及不透明度alpha值;否则不处理,可见性判定的处理过程如图9所示。(2) Use the z-threshold method to determine visibility: Calculate the z-depth value of the covered pixel point along the line of sight when the splat is projected onto the screen. According to the perspective projection transformation model, the screen fragment can be back-projected to the sampling point Pk The point Qp is obtained on the space Surfel. The distance between Qp and viewpoint C is the desired depth value, as shown in Figure 8. If z and the depth value stored in this pixel are within a certain threshold range, then fusion will be performed. If it is less than the pixel depth, it can be regarded as occlusion, that is, use other The color and weight replace the current color and alpha value of the opacity of the pixel; otherwise, it is not processed, and the processing process of the visibility judgment is shown in Figure 9.
(3)融合。像素点的纹理、法向量、空间坐标均为投影到某像素点各splat相应信息的加权平均。(3) Fusion. The texture, normal vector, and space coordinates of a pixel are all weighted averages of the corresponding information of each splat projected to a certain pixel.
ρk(x)为重采样核,代表权重,ωk可用像素点x处的纹理颜色、法向量、空间坐标代替。ρ k (x) is the resampling kernel, which represents the weight, and ω k can be replaced by the texture color, normal vector, and space coordinates at the pixel point x.
第三步:光照计算。The third step: lighting calculation.
根据Phong光照模型,利用Splatting中得到像素点的法向量及空间坐标,即可计算出此像素点上的光强。通过per-pixel的光照计算代替传统per-splat的光照计算,不仅可以使模型表面光照更加平滑,得到更好的绘制效果,而且推迟着色技术还可避免处理不可见splat上的点,提高绘制效率。According to the Phong lighting model, the light intensity on the pixel can be calculated by using the normal vector and space coordinates of the pixel obtained in Splatting. Replacing traditional per-splat lighting calculations with per-pixel lighting calculations can not only make the surface lighting of the model smoother and get better rendering effects, but also the delayed shading technology can avoid processing points on invisible splats and improve rendering efficiency .
根据Phong光照模型I=IaKa+IpKd(L·N)+IpKs(R·V)n,其中IaKa是环境光,IpKd(L·N)是散射光,IpKs(R·V)n是镜面反射光,n为反射指数(取值一般为50-100),此数越大表示物体表面越光滑,可用来定义物体的材质。利用Splatting过程中滤波后得到的像素点法向量表示N,利用滤波后的空间坐标计算V(将公式(1)ωk分别用各个相互覆盖splat的法向量、空间坐标代替就可计算出滤波后的法向量和空间坐标),再根据Phong光照模型即可计算出此像素点上的光强I。其中,光照模型中的参数Ia、Ip分别为环境光强与入射光强,Ka、Kd、Ks分别为环境光反射系数、散射光反射系数、镜面反射系数,可根据需要的仿真环境进行设置(在本发明的此次实验中,Ka取值0.2、Kd和Ks取值为0.5)According to the Phong lighting model I=I a K a +I p K d (L·N)+I p K s (R·V) n , where I a K a is ambient light, I p K d (L·N) is the scattered light, I p K s (R·V) n is the specular reflection light, and n is the reflection index (the value is generally 50-100). The larger the number, the smoother the surface of the object, which can be used to define the material of the object. Use the pixel normal vector obtained after filtering in the Splatting process to represent N, and use the filtered space coordinates to calculate V (respectively replace the formula (1) ω k with the normal vectors and space coordinates of each overlapping splat to calculate the filtered normal vector and space coordinates), and then calculate the light intensity I on this pixel according to the Phong illumination model. Among them, the parameters I a and I p in the illumination model are ambient light intensity and incident light intensity respectively, and K a , K d , and K s are ambient light reflection coefficient, scattered light reflection coefficient and specular reflection coefficient respectively. Simulation environment is set up (in this experiment of the present invention, K a value 0.2, K d and K s value 0.5)
通过per-pixel的光照计算代替传统per-splat的光照计算,不仅可以使模型表面光照更加平滑,得到更好的绘制效果,而且推迟着色技术还可避免处理不可见splat上的点,提高绘制效率。Replacing traditional per-splat lighting calculations with per-pixel lighting calculations can not only make the surface lighting of the model smoother and get better rendering effects, but also the delayed shading technology can avoid processing points on invisible splats and improve rendering efficiency .
第四步:归一化Step 4: Normalize
为了消除高斯函数截取及采样点分布不均匀对图像的影响,需要在算法最后进行归一化处理。屏幕像素点x的最终纹理值
本发明针对传统点绘制中的走样以及绘制效率的问题,基于模板的思想,结合高质量绘制效果的Surface Splatting和较surfel更逼近局部区域的曲面splat,提供一种实时的、增强模型轮廓的表面点绘制方法。通过在预处理生成模板,在运行时Surface Splatting绘制表面采样点,曲面splat绘制轮廓采样点,即可重构出保留模型边缘高频信号的连续表面,同时能较好地满足实时绘制的要求。Aiming at the problem of aliasing and drawing efficiency in traditional point drawing, the present invention provides a real-time surface that enhances the model outline by combining Surface Splatting with high-quality drawing effect and surface splat that is closer to the local area than surfel Point drawing method. By generating templates in preprocessing, drawing surface sampling points at runtime by Surface Splatting, and drawing contour sampling points by surface splatting, a continuous surface that retains high-frequency signals at the edge of the model can be reconstructed, and at the same time, it can better meet the requirements of real-time rendering.
图4中a为不计算光照的传统算法,b图为本发明的方法。由上图的对比可以看出,对于无颜色的模型,不计算光照的传统算法绘制得到的只是单一颜色的区域,而本发明的方法可以很好的表现模型表面的光照和明暗变化,增加了表面的真实感和细节特征。In Fig. 4, a is the traditional algorithm without calculating illumination, and Fig. b is the method of the present invention. From the comparison of the above figure, it can be seen that for a colorless model, the traditional algorithm that does not calculate the illumination only draws a single-color area, while the method of the present invention can well represent the illumination and light and shade changes on the surface of the model, increasing the Realistic and detailed features of surfaces.
图5中,a为绘制出的模型,圈出的区域为传统算法与本发明方法的对比部分,b为传统算法。由对比可以看出,本发明利用曲面splat的优点,较好的消除了锯齿现象,增强了模型轮廓特征。In Fig. 5, a is the drawn model, the circled area is the comparison part between the traditional algorithm and the method of the present invention, and b is the traditional algorithm. It can be seen from the comparison that the present invention utilizes the advantages of the curved surface splat to better eliminate the jagged phenomenon and enhance the profile features of the model.
本发明未详细阐述的内、容为本领域技术人员的公知常识。The contents and contents not elaborated in the present invention are common knowledge of those skilled in the art.
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above is only a preferred embodiment of the present invention, it should be pointed out that, for those of ordinary skill in the art, without departing from the principle of the present invention, some improvements and modifications can also be made, and these improvements and modifications can also be made. It should be regarded as the protection scope of the present invention.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200910243262XA CN101763649B (en) | 2009-12-30 | 2009-12-30 | Method for drawing enhanced model contour surface point |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200910243262XA CN101763649B (en) | 2009-12-30 | 2009-12-30 | Method for drawing enhanced model contour surface point |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101763649A CN101763649A (en) | 2010-06-30 |
CN101763649B true CN101763649B (en) | 2012-07-25 |
Family
ID=42494802
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN200910243262XA Expired - Fee Related CN101763649B (en) | 2009-12-30 | 2009-12-30 | Method for drawing enhanced model contour surface point |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101763649B (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102096943B (en) * | 2011-01-14 | 2012-07-18 | 天津大学 | Method for extracting and rendering characteristic lines in three-dimensional (3D) real-time landscape painting |
CN102214366B (en) * | 2011-07-20 | 2013-01-16 | 浙江万里学院 | High-performance rendering method of three dimensional (3D) point sampling data |
CN103065362B (en) * | 2012-12-25 | 2015-07-08 | 上海交通大学 | Grid-free surface drawing method with sharp feature |
CN105247574B (en) * | 2013-05-29 | 2018-09-21 | 五大洋有限公司 | Electronic device, the control method of electronic device and computer-readable recording medium |
CN107038741B (en) * | 2016-11-21 | 2020-08-11 | 上海咔咖文化传播有限公司 | Method for three-dimensionally rendering two-dimensional shadow |
CN106780530B (en) * | 2016-12-15 | 2019-06-14 | 广州视源电子科技股份有限公司 | Body type prediction method and device |
CN107169933B (en) * | 2017-04-14 | 2020-08-18 | 浙江光珀智能科技有限公司 | Edge reflection pixel correction method based on TOF depth camera |
CN107918948B (en) * | 2017-11-02 | 2021-04-16 | 深圳市自由视像科技有限公司 | 4D video rendering method |
CN113129402B (en) * | 2021-04-19 | 2024-01-30 | 中国航发沈阳发动机研究所 | Cross section data cloud picture drawing method |
CN114299240A (en) * | 2021-12-20 | 2022-04-08 | 重庆市勘测院 | Parallel point cloud rarefying method based on distance threshold |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1395221A (en) * | 2001-06-29 | 2003-02-05 | 三星电子株式会社 | Layer representation of three-D body and method and device for drawing said body by utilizing it |
-
2009
- 2009-12-30 CN CN200910243262XA patent/CN101763649B/en not_active Expired - Fee Related
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1395221A (en) * | 2001-06-29 | 2003-02-05 | 三星电子株式会社 | Layer representation of three-D body and method and device for drawing said body by utilizing it |
Non-Patent Citations (4)
Title |
---|
Hanspeter Pfister et al..Surfels: Surface Elements as Rendering Primitives.《SIGGRAPH "00 Proceedings of the 27th annual conference on Computer graphics and interactive techniques》.2000,全文. * |
Matthias Zwicker et al..Surface Splatting.《SIGGTAPH "01 Proceedings of the 28th annual conference on computere graphics and Interactive techniques》.2001,全文. * |
张武 等.点绘制技术的研究.《计算机工程》.2007,第33卷(第5期),全文. * |
王晓云.点模型及其绘制技术研究.《计算机应用研究》.2005,(第7期),全文. * |
Also Published As
Publication number | Publication date |
---|---|
CN101763649A (en) | 2010-06-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101763649B (en) | Method for drawing enhanced model contour surface point | |
Woo et al. | A survey of shadow algorithms | |
Jones | The production of volume data from triangular meshes using voxelisation | |
Wang et al. | Generalized displacement maps | |
CN106485776A (en) | A kind of method and system of 3D game real-time rendering large scale scene | |
Sun et al. | Interactive relighting of dynamic refractive objects | |
US9508191B2 (en) | Optimal point density using camera proximity for point-based global illumination | |
Linsen et al. | Splat-based ray tracing of point clouds | |
Poulin et al. | Shading and shadowing with linear light sources | |
Wand et al. | Multi-Resolution Point-Sample Raytracing. | |
Boudon et al. | Survey on computer representations of trees for realistic and efficient rendering | |
CN107689076A (en) | A kind of efficient rendering intent during the cutting for system of virtual operation | |
Liang et al. | Exact visual hull from marching cubes | |
Guennebaud et al. | Real-Time Point Cloud Refinement. | |
CN103440684A (en) | Method for applying spherical harmonic lighting technology to surface rendering | |
CN107578821A (en) | A real-time efficient GPU rendering method for virtual surgery system | |
Wang et al. | Silhouette smoothing for real-time rendering of mesh surfaces | |
Ni et al. | Detection of real-time augmented reality scene light sources and construction of photorealis tic rendering framework | |
Haneche et al. | A GPU enhanced LIDAR Perception System for Autonomous Vehicles | |
Mavridis et al. | Global Illumination using Imperfect Volumes. | |
Liu et al. | Shape from silhouettes based on a centripetal pentahedron model | |
Runions et al. | Ribbons: A representation for point clouds | |
Bordignon et al. | Point-based rendering of implicit surfaces in R4 | |
Bourque et al. | Simulating Caustics due to Liquid-Solid Interface Menisci. | |
Mukti | A Development Perspective of Point-Based Computer Graphics |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20120725 Termination date: 20141230 |
|
EXPY | Termination of patent right or utility model |