CN104143209B - Method for engraving three-dimensional model based on line pattern - Google Patents
Method for engraving three-dimensional model based on line pattern Download PDFInfo
- Publication number
- CN104143209B CN104143209B CN201410281067.7A CN201410281067A CN104143209B CN 104143209 B CN104143209 B CN 104143209B CN 201410281067 A CN201410281067 A CN 201410281067A CN 104143209 B CN104143209 B CN 104143209B
- Authority
- CN
- China
- Prior art keywords
- engraving
- model
- engraved
- line
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000013507 mapping Methods 0.000 claims abstract description 21
- 230000000694 effects Effects 0.000 claims abstract description 17
- 230000008602 contraction Effects 0.000 claims abstract description 6
- 239000000284 extract Substances 0.000 claims abstract description 5
- 238000004364 calculation method Methods 0.000 claims description 3
- 238000012952 Resampling Methods 0.000 description 2
- 230000015572 biosynthetic process Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000003786 synthesis reaction Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
Landscapes
- Manufacture Or Reproduction Of Printing Formes (AREA)
- Numerical Control (AREA)
Abstract
基于线画图案的三维模型雕刻方法,包括:用户输入需要雕刻的二维线画图案,方法对输入图案进行预处理,通过边缘收缩操作提取输入线画图中的线条中心线作为雕刻轮廓线;针对不同类型的三维模型,对模型表面待雕刻区域分别进行参数化;将得到的二维雕刻轮廓线离散化,并利用参数化映射将其映射为三维模型表面的离散雕刻线条;计算三维模型上的待雕刻顶点到三维雕刻线条的距离,利用雕刻函数确定待雕刻区域顶点的平移距离和方向,对待雕刻顶点进行平移得到模型的三维雕刻效果。
A method for engraving a three-dimensional model based on a line drawing pattern, comprising: the user inputs a two-dimensional line drawing pattern to be engraved, the method preprocesses the input pattern, and extracts the line centerline in the input line drawing image as an engraving contour line through an edge contraction operation; For different types of 3D models, parameterize the area to be engraved on the surface of the model; discretize the obtained 2D engraved contour lines, and use parametric mapping to map them to discrete engraved lines on the surface of the 3D model; calculate the The distance from the vertices to be carved to the 3D engraved lines, using the engraving function to determine the translation distance and direction of the vertices in the area to be engraved, and then translate the vertices to be engraved to obtain the 3D engraving effect of the model.
Description
技术领域technical field
本发明专利设计针对用户输入的二维线画图案,提供了一种能够方便快捷地在三维模型生成该图案雕刻效果的方法。The patented design of the present invention aims at the two-dimensional line drawing pattern input by the user, and provides a method that can conveniently and quickly generate the engraving effect of the pattern on the three-dimensional model.
背景技术Background technique
作为三维物体外形的一种主流表示方式,三维模型在数字娱乐产业、工业设计领域、虚拟现实等领域得到了广泛使用。三维模型的表征属性包含两方面:三维模型的几何属性(如顶点位置信息和顶点之间的拓扑连接信息)和三维模型的外观属性(如表面材质属性、几何纹理和颜色纹理信息等)。为了使生成的三维模型更具有真实感,同时增加三维模型的美观性和艺术性,通常会对三维模型添加三维特征纹理,在现有的技术中,可以分为凹凸映射技术,凹凸映射技术和浮雕纹理映射技术。近年来,不少基于特征的纹理合成的算法被提出,其中包括三维雕刻技术,三维雕刻是指沿着模型表面特定线条对其顶点进行移动以生成表面复杂几何纹理的过程,它是复杂模型表面纹理生成的一种重要方法。三维模型的数字雕刻作为生成复杂模型的一种造型手段,可以在原有模型基础上通过特定的雕刻方法方便高效地生成具有丰富表面浮雕纹理的复杂模型,从而极大地丰富了三维复杂模型的建模内容,这种方法将具有广泛的应用前景。已有的三维雕刻技术主要通过在三维模型上手绘线条,利用雕刻函数计算在纹理宽度内的顶点的平移方向和距离,得到具有真实感的三维雕刻效果,该技术主要通过用户交互实现,然而,设计复杂的三维雕刻效果要求的用户交互工作量较大,同时由于轮廓线的生成是通过用户指定关键点拟合出的曲线,故具体走势不受用户直接控制,用户很难在模型上设计需要的复杂雕刻效果。我们的方法直接以待雕刻的二维线画图案作为输入,可以方便实现三维模型表面的雕刻效果。由于该方法中的雕刻轮廓线是从输入图像中自动获取,因此使得用户的操作相当简便,同时也实现了比较复杂的三维雕刻效果。As a mainstream representation of the shape of 3D objects, 3D models have been widely used in digital entertainment industry, industrial design field, virtual reality and other fields. The representation properties of the 3D model include two aspects: the geometric properties of the 3D model (such as vertex position information and topological connection information between vertices) and the appearance properties of the 3D model (such as surface material properties, geometric texture and color texture information, etc.). In order to make the generated 3D model more realistic and increase the aesthetics and artistry of the 3D model, 3D feature textures are usually added to the 3D model. In the existing technology, it can be divided into bump mapping technology, bump mapping technology and relief Texture mapping techniques. In recent years, many feature-based texture synthesis algorithms have been proposed, including 3D sculpting technology. 3D sculpting refers to the process of moving its vertices along specific lines on the model surface to generate complex geometric textures on the surface. It is a complex model surface An important method of texture generation. Digital sculpting of 3D models, as a means of generating complex models, can conveniently and efficiently generate complex models with rich surface relief textures on the basis of the original model through specific sculpting methods, thus greatly enriching the modeling of 3D complex models content, this method will have broad application prospects. The existing 3D engraving technology mainly draws lines on the 3D model, and uses the engraving function to calculate the translation direction and distance of the vertices within the texture width, so as to obtain a realistic 3D engraving effect. This technology is mainly realized through user interaction. However, Designing complex 3D engraving effects requires a large amount of user interaction. At the same time, since the contour line is generated by fitting the key points specified by the user, the specific trend is not directly controlled by the user, and it is difficult for the user to design the desired shape on the model. complex engraving effects. Our method directly takes the 2D line drawing pattern to be engraved as input, which can conveniently realize the engraving effect on the surface of the 3D model. Since the engraving outline in this method is automatically obtained from the input image, the user's operation is quite simple, and at the same time, a relatively complex three-dimensional engraving effect is realized.
发明内容Contents of the invention
为了克服已有三维网格模型表面纹理合成中的交互工作量大、比较费时以及雕刻效果简单的不足,本发明提供了一种操作简单、雕刻方便、雕刻效果可控性强的基于二维线画图案的三维雕刻方法。In order to overcome the disadvantages of large interactive workload, time-consuming and simple engraving effect in the surface texture synthesis of the existing 3D mesh model, the present invention provides a two-dimensional line-based A three-dimensional sculpting method for drawing patterns.
本发明解决其技术问题所采用的技术方案是:The technical solution adopted by the present invention to solve its technical problems is:
基于线画图案的三维模型雕刻方法,所述的方法包括以下四个步骤:Based on the three-dimensional model engraving method of line drawing pattern, described method comprises following four steps:
1)用户输入需要雕刻的二维线画图案,方法对输入图案进行预处理,通过边缘收缩操作提取输入线画图中的线条中心线作为雕刻轮廓线;1) The user inputs the two-dimensional line drawing pattern that needs to be engraved, and the method preprocesses the input pattern, and extracts the center line of the line in the input line drawing image as the engraving contour line through the edge contraction operation;
将输入的二维线画图案转为灰度图,并计算每个像素点的梯度值,将梯度值大于梯度最大值10%的像素点作为待移动像素点,记录待移动像素点总数nmove;对于待移动的像素点,沿着其单位化梯度方向向中心移动,每个待移动像素点移动到中心附近时停止移动;判断像素点停止移动的方法如下:首先收集像素点pi的邻域Ni={pj|||pj-pi||≤1},判断该邻域内像素点pj的梯度方向与像素点pi的梯度方向是否一致,当时,说明此时邻域范围内已经有与移动方向相反的像素点pj,即pj是由与pi相对轮廓中心线相反的边界移动得到的点,此时pi已经靠近轮廓中心线;再判断pi是否移动越过pj,当满足时,pi越过pj,说明pi已经到达轮廓中心线处,故停止移动。随着停止移动的像素点数的增多,待移动像素点越来越少,当待移动像素点数目不超过λ·nmove时,整个收缩过程结束(其中参数λ可取0.01)。收缩结束后,为了处理可能出现少量孤立点情形,将其中邻域Ni中包含的像素点数少于2个的像素点pi作为孤立点去除,从而得到二维雕刻轮廓线。Convert the input two-dimensional line drawing pattern into a grayscale image, and calculate the gradient value of each pixel, and use the pixel whose gradient value is greater than 10% of the maximum gradient value as the pixel to be moved, and record the total number of pixels to be moved n move ; For the pixel to be moved, it moves toward the center along its unitized gradient direction, and each pixel to be moved stops when it moves near the center; the method for judging that the pixel stops moving is as follows: first, collect the neighbors of the pixel p i Field N i ={p j |||p j -p i ||≤1}, judge the gradient direction of pixel point p j in the neighborhood Gradient direction with pixel point p i Is it consistent when , it means that there is already a pixel point p j opposite to the moving direction in the neighborhood at this time, that is, p j is a point obtained by moving on the boundary opposite to p i relative to the contour center line, and at this time p i is already close to the contour center line ; Then judge whether p i moves beyond p j , when satisfying When pi crosses p j , it means that pi has reached the center line of the contour, so it stops moving. As the number of pixels that stop moving increases, the number of pixels to be moved becomes less and less. When the number of pixels to be moved does not exceed λ·n move , the entire shrinking process ends (the parameter λ can be 0.01). After the shrinkage is finished, in order to deal with the situation that a small number of isolated points may appear, the pixel points pi in which the number of pixels contained in the neighborhood N i is less than 2 are removed as isolated points, so as to obtain a two-dimensional engraved contour line.
2)针对不同类型的三维模型,对模型表面待雕刻区域分别进行参数化;2) For different types of 3D models, parameterize the area to be carved on the surface of the model;
对于圆柱面、球面等三维模型,可以将整个模型作为雕刻区域,用简单的参数化方法将整个模型参数化。对于半圆柱面模型,设其高与Z轴平行,在XOY平面任取一点作为基准点O,圆柱面上任意点M在XOY平面上的投影点与基准点所张成的角度为θ,圆柱体高为h,则点M参数坐标为(s,t)=(θ/π,||zM-zO||/h),其中zM和zO分别是点Μ和点O的z坐标。对于半球面模型,任意点P(x,y,z)的参数坐标为(s,t)=(arccos(z/r),arctan(y/x)),其中r为球面半径。For three-dimensional models such as cylindrical surfaces and spherical surfaces, the entire model can be used as a carving area, and the entire model can be parameterized with a simple parameterization method. For the semi-cylindrical model, let its height be parallel to the Z axis, take any point on the XOY plane as the reference point O, and the angle formed by the projection point of any point M on the XOY plane on the cylindrical surface and the reference point is θ, the cylinder If the body height is h, the parameter coordinates of point M are (s,t)=(θ/π,||z M -z O ||/h), where z M and z O are the z coordinates of point M and point O respectively . For the hemispherical model, the parameter coordinates of any point P(x, y, z) are (s, t) = (arccos(z/r), arctan(y/x)), where r is the radius of the sphere.
对于一般的三维模型,首先需要选取模型表面局部区域作为待雕刻区域,然后采用局部参数化方法进行参数化。其中待雕刻区域可以通过用户在需要雕刻的区域中心手绘一条线,系统根据该手绘线自动生成雕刻区域,具体过程如下:a)先对手绘线条进行细化操作;细化过程中,可以依次得到该手绘线条与模型表面的交点,记录每个交点所在的平面,确定手绘线条经过的面片集Fline;细化结束后,对得到的交点集v1,v2,…,vl沿着经过的三角面片进行均匀重采样,将均匀重采样后的点集作为雕刻区域的基准线点集;b)由用户选择距离其手绘线条的多大范围内区域作为需要雕刻的区域;将三维网格模型的平均边长与用户给定的距离阈值的乘积作为距离基准线点集的最大测地线距离dmax;利用图论思想,将三维网格模型上手绘线条经过的面片集Fline的k-邻域Fk区域作为候选区域并建立带权图,分别取网格模型的顶点和边作为图的顶点和边,权值取为相应边长;再将基准线点集加入到带权图中,将每个点与它所在三角面片的三个顶点分别相连形成边,并以连接得到的边的长度作为权值;同时对基准线点集中的点依次相连形成边,取权值为0;这样,k-邻域Fk区域的带权图建立完成后,采用最短路径快速计算SPFA算法计算出每个顶点vi到基准线的最短路径di;若Fk区域中的某个面片Fi满足其三个顶点到基准线的最短路径均小于dmax,那么Fi即为待雕刻的面片,Fk区域中所有满足条件的面片集合FS就是最终得到的雕刻区域,此时待雕刻区域生成后,再对局部区域进行参数化,雕刻区域内的任意网格顶点v的参数坐标可以由该顶点相对于基准线的位置计算得到,故顶点v的参数坐标为其中d为点v到基准线的测地线距离,为在手绘线上的参数值,为到的长度,Ll为手绘线总长度;但是此时雕刻区域中基准线两侧的参数坐标相同,故需要进一步判断顶点v相对于基准线的方向: 为的法向,是在基准线上的切线,是v到的向量,顶点v的参数坐标修正为此时顶点v在s方向的值域范围为[-1,1],为了将其转化为[0,1],需要将雕刻区域内的所有顶点相对基准线向右平移dmax个单位,从而一般三维模型表面局部雕刻区域内任意顶点v的最终参数坐标可以取为 For a general 3D model, it is first necessary to select a local area on the surface of the model as the area to be sculpted, and then use the local parameterization method for parameterization. The area to be engraved can be drawn by the user in the center of the area to be engraved, and the system will automatically generate the engraved area according to the hand-drawn line. The specific process is as follows: a) first refine the hand-painted line; The intersection point between the hand-drawn line and the model surface, record the plane where each intersection point is located, and determine the patch set F line that the hand - drawn line passes through ; Uniform resampling is performed on the passing triangles, and the uniformly resampled point set As the baseline point set of the engraving area; b) The user selects the area within the distance from the hand-drawn line as the area to be engraved; the product of the average side length of the 3D mesh model and the distance threshold given by the user is used as the distance reference The maximum geodesic distance d max of the line point set; using the idea of graph theory, the k-neighborhood F k area of the patch set F line that the hand-drawn line passes through on the 3D mesh model is used as the candidate area and the weighted graph is established, respectively Take the vertices and edges of the grid model as the vertices and edges of the graph, and take the weight as the corresponding edge length; then set the baseline point set Add it to the weighted graph, connect each point with the three vertices of the triangular surface where it is located to form an edge, and use the length of the connected edge as the weight; at the same time, connect the points in the baseline point set to form an edge , and the weight value is 0; thus, after the weighted graph of the k-neighborhood F k area is established, the shortest path d i from each vertex v i to the baseline is calculated by using the shortest path fast calculation SPFA algorithm; if F k A facet F i in the region satisfies that the shortest path from its three vertices to the baseline is less than d max , then F i is the facet to be carved, and all facet sets F S that meet the conditions in the F k region are The final engraved area, at this time After the engraving area is generated, the local area is parameterized. The parameter coordinates of any grid vertex v in the engraving area can be calculated from the position of the vertex relative to the baseline, so the parameter coordinates of the vertex v are where d is the geodesic distance from point v to the datum line, for parameter values on the freehand line, for arrive , L l is the total length of the hand-drawn line; but at this time, the parameter coordinates on both sides of the reference line in the engraving area are the same, so it is necessary to further determine the direction of the vertex v relative to the reference line: for normal direction, yes Tangents on the base line, is v to The vector, the parameter coordinates of the vertex v are corrected as At this time, the value range of the vertex v in the s direction is [-1, 1], in order to convert it to [0, 1], it is necessary to translate all vertices in the engraved area to the right by d max units relative to the reference line, so that In general, the final parameter coordinates of any vertex v in the local engraving area on the surface of a 3D model can be taken as
3)将得到的二维雕刻轮廓线离散化,并利用参数化映射将其映射为三维模型表面的离散雕刻线条;3) discretizing the obtained two-dimensional engraved contour lines, and using parametric mapping to map it to discrete engraved lines on the surface of the three-dimensional model;
对雕刻区域参数化后,要将二维雕刻轮廓线映射为模型表面离散雕刻线条,该过程如下:设三维模型表面雕刻区域为FS,参数化后平面参数域上对应的面片集为方法把参数域缩放到与二维图像大小一致后,将雕刻轮廓线的像素点映射到参数域上,根据像素坐标以及每个参数域面片的三个顶点坐标判断每个像素点p映射后落在模型表面某个面片上,设像素p位于内,则p可以由的三个点表示如下:其中λ1+λ2+λ3=1;设由对应的三维模型雕刻区域面片Fi的顶点分别为v0,v1,v2,则将像素点p映射到三维模型面片Fi上的点v可确定为v=λ1v0+λ2v1+λ3v2;在将二维雕刻轮廓线条映射到模型表面之前通常需要对二维轮廓线进行降采样处理,对每个包含像素点的参数域面片将所包含的所有像素点坐标求平均,得到降采样后的二维雕刻轮廓像素点p,再将像素点p借助参数化映射得到三维模型表面点v,并将所有v加入到原始三维模型中,这样便从二维雕刻线条映射得到了三维模型表面的离散雕刻线条。After parameterizing the engraved area, the two-dimensional engraved contours should be mapped to the discrete engraved lines on the model surface. The process is as follows: Let the engraved area on the surface of the three-dimensional model be F S , and the corresponding patch set on the plane parameter domain after parameterization is The method scales the parameter field to the same size as the two-dimensional image, maps the pixels of the engraved contour line to the parameter field, and judges each pixel point p after mapping according to the pixel coordinates and the coordinates of the three vertices of each parameter field patch falls on a patch on the surface of the model, let the pixel p be located at , then p can be given by the three points Expressed as follows: Where λ 1 +λ 2 +λ 3 =1; suppose by The vertices of the corresponding 3D model engraving area patch F i are respectively v 0 , v 1 , v 2 , then the point v that maps the pixel point p to the 3D model patch F i can be determined as v=λ 1 v 0 + λ 2 v 1 +λ 3 v 2 ; Before mapping the two-dimensional engraved contour lines to the model surface, it is usually necessary to downsample the two-dimensional contour lines, and for each parameter domain patch containing pixels Average the coordinates of all the included pixels to obtain the down-sampled 2D engraving contour pixel point p, and then use the parameterized mapping to obtain the 3D model surface point v from the pixel point p, and add all v to the original 3D model , so that the discrete sculpted lines on the surface of the 3D model are obtained from the 2D sculpted line mapping.
4)计算三维模型表面的待雕刻顶点到三维雕刻线条的距离,利用雕刻函数确定待雕刻区域顶点的平移距离和方向,对待雕刻顶点进行平移得到三维雕刻效果;计算雕刻区域内的顶点到三维离散雕刻线条的距离时,首先由用户指定雕刻宽度,将距离小于雕刻宽度的顶点按雕刻函数H(d)确定平移距离,然后沿着顶点法向进行平移,最终实现三维雕刻效果;其中的雕刻函数H(d)取为:4) Calculate the distance from the vertices to be carved on the surface of the 3D model to the 3D engraving lines, use the engraving function to determine the translation distance and direction of the vertices in the area to be engraved, and translate the vertices to be engraved to obtain the three-dimensional engraving effect; calculate the vertices in the engraving area to the three-dimensional discrete When engraving the line distance, the user first specifies the engraving width, and the vertices whose distance is smaller than the engraving width are determined by the engraving function H(d) to determine the translation distance, and then translate along the normal direction of the vertices to finally achieve the three-dimensional engraving effect; the engraving function H(d) is taken as:
本发明的技术构思为:基于用户输入的二维线画图案,通过边缘收缩操作提取线条中心线作为雕刻轮廓线,将二维雕刻轮廓线离散化并借助参数化映射为三维模型上的离散雕刻线条,利用定义为三维模型顶点到雕刻线条集距离的雕刻函数,本专利提出了一种基于线画图案的三维雕刻方法。The technical idea of the present invention is: based on the two-dimensional line drawing pattern input by the user, extract the center line of the line as the engraved contour line through the edge contraction operation, discretize the two-dimensional engraved contour line and use parametric mapping to discrete engraving on the three-dimensional model Lines, using the engraving function defined as the distance from the vertex of the three-dimensional model to the engraving line set, this patent proposes a three-dimensional engraving method based on line drawing patterns.
本发明的有益效果主要表现在:操作简单、雕刻方便、雕刻效果可控性强。The beneficial effects of the invention are mainly manifested in: simple operation, convenient engraving, and strong controllability of engraving effect.
附图说明Description of drawings
图1是本发明的用户输入的二维线画图案示例。Fig. 1 is an example of a two-dimensional line drawing pattern input by a user in the present invention.
图2是以图1作为输入的预处理后得到的二维雕刻轮廓线。Fig. 2 is the two-dimensional engraving outline obtained after preprocessing with Fig. 1 as input.
图3是本发明将二维雕刻轮廓线映射为三维模型表面离散雕刻线条的示例图。Fig. 3 is an example diagram of mapping the two-dimensional engraved outlines to the discrete engraved lines on the surface of the three-dimensional model according to the present invention.
图4是本发明利用二维线画图案在不同模型表面实现的复杂雕刻效果示例图。Fig. 4 is an example diagram of complex engraving effects realized on different model surfaces by using two-dimensional line drawing patterns according to the present invention.
具体实施方式detailed description
下面结合附图对本发明的技术方法和生成的各种三维模型雕刻效果作进一步描述和详细说明。The technical method of the present invention and various sculpting effects of three-dimensional models generated will be further described and explained in detail below in conjunction with the accompanying drawings.
参照附图1---附图4,基于线画图案的三维模型雕刻方法,所述的方法包括以下四个步骤:With reference to accompanying drawing 1---accompanying drawing 4, the three-dimensional model engraving method based on line drawing pattern, described method comprises the following four steps:
1)用户输入需要雕刻的二维线画图案,方法对输入图案进行预处理,通过边缘收缩操作提取输入线画图中的线条中心线作为雕刻轮廓线;1) The user inputs the two-dimensional line drawing pattern that needs to be engraved, and the method preprocesses the input pattern, and extracts the center line of the line in the input line drawing image as the engraving contour line through the edge contraction operation;
将输入的二维线画图案(如附图1)转为灰度图,并计算每个像素点的梯度值,将梯度值大于梯度最大值10%的像素点作为待移动像素点,记录待移动像素点总数nmove;对于待移动的像素点,沿着其单位化梯度方向向中心移动,每个待移动像素点移动到中心附近时停止移动;判断像素点停止移动的方法如下:首先收集像素点pi的邻域Ni={pj|||pj-pi||≤1},判断该邻域内像素点pj的梯度方向与像素点pi的梯度方向是否一致,当时,说明此时邻域范围内已经有与移动方向相反的像素点pj,即pj是由与pi相对轮廓中心线相反的边界移动得到的点,此时pi已经靠近轮廓中心线;再判断pi是否移动越过pj,当满足时,pi越过pj,说明pi已经到达轮廓中心线处,故停止移动。随着停止移动的像素点数的增多,待移动像素点越来越少,当待移动像素点数目不超过λ·nmove时,整个收缩过程结束(其中参数λ可取0.01)。收缩结束后,为了处理可能出现少量孤立点情形,将其中邻域Ni中包含的像素点数少于2个的像素点pi作为孤立点去除,从而得到如附图2的二维雕刻轮廓线。Convert the input two-dimensional line drawing pattern (as shown in Figure 1) into a grayscale image, and calculate the gradient value of each pixel point, and use the pixel point whose gradient value is greater than 10% of the maximum gradient value as the pixel point to be moved, and record the pixel point to be moved. The total number of moving pixels n move ; for the pixels to be moved, move toward the center along the direction of the unitized gradient, and each pixel to be moved stops when it moves near the center; the method for judging that the pixels stop moving is as follows: first collect Neighborhood N i of pixel point p i ={p j |||p j -p i ||≤1}, determine the gradient direction of pixel point p j in this neighborhood Gradient direction with pixel point p i Is it consistent when , it means that there is already a pixel point p j opposite to the moving direction in the neighborhood at this time, that is, p j is a point obtained by moving on the boundary opposite to p i relative to the contour center line, and at this time p i is already close to the contour center line ; Then judge whether p i moves beyond p j , when satisfying When pi crosses p j , it means that pi has reached the center line of the contour, so it stops moving. As the number of pixels that stop moving increases, the number of pixels to be moved becomes less and less. When the number of pixels to be moved does not exceed λ·n move , the entire shrinking process ends (the parameter λ can be 0.01). After the shrinkage is over, in order to deal with the situation that a small number of isolated points may appear, the pixel points p i that contain less than 2 pixel points in the neighborhood N i are removed as isolated points, so as to obtain the two-dimensional engraved contour line as shown in Figure 2 .
2)针对不同类型的三维模型,对模型表面待雕刻区域分别进行参数化;2) For different types of 3D models, parameterize the area to be carved on the surface of the model;
对于圆柱面、球面等三维模型,可以将整个模型作为雕刻区域,用简单的参数化方法将整个模型参数化。对于半圆柱面模型,设其高与Z轴平行,在XOY平面任取一点作为基准点O,圆柱面上任意点M在XOY平面上的投影点与基准点所张成的角度为θ,圆柱体高为h,则点M参数坐标为(s,t)=(θ/π,||zM-zO||/h),其中zM和zO分别是点Μ和点O的z坐标。对于半球面模型,任意点P(x,y,z)的参数坐标为(s,t)=(arccos(z/r),arctan(y/x)),其中r为球面半径。For three-dimensional models such as cylindrical surfaces and spherical surfaces, the entire model can be used as a carving area, and the entire model can be parameterized with a simple parameterization method. For the semi-cylindrical model, let its height be parallel to the Z axis, take any point on the XOY plane as the reference point O, and the angle formed by the projection point of any point M on the XOY plane on the cylindrical surface and the reference point is θ, the cylinder If the body height is h, the parameter coordinates of point M are (s,t)=(θ/π,||z M -z O ||/h), where z M and z O are the z coordinates of point M and point O respectively . For the hemispherical model, the parameter coordinates of any point P(x, y, z) are (s, t) = (arccos(z/r), arctan(y/x)), where r is the radius of the sphere.
对于一般的三维模型,首先需要选取模型表面局部区域作为待雕刻区域,然后采用局部参数化方法进行参数化。其中待雕刻区域可以通过用户在需要雕刻的区域中心手绘一条线,系统根据该手绘线自动生成雕刻区域,具体过程如下:a)先对手绘线条进行细化操作;细化过程中,可以依次得到该手绘线条与模型表面的交点,记录每个交点所在的平面,确定手绘线条经过的面片集Fline;细化结束后,对得到的交点集v1,v2,…,vl沿着经过的三角面片进行均匀重采样,将均匀重采样后的点集作为雕刻区域的基准线点集;b)由用户选择距离其手绘线条的多大范围内区域作为需要雕刻的区域;将三维网格模型的平均边长与用户给定的距离阈值的乘积作为距离基准线点集的最大测地线距离dmax;利用图论思想,将三维网格模型上手绘线条经过的面片集Fline的k-邻域Fk区域(可取k=120)作为候选区域并建立带权图,分别取网格模型的顶点和边作为图的顶点和边,权值取为相应边长;再将基准线点集加入到带权图中,将每个点与它所在三角面片的三个顶点分别相连形成边,并以连接得到的边的长度作为权值;同时对基准线点集中的点依次相连形成边,取权值为0;这样,k-邻域Fk区域的带权图建立完成后,采用最短路径快速计算SPFA算法计算出每个顶点vi到基准线的最短路径di;若Fk区域中的某个面片Fi满足其三个顶点到基准线的最短路径均小于dmax,那么Fi即为待雕刻的面片,Fk区域中所有满足条件的面片集合FS就是最终得到的雕刻区域,此时待雕刻区域生成后,再对局部区域进行参数化,雕刻区域内的任意网格顶点v的参数坐标可以由该顶点相对于基准线的位置计算得到,故顶点v的参数坐标为其中d为点v到基准线的测地线距离,为在手绘线上的参数值,为到的长度,Ll为手绘线总长度;但是此时雕刻区域中基准线两侧的参数坐标相同,故需要进一步判断顶点v相对于基准线的方向: 为的法向,是在基准线上的切线,是v到的向量,顶点v的参数坐标修正为此时顶点v在s方向的值域范围为[-1,1],为了将其转化为[0,1],需要将雕刻区域内的所有顶点相对基准线向右平移dmax个单位,从而一般三维模型表面局部雕刻区域内任意顶点v的最终参数坐标可以取为 For a general 3D model, it is first necessary to select a local area on the surface of the model as the area to be sculpted, and then use the local parameterization method for parameterization. The area to be engraved can be drawn by the user in the center of the area to be engraved, and the system will automatically generate the engraved area according to the hand-drawn line. The specific process is as follows: a) first refine the hand-painted line; The intersection point between the hand-drawn line and the model surface, record the plane where each intersection point is located, and determine the patch set F line that the hand - drawn line passes through ; Uniform resampling is performed on the passing triangles, and the uniformly resampled point set As the baseline point set of the engraving area; b) The user selects the area within the distance from the hand-drawn line as the area to be engraved; the product of the average side length of the 3D mesh model and the distance threshold given by the user is used as the distance reference The maximum geodesic distance d max of the line point set; using the idea of graph theory, the k-neighborhood F k area (preferably k=120) of the patch set F line on the 3D mesh model that the hand-painted line passes through is used as a candidate area and Establish a weighted graph, take the vertices and edges of the grid model as the vertices and edges of the graph respectively, and take the weight as the corresponding edge length; then set the baseline point set Add it to the weighted graph, connect each point with the three vertices of the triangular surface where it is located to form an edge, and use the length of the connected edge as the weight; at the same time, connect the points in the baseline point set to form an edge , and the weight value is 0; thus, after the weighted graph of the k-neighborhood F k area is established, the shortest path d i from each vertex v i to the baseline is calculated by using the shortest path fast calculation SPFA algorithm; if F k A facet F i in the region satisfies that the shortest path from its three vertices to the baseline is less than d max , then F i is the facet to be carved, and all facet sets F S that meet the conditions in the F k region are The final engraved area, at this time After the engraving area is generated, the local area is parameterized. The parameter coordinates of any grid vertex v in the engraving area can be calculated from the position of the vertex relative to the baseline, so the parameter coordinates of the vertex v are where d is the geodesic distance from point v to the datum line, for parameter values on the freehand line, for arrive , L l is the total length of the hand-drawn line; but at this time, the parameter coordinates on both sides of the reference line in the engraving area are the same, so it is necessary to further determine the direction of the vertex v relative to the reference line: for normal direction, yes Tangents on the base line, is v to The vector, the parameter coordinates of the vertex v are corrected as At this time, the value range of the vertex v in the s direction is [-1, 1], in order to convert it to [0, 1], it is necessary to translate all vertices in the engraved area to the right by d max units relative to the reference line, so that In general, the final parameter coordinates of any vertex v in the local engraving area on the surface of a 3D model can be taken as
3)将得到的二维雕刻轮廓线离散化,并利用参数化映射将其映射为三维模型表面的离散雕刻线条;3) discretizing the obtained two-dimensional engraved contour lines, and using parametric mapping to map it to discrete engraved lines on the surface of the three-dimensional model;
对雕刻区域参数化后,要将二维雕刻轮廓线映射为模型表面离散雕刻线条,该过程如下:设三维模型表面雕刻区域为FS,参数化后平面参数域上对应的面片集为方法把参数域缩放到与二维图像大小一致后,将雕刻轮廓线的像素点映射到参数域上,根据像素坐标以及每个参数域面片的三个顶点坐标判断每个像素点p映射后落在模型表面某个面片上,设像素p位于内,则p可以由的三个点表示如下:其中λ1+λ2+λ3=1;设由对应的三维模型雕刻区域面片Fi的顶点分别为v0,v1,v2,则将像素点p映射到三维模型面片Fi上的点v可确定为v=λ1v0+λ2v1+λ3v2;在将二维雕刻轮廓线条映射到模型表面之前通常需要对二维轮廓线进行降采样处理,对每个包含像素点的参数域面片将所包含的所有像素点坐标求平均,得到降采样后的二维雕刻轮廓像素点p,再将像素点p借助参数化映射得到三维模型表面点v,并将所有v加入到原始三维模型中,这样便从二维雕刻轮廓线条映射得到了如附图3所示的三维模型上的离散雕刻线条。After parameterizing the engraving area, the two-dimensional engraving contours should be mapped to discrete engraving lines on the model surface, the process is as follows: Let the engraving area on the surface of the three-dimensional model be F S , and the corresponding patch set on the plane parameter domain after parameterization is Method After scaling the parameter field to the same size as the two-dimensional image, map the pixel points of the engraving contour line to the parameter field, and judge each pixel point p after mapping according to the pixel coordinates and the coordinates of the three vertices of each parameter field patch falls on a patch on the surface of the model, let the pixel p be located at , then p can be given by the three points Expressed as follows: Where λ 1 +λ 2 +λ 3 =1; suppose by The vertices of the corresponding 3D model engraving area patch F i are respectively v 0 , v 1 , v 2 , then the point v that maps the pixel point p to the 3D model patch F i can be determined as v=λ 1 v 0 + λ 2 v 1 +λ 3 v 2 ; Before mapping the two-dimensional engraved contour lines to the model surface, it is usually necessary to down-sample the two-dimensional contour lines, and for each parameter domain patch containing pixels Average the coordinates of all the included pixels to obtain the down-sampled 2D engraved contour pixel point p, and then use the parameterized mapping to obtain the 3D model surface point v from the pixel point p, and add all v to the original 3D model , so that the discrete engraved lines on the three-dimensional model as shown in Figure 3 are obtained from the two-dimensional engraved contour line mapping.
4)计算三维模型表面的待雕刻顶点到三维雕刻线条的距离,利用雕刻函数确定待雕刻区域顶点的平移距离和方向,对待雕刻顶点进行平移得到三维雕刻效果;计算雕刻区域内的顶点到三维离散雕刻线条的距离时,首先由用户指定雕刻宽度,将距离小于雕刻宽度的顶点按雕刻函数H(d)确定平移距离,然后沿着顶点法向进行平移,最终实现三维雕刻效果,如附图4所示,作为例子其中的雕刻函数H(d)取为:4) Calculate the distance from the vertices to be carved on the surface of the 3D model to the 3D engraving lines, use the engraving function to determine the translation distance and direction of the vertices in the area to be engraved, and translate the vertices to be engraved to obtain the three-dimensional engraving effect; calculate the vertices in the engraving area to the three-dimensional discrete When engraving the line distance, the user first specifies the engraving width, and the vertices whose distance is smaller than the engraving width determine the translation distance according to the engraving function H(d), and then translate along the normal direction of the vertices to finally realize the three-dimensional engraving effect, as shown in Figure 4 As shown, as an example, the engraving function H(d) is taken as:
Claims (1)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410281067.7A CN104143209B (en) | 2014-06-20 | 2014-06-20 | Method for engraving three-dimensional model based on line pattern |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410281067.7A CN104143209B (en) | 2014-06-20 | 2014-06-20 | Method for engraving three-dimensional model based on line pattern |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104143209A CN104143209A (en) | 2014-11-12 |
CN104143209B true CN104143209B (en) | 2017-05-17 |
Family
ID=51852377
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410281067.7A Active CN104143209B (en) | 2014-06-20 | 2014-06-20 | Method for engraving three-dimensional model based on line pattern |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104143209B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104827815B (en) * | 2015-05-20 | 2017-08-25 | 安徽一威贸易有限公司 | One kind layering engraving process |
CN106408655B (en) * | 2016-09-21 | 2019-04-05 | 江苏大学 | A kind of 3D hollowed-out light cover design method |
US10521970B2 (en) * | 2018-02-21 | 2019-12-31 | Adobe Inc. | Refining local parameterizations for applying two-dimensional images to three-dimensional models |
CN108537858B (en) * | 2018-03-23 | 2022-06-21 | 浙江工业大学 | Drawing time sequence-based stroke line dynamic merging method |
CN109003243B (en) * | 2018-07-20 | 2021-10-29 | 广州市普汉科技有限公司 | Relief effect image processing method for laser engraving |
CN110356151B (en) * | 2019-05-28 | 2024-06-25 | 合肥晌玥科技有限公司 | Automatic generation method and device for jade carving path |
CN112462689B (en) * | 2020-12-10 | 2022-08-02 | 德州钰雕机械设备有限公司 | Method for generating handicraft digital model random carving four-axis three-linkage cutter path |
CN114283266B (en) * | 2021-12-21 | 2024-11-26 | 广州虎牙科技有限公司 | A three-dimensional model adjustment method, device, storage medium and equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103226846A (en) * | 2013-03-22 | 2013-07-31 | 浙江工业大学 | Three-dimensional carving method based on hand-drawn lines |
CN103473811A (en) * | 2013-08-20 | 2013-12-25 | 浙江工业大学 | Convenient generation method of three-dimensional solid model based on two-dimensional freehand line drawing |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004078697A (en) * | 2002-08-20 | 2004-03-11 | Fuji Xerox Co Ltd | Method for processing image, method for forming image, image processor, and image forming device |
US20090322748A1 (en) * | 2008-06-09 | 2009-12-31 | Uti Limited Partnership | Methods,systems, and computer program products for GPU-based point radiation for interactive volume sculpting and segmentation |
US8187403B2 (en) * | 2008-09-19 | 2012-05-29 | Barton Nelson, Inc. | Method of producing solid decorated graphic arts objects |
-
2014
- 2014-06-20 CN CN201410281067.7A patent/CN104143209B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103226846A (en) * | 2013-03-22 | 2013-07-31 | 浙江工业大学 | Three-dimensional carving method based on hand-drawn lines |
CN103473811A (en) * | 2013-08-20 | 2013-12-25 | 浙江工业大学 | Convenient generation method of three-dimensional solid model based on two-dimensional freehand line drawing |
Non-Patent Citations (2)
Title |
---|
Precise Vector Textures for Real-Time 3D Rendering;Zheng Qin 等;《Proceedings of the 2008 symposium on Interactive 3D graphics and games》;20081231;第199-206页 * |
Topology-Driven Vectorization of Clean Line Drawings;GIOACCHINO NORIS 等;《ACM Transactions on Graphics》;20130131;第32卷(第1期);第1-11页 * |
Also Published As
Publication number | Publication date |
---|---|
CN104143209A (en) | 2014-11-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104143209B (en) | Method for engraving three-dimensional model based on line pattern | |
CN102254343B (en) | A 3D Mesh Model Skeleton Extraction Method Based on Convex Hull and OBB | |
CN101853523B (en) | Method for adopting rough drawings to establish three-dimensional human face molds | |
CN101719140B (en) | Graph retrieval method | |
CN101984467B (en) | Non-photorealistic rendering method for three-dimensional network model with stylized typical lines | |
CN101937579B (en) | A Method of Creating 3D Surface Model Using Perspective Sketch | |
CN107330903B (en) | Skeleton extraction method of human point cloud model | |
CN103325146B (en) | The three-dimensional mapping method of a kind of clothing dough sheet based on human body section rings data | |
US6989830B2 (en) | Accurate boolean operations for subdivision surfaces and relaxed fitting | |
Pérez et al. | A comparison of hole-filling methods in 3D | |
CN101515374A (en) | Individualized realistic virtual character modeling method based on images | |
Hui et al. | A feature-based shape blending technique for industrial design | |
Cao et al. | Computation of medial axis and offset curves of curved boundaries in planar domain | |
CN103226846B (en) | A kind of three dimensional sculpture method based on Freehandhand-drawing lines | |
Orbay et al. | Sketch-based surface design using malleable curve networks | |
CN105243137B (en) | A kind of three-dimensional model search viewpoint selection method based on sketch | |
Cordier et al. | Sketch-based modeling | |
Yoshizawa et al. | Fast and faithful geometric algorithm for detecting crest lines on meshes | |
CN101908234B (en) | User controlled method for generating highly structured triangular meshes | |
Ao et al. | An intersection algorithm for disk B-spline curves | |
Junior et al. | A 3D modeling methodology based on a concavity-aware geometric test to create 3D textured coarse models from concept art and orthographic projections | |
CN104143211B (en) | Method for generating three-dimensional free body based on one image | |
CN105957141A (en) | Symmetric structure-based three-dimensional flower modeling method | |
CN106981095B (en) | A kind of improved smooth free-form deformation | |
Zhang et al. | Line-based sunken relief generation from a 3D mesh |
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 |