CN107038741B - Method for three-dimensionally rendering two-dimensional shadow - Google Patents

Method for three-dimensionally rendering two-dimensional shadow Download PDF

Info

Publication number
CN107038741B
CN107038741B CN201611023431.5A CN201611023431A CN107038741B CN 107038741 B CN107038741 B CN 107038741B CN 201611023431 A CN201611023431 A CN 201611023431A CN 107038741 B CN107038741 B CN 107038741B
Authority
CN
China
Prior art keywords
normal
vertex
vector
value
offset
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
Application number
CN201611023431.5A
Other languages
Chinese (zh)
Other versions
CN107038741A (en
Inventor
沈晨
刘晓鹏
阳星生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Kaka Cultural Communication Co ltd
Original Assignee
Shanghai Kaka Cultural Communication Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shanghai Kaka Cultural Communication Co ltd filed Critical Shanghai Kaka Cultural Communication Co ltd
Priority to CN201611023431.5A priority Critical patent/CN107038741B/en
Publication of CN107038741A publication Critical patent/CN107038741A/en
Application granted granted Critical
Publication of CN107038741B publication Critical patent/CN107038741B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a method for three-dimensionally rendering a two-dimensional light shadow, which discovers that the two-dimensional light shadow effect is realized in three dimensions by deeply researching two dimensions and three dimensions, a normal line and a material of a model are required to be controlled, the relationship between the normal line and the light shadow is summarized by deeply researching the relationship between the two-dimensional light shadow, so that the two-dimensional light shadow has a clear and smooth structure, and the light shadow has color diversity, thereby solving the problems that the real environment is simulated according to the physical principle in the three-dimensional light shadow, the shadow is excessively soft, the projection is disordered, and the structure is not clear.

Description

Method for three-dimensionally rendering two-dimensional shadow
Technical Field
The invention relates to a method for three-dimensionally rendering two-dimensional light and shadow.
Background
Three-dimensional simulation of a real environment is carried out according to a physical principle, the shadow is excessively soft, and the light and shadow structure is complex.
Two-dimensional is a highly generalized three-dimensional light and shadow representation, with a compact light shade and a structural height to restore a two-dimensional light and shadow.
Disclosure of Invention
The invention aims to provide a method for three-dimensionally rendering a two-dimensional light shadow, which can solve the problems that a real environment is simulated according to a physical principle in the three-dimensional light shadow, the shadow is excessively soft, the projection is disordered, and the structure is unclear.
In order to solve the above problems, the present invention provides a method for three-dimensionally rendering a two-dimensional shadow, comprising:
1) the vertex normal of the object is consistent with the direction of spherical radiation by taking the center of the object as an origin;
2) performing addition, subtraction and multiplication superposition operations of normal vectors on the basis of the existing vertex normal;
3) extracting a surface normal vector of the copied object, then finding a vertex with the shortest gravity center distance point of the surface of the copied object from the vertexes of the copied object, and copying the surface normal vector of the copied object onto the vertex normal;
4) the longitudinal and transverse anisotropies are utilized, the zeroing property of 2-time derivation of a high-order function is used, the change of a normal vector in the longitudinal direction and the transverse direction is realized, and the device has smooth and continuous characteristics.
Further, in the above method, aligning a vertex normal of the object with a direction of spherical radiation with an object center as an origin includes: and generating a continuous smooth normal vector gradual change between the original vertex normal vector and the spherical normal vector by utilizing the directionality of the vector, wherein the change magnitude of the normal vector is determined by a weight value, namely a sphericization value.
Further, in the above method, a continuous smooth gradient of the normal vector is generated between the original vertex normal vector and the spherical normal vector by using the directionality of the vector, wherein the magnitude of the change of the normal vector is determined by the weight value, i.e. the sphericization value, and the method includes: and subtracting the object center coordinate from the vertex coordinate to form a vector value, normalizing the vector value, copying the normalized vector value to the vertex normal, calculating an offset value based on each weight value, and superposing the offset value on the original vertex normal to form a spherical vertex normal based on the weight values.
Further, in the above method, the operations of adding, subtracting, and multiplicatively adding the normal vector are performed based on the existing vertex normal, and the operations include: and (3) performing conversion calculation on the existing vertex normal by using a three-dimensional affine equation, obtaining an offset through a weight value, retaining the offset in a parameter form, and simultaneously completing addition, subtraction and multiplication calculation.
Further, in the above method, a three-dimensional affine equation is used to perform conversion calculation on an existing vertex normal, an offset is obtained through a weight value, and the offset is retained in a form of a parameter, and meanwhile, addition, subtraction and multiplication calculation is completed, including: and performing linear calculation on the original normal vector by using a three-dimensional affine addition matrix and a three-dimensional affine multiplication matrix, obtaining an offset through a weight value, retaining the offset in a parameter form, and simultaneously completing addition, subtraction and multiplication calculation.
Further, in the above method, extracting a surface normal vector of the copied object, then finding a vertex with a shortest distance to a center of gravity point of the surface of the copied object among vertices of the copied object, and copying the surface normal vector of the copied object onto the vertex normal, includes: copying the surface normal vector of the object and the gravity center point of the triangular surface, calculating the distance from each vertex of the copied object to the gravity center point, if a plurality of vertices exist, obtaining the optimal vertex by using the minimum 2 multiplication, and copying the surface normal vector of the copied object to the vertex normal.
Further, in the above method, the variation of the normal vector in the longitudinal and transverse directions is realized by using the zeroing property of the 2-degree derivation of the high-order function, using the anisotropy in the longitudinal and transverse directions, and the method has a smooth and continuous characteristic, and includes: and (4) on the vertical and horizontal vertexes, the normal offset is evenly divided according to the Bessel spline curve, and the vertical component and the horizontal component of the vertical direction and the horizontal direction are superposed to obtain a smooth value.
Further, in the above method, on the longitudinal and transverse vertexes, the normal offset is equally divided according to the bezier spline curve, and then the longitudinal and transverse longitudinal components and the transverse component are superimposed to obtain a smoothed value, including: respectively obtaining 2 groups of vector value lists in the longitudinal direction and the transverse direction, equally dividing a normal longitudinal component and a normal transverse component in the longitudinal direction and the transverse direction according to a Bessel spline curve, and then performing addition calculation on the longitudinal component and the normal transverse component of the same vertex normal to obtain a final smooth normal.
Compared with the prior art, the invention discovers that the two-dimensional and three-dimensional deep researches show that the two-dimensional light and shadow effect is realized in three dimensions, the normal line and the material of the model are required to be controlled, the relation between the normal line and the light and shadow is summarized by deep researches on the two-dimensional light and shadow, so that the two-dimensional light and shadow has clear and smooth structure and color diversity, and the problems that the real environment is simulated according to the physical principle in the three-dimensional light and shadow, the shadow is excessively soft, the projection is disordered and the structure is not clear are solved.
Drawings
FIG. 1 is a flow chart of a method for three-dimensional rendering of two-dimensional shadows in accordance with an embodiment of the invention;
FIG. 2 is a photocopy of a document taken in accordance with one embodiment of the present invention;
FIG. 3 is a texture map of four colors given to a model according to an embodiment of the present invention;
FIG. 4 is a model normal parameter graph of an embodiment of the invention;
FIG. 5 is a graph of model normal results for one embodiment of the invention;
FIGS. 6a, 6b and 6c are parameter diagrams of an embodiment of the present invention;
FIG. 7 is a graph of the results of one embodiment of the present invention;
FIGS. 8a, 8b and 8c are detail tuning parameter diagrams of an embodiment of the present invention;
FIG. 9 is a diagram illustrating the result of detail adjustment according to an embodiment of the present invention;
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
As shown in fig. 1, the present invention provides a method for three-dimensionally rendering a two-dimensional shadow, comprising:
step S1, using the center of the object as the origin to make the vertex normal of the object and the direction of the spherical radiation consistent; here, the present step is a process of normal sphericization;
step S2, adding, subtracting, multiplying and superposing normal vectors on the basis of the existing vertex normal; here, this step is a process of normal addition multiplication;
step S3, extracting the surface normal vector of the copied object, then finding the vertex with the shortest gravity center distance point of the surface of the copied object in the copied object vertex, and copying the surface normal vector of the copied object to the vertex normal; here, this step is a process of normal copy;
step S4, using the longitudinal and transverse anisotropies, using the zeroing property of the 2-order derivation of the high-order function, to realize the change of the normal vector in the longitudinal and transverse directions, having smooth and continuous characteristics. Here, this step is a normal smoothing process; in the invention, through the deep research on two-dimension and three-dimension, the normal line and material of the model must be controlled to realize the two-dimension light shadow effect in the three-dimension, and the relationship between the normal line and the light shadow is summarized by deep research on the two-dimension light shadow, so that the two-dimension light shadow has clear and smooth structure, and the light shadow has color diversity, thereby solving the problems that the real environment is simulated according to the physical principle in the three-dimension light shadow, the shadow is excessively soft, the projection is disordered, and the structure is not clear.
In an embodiment of the present invention, the step S1 of making the vertex normal of the object and the spherical radiation direction coincide with each other with the center of the object as the origin includes:
and generating a continuous smooth normal vector gradual change between the original vertex normal vector and the spherical normal vector by utilizing the directionality of the vector, wherein the change magnitude of the normal vector is determined by a weight value, namely a sphericization value.
In an embodiment of the present invention, a continuous smooth gradual normal vector change is generated between an original vertex normal vector and a spherical normal vector by using the directionality of the vector, wherein the magnitude of the change of the normal vector is determined by a weight value, i.e., a sphericization value, and the method includes:
and subtracting the object center coordinate from the vertex coordinate to form a vector value, normalizing the vector value, copying the normalized vector value to the vertex normal, calculating an offset value based on each weight value, and superposing the offset value on the original vertex normal to form a spherical vertex normal based on the weight values.
In an embodiment of the present invention, step S2, performing addition, subtraction, multiplication and superposition operations of normal vectors based on the existing vertex normal, includes:
and (3) performing conversion calculation on the existing vertex normal by using a three-dimensional affine equation, obtaining an offset through a weight value, retaining the offset in a parameter form, and simultaneously completing addition, subtraction and multiplication calculation. Here, the calculated offset value can cancel the influence of the offset value on the original normal vector at any time, so that controllability of correction of the original normal vector can be realized.
In an embodiment of the present invention, a three-dimensional affine equation is used to perform conversion calculation on an existing vertex normal, an offset is obtained through a weight value, and the offset is retained in a form of a parameter, and meanwhile, addition, subtraction, multiplication calculation is completed, including:
and performing linear calculation on the original normal vector by using a three-dimensional affine addition matrix and a three-dimensional affine multiplication matrix, obtaining an offset through a weight value, retaining the offset in a parameter form, and simultaneously completing addition, subtraction and multiplication calculation. Here, the offset value is calculated and its effect on the original normal vector can be undone at any time.
In an embodiment of the present invention, in step S3, extracting a surface normal vector of the copied object, finding a vertex with a shortest distance from a center of gravity of the surface of the copied object among vertices of the copied object, and copying the surface normal vector of the copied object onto the vertex normal, includes:
copying the surface normal vector of the object and the gravity center point of the triangular surface, calculating the distance from each vertex of the copied object to the gravity center point, if a plurality of vertices exist, obtaining the optimal vertex by using the minimum 2 multiplication, and copying the surface normal vector of the copied object to the vertex normal.
In an embodiment of the present invention, the change of the normal vector in the longitudinal direction and the transverse direction is realized by using the longitudinal direction and the transverse direction anisotropy and the zeroing property of the 2-order derivation of the high-order function, and the change has smooth and continuous characteristics, including:
and (4) on the vertical and horizontal vertexes, the normal offset is evenly divided according to the Bessel spline curve, and the vertical component and the horizontal component of the vertical direction and the horizontal direction are superposed to obtain a smooth value.
In an embodiment of the present invention, on the longitudinal and transverse vertexes, the normal offset is equally divided according to the bezier spline curve, and the longitudinal and transverse longitudinal components and the transverse component are superimposed to obtain a smoothed value, including:
respectively obtaining 2 groups of vector value lists in the longitudinal direction and the transverse direction, equally dividing a normal longitudinal component and a normal transverse component in the longitudinal direction and the transverse direction according to a Bessel spline curve, and then performing addition calculation on the longitudinal component and the normal transverse component of the same vertex normal to obtain a final smooth normal.
In detail, a specific application example of the present invention comprises the following steps:
the first taken file shadow is shown in FIG. 2;
as shown in fig. 3, the material of four layers of colors on the model is given;
adjusting nodularization, addition, subtraction, multiplication and division of the model normal line by using a normal line tool to achieve a smooth and structured light and shadow effect as much as possible, wherein the model normal line parameter is shown in figure 4, and the model normal line result is shown in figure 5;
the offset position of the material ball color block is roughly adjusted to achieve the structural state, the parameters are shown in fig. 6a, 6b and 6c, and the result is shown in fig. 7;
highlight is added and the position of the highlight is adjusted, the position of the local color block is adjusted, and finally the detail adjustment parameters are shown in fig. 8a, 8b and 8c, and the result is shown in fig. 9.
In summary, in order to reduce the number of materials which can be displayed in real time in the traditional materials, the invention develops a multitask two-dimensional material which can be displayed in real time and can be rendered by software.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (6)

1. A method of three-dimensionally rendering a two-dimensional shadow, comprising:
1) the method for making the vertex normal of the object consistent with the direction of spherical radiation by taking the center of the object as an origin comprises the following steps: generating a continuous smooth gradual change of the normal vector between the normal vector of the original vertex and the normal vector of the sphere by utilizing the directionality of the vector, wherein the change size of the normal vector is determined by a weight value, namely a sphericization value;
2) performing addition, subtraction and multiplication superposition operations of normal vectors on the basis of the existing vertex normal;
3) extracting a surface normal vector of the copied object, then finding a vertex with the shortest gravity center distance point of the surface of the copied object from the vertexes of the copied object, and copying the surface normal vector of the copied object onto the vertex normal;
4) the change of the normal vector in the longitudinal direction and the transverse direction is realized by utilizing the anisotropy of the longitudinal direction and the transverse direction and the zeroing property of 2-time derivation of a high-order function, and the change has smooth and continuous characteristics and comprises the following steps: and (4) on the vertical and horizontal vertexes, the normal offset is evenly divided according to the Bessel spline curve, and the vertical component and the horizontal component of the vertical direction and the horizontal direction are superposed to obtain a smooth value.
2. The method of claim 1, wherein the generating a continuous smooth gradient of normal vector between the original vertex normal vector and the spherical normal vector by using the directionality of the vector, wherein the magnitude of the change of the normal vector is determined by a weighting value (sphericization value) comprising: and subtracting the object center coordinate from the vertex coordinate to form a vector value, normalizing the vector value, copying the normalized vector value to the vertex normal, calculating an offset value based on each weight value, and superposing the offset value on the original vertex normal to form a spherical vertex normal based on the weight values.
3. The method of three-dimensional rendering of two-dimensional shadows of claim 2, wherein the operations of adding, subtracting, and multiplicatively superimposing normal vectors on the basis of existing vertex normals include: and (3) performing conversion calculation on the existing vertex normal by using a three-dimensional affine equation, obtaining an offset through a weight value, retaining the offset in a parameter form, and simultaneously completing addition, subtraction and multiplication calculation.
4. The method of claim 3, wherein the converting calculation is performed on the existing vertex normal by using a three-dimensional affine equation, and then an offset is obtained by a weight value, and the offset is retained in a form of a parameter while performing the addition and subtraction multiplication calculation, and the method comprises: and performing linear calculation on the original normal vector by using a three-dimensional affine addition matrix and a three-dimensional affine multiplication matrix, obtaining an offset through a weight value, retaining the offset in a parameter form, and simultaneously completing addition, subtraction and multiplication calculation.
5. The method of three-dimensional rendering of two-dimensional shadows of claim 4, wherein extracting surface normal vectors of the replicated object, finding a vertex of the replicated object with the shortest distance between the center of gravity points of the surface of the replicated object among the vertices of the replicated object, and replicating the surface normal vector of the replicated object onto the vertex normal, comprises: copying the surface normal vector of the object and the gravity center point of the triangular surface, calculating the distance from each vertex of the copied object to the gravity center point, if a plurality of vertices exist, obtaining the optimal vertex by using the minimum 2 multiplication, and copying the surface normal vector of the copied object to the vertex normal.
6. The method of three-dimensional rendering of two-dimensional shadows according to claim 5, wherein the step of obtaining a smoothed value by equally dividing the normal offset by a bezier spline curve at the longitudinal and transverse vertices and by superimposing the longitudinal and transverse components comprises: respectively obtaining 2 groups of vector value lists in the longitudinal direction and the transverse direction, equally dividing a normal longitudinal component and a normal transverse component in the longitudinal direction and the transverse direction according to a Bessel spline curve, and then performing addition calculation on the longitudinal component and the normal transverse component of the same vertex normal to obtain a final smooth normal.
CN201611023431.5A 2016-11-21 2016-11-21 Method for three-dimensionally rendering two-dimensional shadow Expired - Fee Related CN107038741B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611023431.5A CN107038741B (en) 2016-11-21 2016-11-21 Method for three-dimensionally rendering two-dimensional shadow

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611023431.5A CN107038741B (en) 2016-11-21 2016-11-21 Method for three-dimensionally rendering two-dimensional shadow

Publications (2)

Publication Number Publication Date
CN107038741A CN107038741A (en) 2017-08-11
CN107038741B true CN107038741B (en) 2020-08-11

Family

ID=59530768

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611023431.5A Expired - Fee Related CN107038741B (en) 2016-11-21 2016-11-21 Method for three-dimensionally rendering two-dimensional shadow

Country Status (1)

Country Link
CN (1) CN107038741B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109885783B (en) * 2019-01-17 2021-12-21 广州城投发展研究院有限公司 Loading method and device of three-dimensional building model

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6448968B1 (en) * 1999-01-29 2002-09-10 Mitsubishi Electric Research Laboratories, Inc. Method for rendering graphical objects represented as surface elements
CN101441772A (en) * 2008-12-01 2009-05-27 牡丹江新闻传媒集团有限公司 Three-dimensional auxiliary two-dimensional pattern drafting method
CN101763649A (en) * 2009-12-30 2010-06-30 北京航空航天大学 Method for drawing enhanced model contour surface point
CN102376100A (en) * 2010-08-20 2012-03-14 北京盛开互动科技有限公司 Single-photo-based human face animating method
CN105021124A (en) * 2015-04-16 2015-11-04 华南农业大学 Planar component three-dimensional position and normal vector calculation method based on depth map
CN106056661A (en) * 2016-05-31 2016-10-26 钱进 Direct3D 11-based 3D graphics rendering engine

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6448968B1 (en) * 1999-01-29 2002-09-10 Mitsubishi Electric Research Laboratories, Inc. Method for rendering graphical objects represented as surface elements
CN101441772A (en) * 2008-12-01 2009-05-27 牡丹江新闻传媒集团有限公司 Three-dimensional auxiliary two-dimensional pattern drafting method
CN101763649A (en) * 2009-12-30 2010-06-30 北京航空航天大学 Method for drawing enhanced model contour surface point
CN102376100A (en) * 2010-08-20 2012-03-14 北京盛开互动科技有限公司 Single-photo-based human face animating method
CN105021124A (en) * 2015-04-16 2015-11-04 华南农业大学 Planar component three-dimensional position and normal vector calculation method based on depth map
CN106056661A (en) * 2016-05-31 2016-10-26 钱进 Direct3D 11-based 3D graphics rendering engine

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"三维真实感地形和公路的生成方法";毛雷;《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》;20041215(第04期);第I138-1067页 *

Also Published As

Publication number Publication date
CN107038741A (en) 2017-08-11

Similar Documents

Publication Publication Date Title
US9754410B2 (en) System and method for three-dimensional garment mesh deformation and layering for garment fit visualization
CN108334816B (en) Multi-pose face recognition method based on contour symmetric constraint generation type countermeasure network
Decaudin et al. Virtual garments: A fully geometric approach for clothing design
Min et al. Fast global image smoothing based on weighted least squares
Iben et al. Generating surface crack patterns
CN110223370B (en) Method for generating complete human texture map from single-view picture
CN108230435B (en) Graphics processing using cube map textures
CN107481313A (en) A kind of dense three-dimensional object reconstruction method based on study available point cloud generation
Yasseen et al. Sketch-based garment design with quad meshes
Sechelmann et al. Quasiisothermic mesh layout
Colantonio et al. Noninvasive multilevel geometric regularization of mesh‐based three‐dimensional shape measurement
Zhang et al. Portrait relief modeling from a single image
CN106815871B (en) Modeling method of scanning electron microscope imaging system
CN107038741B (en) Method for three-dimensionally rendering two-dimensional shadow
Stanko et al. Surfacing curve networks with normal control
CN111861873B (en) Method and device for generating simulation image
JP2020532022A (en) Sphere light field rendering method in all viewing angles
CN103325086B (en) A kind of deformation method of the three-dimensional picture based on tetrahedral coordinate system
Zell et al. Elastiface: Matching and blending textured faces
Chen et al. Generalized As‐Similar‐As‐Possible Warping with Applications in Digital Photography
Huang et al. Defocusing rectified multi-frequency patterns for high-precision 3D measurement
CN105046738A (en) Clothes dynamic three-dimension making method and making apparatus
KR20190028634A (en) Method and Electronic Apparatus for Producing of Digital Creature
TWI712002B (en) A 3d human face reconstruction method
Balzer et al. Second-order shape optimization for geometric inverse problems in vision

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200811

Termination date: 20201121