CN113450435A - Vertex animation processing method and device - Google Patents
Vertex animation processing method and device Download PDFInfo
- Publication number
- CN113450435A CN113450435A CN202110712859.5A CN202110712859A CN113450435A CN 113450435 A CN113450435 A CN 113450435A CN 202110712859 A CN202110712859 A CN 202110712859A CN 113450435 A CN113450435 A CN 113450435A
- Authority
- CN
- China
- Prior art keywords
- vertex
- rotation matrix
- matrix
- animation
- bending
- 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.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 13
- 238000009877 rendering Methods 0.000 claims abstract description 24
- 239000011159 matrix material Substances 0.000 claims description 152
- 238000005452 bending Methods 0.000 claims description 73
- 230000000875 corresponding Effects 0.000 claims description 21
- 238000006073 displacement reaction Methods 0.000 claims description 15
- 238000000034 method Methods 0.000 claims description 12
- 230000000694 effects Effects 0.000 description 11
- 238000005516 engineering process Methods 0.000 description 9
- 239000002245 particle Substances 0.000 description 9
- 238000010586 diagram Methods 0.000 description 6
- 230000001131 transforming Effects 0.000 description 5
- 210000003811 Fingers Anatomy 0.000 description 4
- 230000001808 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000004088 simulation Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000002452 interceptive Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000006011 modification reaction Methods 0.000 description 2
- 238000005070 sampling Methods 0.000 description 2
- 241000196324 Embryophyta Species 0.000 description 1
- 241000238631 Hexapoda Species 0.000 description 1
- 210000003813 Thumb Anatomy 0.000 description 1
- 238000004040 coloring Methods 0.000 description 1
- 239000004744 fabric Substances 0.000 description 1
- 238000006062 fragmentation reaction Methods 0.000 description 1
- -1 hair Substances 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical Effects 0.000 description 1
- 230000003252 repetitive Effects 0.000 description 1
- 239000004576 sand Substances 0.000 description 1
- 230000035807 sensation Effects 0.000 description 1
- 230000003068 static Effects 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T13/00—Animation
- G06T13/20—3D [Three Dimensional] animation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/005—General purpose rendering architectures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/50—Lighting effects
Abstract
The invention discloses a processing method and device of vertex animation. Wherein, the method comprises the following steps: obtaining a vertex animation texture of a model to be processed, wherein the vertex animation texture is used for indicating initial vertex local coordinates of vertexes with different indexes in different time frames; performing deformation processing on each initial vertex local coordinate recorded in the vertex animation texture to obtain a deformed target vertex local coordinate; and rendering the model to be processed based on the target vertex local coordinates. The method solves the technical problem that the local coordinates of each frame of the vertex are limited by the animation texture of the vertex in the prior art, so that the mesh model is difficult to deform in real-time rendering.
Description
Technical Field
The invention relates to the field of animation processing, in particular to a vertex animation processing method and device.
Background
The vertex animation texture technology is a technology for pre-coding vertex animation information of a model into a texture and calling the vertex animation information at a real-time rendering stage, can realize the updating of vertex coordinates in each frame by transforming indexes of the vertex texture coordinates at the real-time rendering stage, and can restore vertex animation generated in advance by a physical simulation technology in real time.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a processing method and a processing device of vertex animation, which are used for at least solving the technical problem that in the related technology, local coordinates of each frame of a vertex are limited by vertex animation textures, so that a mesh model is difficult to deform in real-time rendering.
According to an aspect of the embodiments of the present invention, there is provided a vertex animation processing method, including: obtaining vertex animation textures of a model to be processed, wherein the vertex animation textures are used for indicating initial vertex local coordinates of vertexes with different indexes in different time frames; performing deformation processing on each initial vertex local coordinate recorded in the vertex animation texture to obtain a deformed target vertex local coordinate; and rendering the model to be processed based on the local coordinates of the target vertex.
Optionally, the deforming process is performed on each initial vertex local coordinate recorded in the vertex animation texture, and includes: acquiring the type of deformation processing, wherein the different types of deformation processing respectively correspond to different deformation functions; calling a corresponding deformation function based on the type of deformation processing; and carrying out deformation processing on each initial vertex local coordinate recorded in the vertex animation texture based on the deformation function.
Optionally, the type of the deformation processing is bending, and the deformation processing is performed on each initial vertex local coordinate recorded in the vertex animation texture based on a deformation function to obtain a deformed target vertex local coordinate, where the method includes: obtaining a bending radius offset vector, a first rotation matrix in a first direction and a second rotation matrix in a second direction, wherein the first direction and the second direction are perpendicular to each other; obtaining a matrix difference value obtained by subtracting a bending radius offset vector from an initial vertex local coordinate; obtaining a first matrix product of the matrix difference value and an inverse matrix of the first rotation matrix, and determining a third rotation matrix based on the first rotation matrix and the second rotation matrix; and determining a second matrix product of the first matrix product and the third rotation matrix as the local coordinates of the target vertex.
Optionally, obtaining the bend radius offset vector, a first rotation matrix in a first direction, and a second rotation matrix in a second direction includes: obtaining bending parameters, wherein the bending parameters comprise: a first curvature radian in a first direction, a second curvature radian in a second direction and the height of a bounding box of the model to be processed; acquiring a first rotation matrix based on the first bending radian; determining a third bending radian corresponding to each vertex based on the second bending radian and the initial vertex local coordinates, and acquiring a second rotation matrix in a second direction according to the third bending radian; a bend radius offset vector is determined based on the bounding box height, the second bend radian, and the first rotation matrix.
Optionally, determining a third curvature radius corresponding to each vertex based on the second curvature radius and the initial vertex local coordinates includes: obtaining a product of the second bending radian and a target parameter, wherein the target parameter is a parameter of the initial vertex local coordinate in a second direction; a third curvature arc is determined for the vertex, which is the first ratio of the product to the bounding box height.
Optionally, determining the bend radius based on the bounding box height, the second bend radian, and the first rotation matrix comprises: acquiring a second ratio of the height of the bounding box to a second bending radian, and determining the second ratio as the bending radius; determining that the bending radius and 0 element form an offset matrix; determining a matrix product of the offset matrix and the first rotation matrix as a bend radius offset vector.
Optionally, determining a third rotation matrix based on the first rotation matrix and the second rotation matrix comprises: obtaining a third matrix product of the first rotation matrix and the second rotation matrix; and replacing the displacement rows in the third matrix product with bending radius offset vectors to obtain a third rotation matrix.
According to another aspect of the embodiments of the present invention, there is also provided a vertex animation processing apparatus, including: the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a vertex animation texture of a model to be processed, and the vertex animation texture is used for indicating initial vertex local coordinates of vertexes with different indexes in different time frames; the processing module is used for carrying out deformation processing on each initial vertex local coordinate recorded in the vertex animation texture to obtain a deformed target vertex local coordinate; and the rendering module is used for rendering the model to be processed based on the local coordinates of the target vertex.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, including a stored program, where the program, when executed, controls a device on the computer-readable storage medium to perform any one of the above vertex animation processing methods.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to run a program, where the program executes a processing method of the vertex animation according to any one of the above items when the program runs.
In the embodiment of the invention, firstly, the vertex animation texture of the model to be processed is obtained, wherein the vertex animation texture is used for indicating initial vertex local coordinates of vertexes with different indexes in different time frames, then the local coordinates of each initial vertex recorded in the vertex animation texture are deformed to obtain the local coordinates of a target vertex after deformation, finally, the model to be processed is rendered based on the local coordinates of the target vertex, thereby realizing the deformation of the mesh body model, the information of the local coordinates of each initial vertex can be obtained by obtaining the vertex animation texture of the mesh body model, the local coordinates of the target vertex can be obtained by deforming the local coordinates of each initial vertex, the presentation mode of the mesh body model rendered by the local coordinates of the target vertex can be richer, and further, the problem that the local coordinates of each frame of the vertexes are limited by the vertex animation texture in the related technology is solved, leading to the technical problem that the grid model is difficult to be modified in real-time rendering.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow diagram of a method of processing vertex animations in accordance with an embodiment of the present invention;
FIG. 2 is a schematic diagram of a vertex animation texture according to an embodiment of the invention;
FIG. 3 is a schematic diagram illustrating a comparison between before and after the animation deformation of the particle vertex texture according to an embodiment of the invention;
FIG. 4 is a diagram of a vertex animation processing apparatus according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
There is thus provided, in accordance with an embodiment of the present invention, a method embodiment of processing of vertex animations, the steps illustrated in the flowchart of the accompanying drawings being executable by a computer system, such as a set of computer executable instructions, and wherein the logical order illustrated is in the flowchart, in some cases the steps illustrated or described may be executed out of order from that shown.
FIG. 1 is a method for processing vertex animation according to an embodiment of the present invention, as shown in FIG. 1, the method includes the following steps:
and S102, acquiring the vertex animation texture of the model to be processed.
Wherein the vertex animation texture is used to indicate initial vertex local coordinates of vertices of different indexes at different time frames.
The model to be processed may be a mesh model to be rendered.
The vertex animation is a key frame animation related to the vertices of the mesh body model, each vertex coordinate of the mesh body model is updated frame by frame, and the mesh body model is suitable for representing extremely complex physical motions such as fragmentation, particles, cloth, hair, water flow and the like.
In an alternative embodiment, the vertex animation texture is adopted to pre-encode the vertex animation information of the model to be processed into the texture and make a call in the real-time rendering stage. In which the vertex animation texture stores the coordinate information of the vertex at each frame, as shown in fig. 2, the row representation of the vertex animation texture represents the vertex index in a frame as a time unit, and, for example, the coordinate of the vertex with the index V0 at the F0 frame is recorded at the intersection of F0 and V0 in fig. 2. The three color channels of the vertex animation texture, i.e., the pixel red, green, and blue channels, are for the x, y, and z components of the corresponding vertex coordinates, respectively.
Furthermore, each vertex is associated with a texture coordinate to indicate from which part of the texture image the vertex is sampled, the process of obtaining texture color using the texture coordinate is called sampling, and the texture coordinate of each vertex of the model is mapped to a corresponding position, as shown in fig. 2, the texture coordinate with vertex index 0 is located at the intersection of F0 and V0, the texture coordinate with vertex index 1 is located at the intersection of F0 and V1, and so on, in the vertex coloring stage of real-time rendering, by transforming the row index of the vertex texture coordinate, the update of the vertex coordinate in each frame can be realized, and further, the vertex animation generated in advance by using the physical simulation technology can be restored; because the static model and the pre-generated animation data are called by the rendering program in real-time rendering, the physical simulation process is omitted, so that the limited computing resources can be saved, and the rendering overhead is greatly reduced.
The vertices store a series of basic elements of the attributes required for basic drawing, such as points in two-dimensional or three-dimensional space, or points on a curved surface. In a shader, elements connected to vertices are called primitives, regions within the primitives that should be colored are called fragments, and a collection of vertices is called a vertex group or vertex array. The vertex default contains attributes such as position, normal vector, color, second color, texture coordinate, etc., and more attributes can be added through shader programming.
The initial vertex local coordinates described above are coordinates of the vertex with respect to the local origin.
And step S104, performing deformation processing on each initial vertex local coordinate recorded in the vertex animation texture to obtain a deformed target vertex local coordinate.
In an alternative embodiment, the local coordinates of each initial vertex recorded in the vertex animation texture may be transformed through a transformation function, it should be noted that the transformation functions of the local coordinates of each initial vertex are the same, and the local coordinates of each initial vertex may be subjected to bending, spiral, and the like through the same transformation function, so as to obtain the local coordinates of the target vertex, thereby increasing the flexibility of the local coordinates of the vertices.
The above-mentioned deformation function may be represented by VtWhere s denotes the initial vertex local coordinates, Fn () denotes a deformation function, VtRepresenting the target vertex local coordinates.
And S106, rendering the model to be processed based on the local coordinates of the target vertex.
In an optional embodiment, the deformation effect of the model to be processed corresponding to the vertex in the image obtained by rendering the model to be processed based on the local coordinates of the target vertex is more abundant. If the initial vertex local coordinates are directly adopted to render the model to be processed, although the vertex texture animation technology can express various complex particle motion effects such as turbulence particles, the interactive animation effect can not be made according to dynamic parameters during real-time rendering, so that only simple translation, rotation or scaling can be performed; and the model to be processed is rendered by adopting the local coordinates of the target vertex, so that the model to be processed corresponding to the vertex can achieve the effects of bending, spiral and the like in the real-time rendering process, and the deformation effect is more flexible and richer.
Illustratively, as shown in FIG. 3, which is a schematic diagram of the comparison before and after the bending deformation of the texture animation of the particle vertex, in the vertex shading stage, the existing method generally reads the local coordinate information of the vertex from the vertex animation texture, then directly changes into the world space, thereby forming a section of animation effect, but because the local coordinates are fixed, if the effect is played repeatedly, the viewer may experience a repetitive sensation and some interactive effects may not be made, for example, the moving direction of the aquatic weeds is changed according to the wind direction, and in the scheme, for the example that the preset animation effect is a segment of vertically-rising particles or has turbulent motion characteristics and the like, the particles can be made to change correspondingly according to the wind direction so as to show the flexibility and richness of the picture, wherein the particles can be animation effects of sand, snow and insect cluster waiting processing models.
It should be noted that a single particle is a camera-facing square polygon patch mesh model, which includes four vertices sharing the same pixel value in the vertex animation texture, that is, having the same local coordinate value.
In another alternative embodiment, the model to be processed may be rendered in real time based on the target vertex local coordinates to render a dynamic image.
The real-time rendering may be that the data of each frame of the computer is rendered into a frame and then displayed on the screen, and the data of each frame is constantly changed, so that the frame of each frame is displayed constantly.
In another alternative embodiment, the model to be processed may be rendered offline based on the local coordinates of the target vertices, so as to present an image with a fine quality. It can be applied to movies or CGs (Computer Graphics) that do not require human-Computer interaction and require high screen refinement.
The off-line rendering is to render all future pictures in advance and then perform a frame switching.
In the embodiment, firstly, the vertex animation texture of the model to be processed is obtained, wherein the vertex animation texture is used for indicating initial vertex local coordinates of vertexes with different indexes in different time frames, then the local coordinates of each initial vertex recorded in the vertex animation texture are subjected to deformation processing to obtain the local coordinates of a target vertex after deformation, and finally the model to be processed is rendered based on the local coordinates of the target vertex to realize the deformation of the mesh body model, the information of the local coordinates of each initial vertex can be obtained by obtaining the vertex animation texture of the mesh body model, the local coordinates of the target vertex can be obtained by deforming the local coordinates of each initial vertex, so that the presentation mode of the mesh body model rendered by the local coordinates of the target vertex can be richer, and further the problem that the local coordinates of each frame of the vertexes are limited by the vertex animation texture in the related technology is solved, leading to the technical problem that the grid model is difficult to be modified in real-time rendering.
Optionally, the deforming process is performed on each initial vertex local coordinate recorded in the vertex animation texture, and includes: acquiring the type of deformation processing, wherein the different types of deformation processing respectively correspond to different deformation functions; calling a corresponding deformation function based on the type of deformation processing; and carrying out deformation processing on each initial vertex local coordinate recorded in the vertex animation texture based on the deformation function.
The type of deformation process described above is bending, spiraling or otherwise.
In an optional embodiment, deformation functions corresponding to different types of deformation processing may be constructed in advance, and identification information may be set for the deformation functions corresponding to the deformation processing according to the type of the deformation processing, so that in the process of performing the deformation processing on the local coordinates of each initial vertex, the deformation functions corresponding to the different types of deformation processing may be quickly called through the identification information, so that the deformation processing is performed on the local coordinates of each initial vertex recorded in the vertex animation texture through the deformation functions.
Optionally, the type of the deformation processing is bending, and the deformation processing is performed on each initial vertex local coordinate recorded in the vertex animation texture based on a deformation function to obtain a deformed target vertex local coordinate, where the method includes: obtaining a bending radius offset vector, a first rotation matrix in a first direction and a second rotation matrix in a second direction, wherein the first direction and the second direction are perpendicular to each other; obtaining a matrix difference value obtained by subtracting a bending radius offset vector from an initial vertex local coordinate; obtaining a first matrix product of the matrix difference value and an inverse matrix of the first rotation matrix, and determining a third rotation matrix based on the first rotation matrix and the second rotation matrix; and determining a second matrix product of the first matrix product and the third rotation matrix as the local coordinates of the target vertex.
The bending radius offset vector is used to offset displacement caused by bending, and may be specifically expressed as:
wherein beta is a bending radian, y is a vertex y coordinate of the model to be processed in a preset coordinate system, and h is the height of the bounding box of the model to be processed.
In an alternative embodiment, the preset coordinate system may be established using a right-hand rule, wherein the right hand may be placed back to the screen, the direction pointed by the thumb is the positive direction of the X-axis, the index finger and the middle finger are extended, the direction pointed by the index finger is the positive direction of the Y-axis, and the direction pointed by the middle finger is the positive direction of the Z-axis.
In an alternative embodiment, the target vertex corresponding to the local coordinates of the initial vertex to be deformed is in a predetermined coordinate system in the Y-axis direction. The first direction may be a positive direction of an X axis of the preset coordinate system, and the second direction may be a positive direction of a Z axis of the preset coordinate system.
The first rotation matrix M of the preset coordinate system in the positive direction of the X axisyCan be expressed as:
and the initial vertex local coordinate and the target vertex local coordinate respectively correspond to the model to be processed before deformation and the model to be processed after deformation.
Note that θ may be a dynamic parameter that changes in real time according to actual conditions.
The second rotation matrix M of the preset coordinate system in the positive direction of the Z axiszCan be expressed as:
wherein α is defined asBeta is the bending radian, y is the y parameter of the initial vertex local coordinate of the model to be processed in the preset coordinate system, and h is the height of the bounding box of the model to be processed.
It should be noted that the larger the y value is, the larger the degree of bending of the model to be processed around the Z axis is; when the y value is 0, the model to be processed does not rotate around the Z axis, and when the y value is equal to the height value of the model to be processed, the rotation degree of the model around the Z axis is the highest.
In an alternative embodiment, the matrix difference of the initial vertex local coordinates minus the bending radius may be obtained and expressed as V-RO, where V is the projected coordinates of the initial vertex local coordinates on the horizontal plane, i.e., the components on the X-axis and the Z-axis are constant, the Y-component is equal to 0, and RO is the bending radius offset vector.
Further, a first matrix product of the matrix difference value and an inverse of the first rotation matrix may be obtained, and may be usedIt is shown that, among others,an inverse of the first rotation matrix is represented.
The third rotation matrix may be represented by TM, where TM ═ Mz·MyThe third rotation matrix may also be referred to as a bending matrix.
It should be noted that RO may be used as the fourth row of the third rotation matrix to offset the displacement caused by the curvature of the model to be processed.
Further, a second matrix product of the first matrix product and the third rotation matrix may be determined, wherein the second matrix product may be usedAnd (4) showing. And the second matrix product is used as the deformed local coordinate of the target vertex, and the model to be processed is rendered by using the local coordinate of the target vertex, so that the change of the model to be processed in the obtained image has more flexibility.
Optionally, obtaining the bend radius offset vector, a first rotation matrix in a first direction, and a second rotation matrix in a second direction includes: obtaining bending parameters, wherein the bending parameters comprise: a first curvature radian in a first direction, a second curvature radian in a second direction and the height of a bounding box of the model to be processed; acquiring a first rotation matrix based on the first bending radian; determining a third bending radian corresponding to each vertex based on the second bending radian and the initial vertex local coordinates, and acquiring a second rotation matrix in a second direction according to the third bending radian; a bend radius offset vector is determined based on the bounding box height, the second bend radian, and the first rotation matrix.
The bending parameters can be expressed by theta, beta and h, wherein theta is expressed as a first bending radian in the positive direction of an X axis of a preset coordinate system, beta is expressed as a second bending radian in the positive direction of a Z axis of the preset coordinate system, and h is expressed as the height of a bounding box of the model to be processed.
In an alternative embodiment, the first rotation matrix may be determined by determining a sine function and a cosine function of the first bend arc.
In another alternative embodiment, the third curvature α corresponding to each vertex can be determined according to the second curvature and the initial vertex coordinates, and can be expressed as:
and determining a second rotation matrix in the positive direction of the Z axis of the preset coordinate system through the sine function and the cosine function of the third bending radian.
In another alternative embodiment, the first rotation matrix M may be based on the bounding box height h, the second curvature radian β and the first rotation matrixyDetermining the bend radius offset vector RO may be expressed as:
optionally, determining a third curvature radius corresponding to each vertex based on the second curvature radius and the initial vertex local coordinates includes: obtaining a product of the second bending radian and a target parameter, wherein the target parameter is a parameter of the initial vertex local coordinate in a second direction; a third curvature arc is determined for the vertex, which is the first ratio of the product to the bounding box height.
In an alternative embodiment, a product of the second curvature and a target parameter, denoted as β y, may be obtained, where the target parameter y is the initial vertex local coordinate at a preset valueParameters of the positive direction of the Z axis of the coordinate system; a first ratio of the product to the bounding box height, expressed asAnd determining the first ratio as a third curvature.
Optionally, determining a bend radius offset vector based on the bounding box height, the second bend radian, and the first rotation matrix comprises: acquiring a second ratio of the height of the bounding box to a second bending radian, and determining the second ratio as the bending radius; determining that the bending radius and 0 element form an offset matrix; determining a matrix product of the offset matrix and the first rotation matrix as a bend radius offset vector.
In an alternative embodiment, the radius of curvature may be obtained by taking a second ratio of the bounding box height to a second arc of curvature, which may be expressed asAnd determining the bending radius to form an offset matrix with 0 element, wherein the offset matrix is used for offsetting displacement generated by bending and is expressed asA matrix product of the offset matrix and the first rotation matrix is then obtained, expressed asAnd determines the matrix product as the bend radius offset vector.
Optionally, determining a third rotation matrix based on the first rotation matrix and the second rotation matrix comprises: obtaining a third matrix product of the first rotation matrix and the second rotation matrix; and replacing the displacement row in the product of the third matrix with a bending radius offset vector to obtain a third rotation matrix, wherein the displacement row is the fourth row of the third rotation matrix and is used for offsetting the displacement generated by bending the model to be processed.
In an alternative embodiment, a third matrix product of the first rotation matrix and the second rotation matrix may be obtained, and TM ═ may be usedMz·MyAnd replacing the displacement rows in the product of the third matrix with bending radius offset vectors RO to offset the displacement generated by the bending of the model to be processed, so that the obtained third rotation matrix is more accurate.
It should be noted that, in the process of deforming the initial local vertex, if the displacement row in the third matrix product is not replaced by the bending radius offset vector, the deformed target local vertex may generate a part of displacement, so as to affect the final effect of the model to be processed; if the displacement row in the third matrix product is replaced by the bending radius offset vector, the displacement generated by bending in the model to be processed can be offset, so that the effect of the model to be processed which is finally presented is prevented from being influenced.
Example 2
According to the embodiment of the present invention, a vertex animation processing apparatus is further provided, and the apparatus may execute the vertex animation processing method in the foregoing embodiment, and a specific implementation manner and a preferred application scenario are the same as those in the foregoing embodiment, and are not described herein again.
Fig. 4 is a schematic diagram of a vertex animation processing apparatus according to an embodiment of the present invention, as shown in fig. 4, the apparatus including:
an obtaining module 42, configured to obtain a vertex animation texture of the model to be processed, where the vertex animation texture is used to indicate initial vertex local coordinates of vertices with different indexes in different time frames;
the processing module 44 is configured to perform deformation processing on each initial vertex local coordinate recorded in the vertex animation texture to obtain a deformed target vertex local coordinate;
and a rendering module 46, configured to render the model to be processed based on the target vertex local coordinates.
Optionally, the processing module comprises: the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the type of deformation processing, and the different types of deformation processing respectively correspond to different deformation functions; the calling unit is used for calling the corresponding deformation function based on the type of deformation processing; and the processing unit is used for carrying out deformation processing on each initial vertex local coordinate recorded in the vertex animation texture based on the deformation function.
Optionally, the deformation processing type is bending, and the processing unit includes: the device comprises an acquisition subunit, a processing unit and a control unit, wherein the acquisition subunit is used for acquiring a bending radius offset vector, a first rotation matrix in a first direction and a second rotation matrix in a second direction, and the first direction and the second direction are vertical to each other; the obtaining subunit is further configured to obtain a matrix difference value obtained by subtracting the bending radius offset vector from the initial vertex local coordinate; the obtaining subunit is further configured to obtain a first matrix product of the matrix difference and an inverse matrix of the first rotation matrix, and determine a third rotation matrix based on the first rotation matrix and the second rotation matrix; and the determining subunit is used for determining that a second matrix product of the first matrix product and the third rotation matrix is the local coordinates of the target vertex.
Optionally, the obtaining subunit is further configured to obtain a bending parameter, where the bending parameter includes: a first curvature radian in a first direction, a second curvature radian in a second direction and the height of a bounding box of the model to be processed; the obtaining subunit is further configured to obtain a first rotation matrix based on the first curvature radian; the obtaining subunit is further configured to determine a third curvature corresponding to each vertex based on the second curvature and the initial vertex local coordinate, and obtain a second rotation matrix in the second direction according to the third curvature; the acquisition subunit is further configured to determine a bend radius offset vector based on the bounding box height, the second bend radian, and the first rotation matrix.
Optionally, the obtaining subunit is further configured to obtain a product of the second curvature radian and a target parameter, where the target parameter is a parameter of the initial vertex local coordinate in the second direction; the obtaining subunit is further configured to determine a third curvature corresponding to the vertex as the first ratio of the product to the bounding box height.
Optionally, the obtaining subunit is further configured to obtain a second ratio of the bounding box height to a second curvature radian, and determine the second ratio as the bending radius; determining that the bending radius and 0 element form an offset matrix; the acquisition subunit is further configured to determine a bending radius as a matrix product of the offset matrix and the first rotation matrix.
Optionally, the obtaining subunit is further configured to obtain a third matrix product of the first rotation matrix and the second rotation matrix; the obtaining subunit is further configured to replace the displacement row in the third matrix product with the bending radius offset vector, so as to obtain a third rotation matrix.
Example 3
According to an embodiment of the present invention, there is also provided a storage medium, where the storage medium includes a stored program, and when the program runs, the apparatus where the computer-readable storage medium is controlled to execute the processing method of the vertex animation in the above embodiment 1.
Example 4
According to an embodiment of the present invention, there is further provided a processor, configured to run a program, where the program executes the vertex animation processing method in embodiment 1.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.
Claims (10)
1. A vertex animation processing method is characterized by comprising the following steps:
obtaining a vertex animation texture of a model to be processed, wherein the vertex animation texture is used for indicating initial vertex local coordinates of vertexes with different indexes in different time frames;
performing deformation processing on each initial vertex local coordinate recorded in the vertex animation texture to obtain a deformed target vertex local coordinate;
and rendering the model to be processed based on the target vertex local coordinates.
2. The method of claim 1, wherein morphing each initial vertex local coordinate recorded in the vertex animation texture comprises:
acquiring the type of the deformation processing, wherein the different types of deformation processing respectively correspond to different deformation functions;
calling a corresponding deformation function based on the type of the deformation processing;
and carrying out deformation processing on each initial vertex local coordinate recorded in the vertex animation texture based on the deformation function.
3. The method according to claim 2, wherein the type of the morphing process is warping, and the morphing process is performed on each initial vertex local coordinate recorded in the vertex animation texture based on the morphing function to obtain a morphed target vertex local coordinate, and the method comprises:
obtaining a bending radius offset vector, a first rotation matrix in a first direction and a second rotation matrix in a second direction, wherein the first direction and the second direction are perpendicular to each other;
obtaining a matrix difference value obtained by subtracting the bending radius offset vector from the initial vertex local coordinate;
obtaining a first matrix product of the matrix difference value and an inverse matrix of the first rotation matrix, and determining a third rotation matrix based on the first rotation matrix and the second rotation matrix;
and determining a second matrix product of the first matrix product and the third rotation matrix as the local coordinates of the target vertex.
4. The method of claim 3, wherein obtaining a bend radius offset vector, a first rotation matrix in a first direction, and a second rotation matrix in a second direction comprises:
obtaining bending parameters, wherein the bending parameters comprise: a first curvature in the first direction, a second curvature in the second direction, and a bounding box height of the model to be processed;
obtaining the first rotation matrix based on the first curvature radian;
determining a third bending radian corresponding to each vertex based on the second bending radian and the initial vertex local coordinates, and acquiring a second rotation matrix in the second direction according to the third bending radian;
determining the bend radius offset vector based on the bounding box height, the second bend radian, and the first rotation matrix.
5. The method of claim 4, wherein determining a third curvature for each vertex based on the second curvature and the initial vertex local coordinates comprises:
obtaining a product of the second bending radian and a target parameter, wherein the target parameter is a parameter of the initial vertex local coordinate in the second direction;
and determining a third curvature radian corresponding to the vertex as the first ratio of the product to the height of the bounding box.
6. The method of claim 4, wherein determining a bend radius offset vector based on the bounding box height, the second degree of curvature, and the first rotation matrix comprises:
acquiring a second ratio of the height of the bounding box to the second bending radian, and determining the second ratio as the bending radius;
determining that the bending radius and 0 element form an offset matrix;
determining a matrix product of the offset matrix and the first rotation matrix as the bend radius offset vector.
7. The method of claim 3, wherein determining a third rotation matrix based on the first rotation matrix and the second rotation matrix comprises:
obtaining a third matrix product of the first rotation matrix and the second rotation matrix;
and replacing the displacement row in the third matrix product with the bending radius offset vector to obtain a third rotation matrix.
8. A vertex animation processing apparatus, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a vertex animation texture of a model to be processed, and the vertex animation texture is used for indicating initial vertex local coordinates of vertexes with different indexes in different time frames;
the processing module is used for carrying out deformation processing on each initial vertex local coordinate recorded in the vertex animation texture to obtain a deformed target vertex local coordinate;
and the rendering module is used for rendering the model to be processed based on the local coordinates of the target vertex.
9. A storage medium, characterized in that the storage medium includes a stored program, wherein, when the program runs, a device in which the storage medium is located is controlled to execute the processing method of the vertex animation according to any one of claims 1 to 7.
10. A processor, configured to run a program, wherein the program is configured to execute the vertex animation processing method according to any one of claims 1 to 7 when the program is run.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110712859.5A CN113450435A (en) | 2021-06-25 | 2021-06-25 | Vertex animation processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110712859.5A CN113450435A (en) | 2021-06-25 | 2021-06-25 | Vertex animation processing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113450435A true CN113450435A (en) | 2021-09-28 |
Family
ID=77812960
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110712859.5A Pending CN113450435A (en) | 2021-06-25 | 2021-06-25 | Vertex animation processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113450435A (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101071514A (en) * | 2006-05-12 | 2007-11-14 | 中国科学院自动化研究所 | Method for directly transferring three-dimensional model attitude |
CN101794462A (en) * | 2010-03-12 | 2010-08-04 | 中山大学 | Three-dimensional grid model deformation method and system based on texture |
US20120154409A1 (en) * | 2010-12-15 | 2012-06-21 | Microsoft Corporation | Vertex-baked three-dimensional animation augmentation |
US20160133040A1 (en) * | 2014-11-10 | 2016-05-12 | Disney Enterprises, Inc. | Simulation and skinning of heterogeneous texture detail deformation |
CN107316337A (en) * | 2016-04-20 | 2017-11-03 | 网易(杭州)网络有限公司 | The processing method and processing device of vertex normal |
CN111369649A (en) * | 2018-12-26 | 2020-07-03 | 苏州笛卡测试技术有限公司 | Method for making computer skin animation based on high-precision three-dimensional scanning model |
CN111968236A (en) * | 2020-07-17 | 2020-11-20 | 哈尔滨理工大学 | K-D tree method-based contraposition to line fracture reduction system |
CN112652044A (en) * | 2021-01-05 | 2021-04-13 | 网易(杭州)网络有限公司 | Particle special effect rendering method, device and equipment and storage medium |
CN112933597A (en) * | 2021-03-16 | 2021-06-11 | 腾讯科技(深圳)有限公司 | Image processing method, image processing device, computer equipment and storage medium |
-
2021
- 2021-06-25 CN CN202110712859.5A patent/CN113450435A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101071514A (en) * | 2006-05-12 | 2007-11-14 | 中国科学院自动化研究所 | Method for directly transferring three-dimensional model attitude |
CN101794462A (en) * | 2010-03-12 | 2010-08-04 | 中山大学 | Three-dimensional grid model deformation method and system based on texture |
US20120154409A1 (en) * | 2010-12-15 | 2012-06-21 | Microsoft Corporation | Vertex-baked three-dimensional animation augmentation |
US20160133040A1 (en) * | 2014-11-10 | 2016-05-12 | Disney Enterprises, Inc. | Simulation and skinning of heterogeneous texture detail deformation |
CN107316337A (en) * | 2016-04-20 | 2017-11-03 | 网易(杭州)网络有限公司 | The processing method and processing device of vertex normal |
CN111369649A (en) * | 2018-12-26 | 2020-07-03 | 苏州笛卡测试技术有限公司 | Method for making computer skin animation based on high-precision three-dimensional scanning model |
CN111968236A (en) * | 2020-07-17 | 2020-11-20 | 哈尔滨理工大学 | K-D tree method-based contraposition to line fracture reduction system |
CN112652044A (en) * | 2021-01-05 | 2021-04-13 | 网易(杭州)网络有限公司 | Particle special effect rendering method, device and equipment and storage medium |
CN112933597A (en) * | 2021-03-16 | 2021-06-11 | 腾讯科技(深圳)有限公司 | Image processing method, image processing device, computer equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
何青等: "虚拟人骨架驱动皮肤变形的改进的热平衡法", 《计算机仿真》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6559849B1 (en) | Animation of linear items | |
US10540817B2 (en) | System and method for creating a full head 3D morphable model | |
Litwinowicz et al. | Animating images with drawings | |
CN108351864A (en) | At recessed geometry Mi Pu | |
US5758046A (en) | Method and apparatus for creating lifelike digital representations of hair and other fine-grained images | |
Chen et al. | A system of 3d hair style synthesis based on the wisp model | |
US8884947B2 (en) | Image processing apparatus and image processing method | |
US20050210994A1 (en) | Volumetric hair rendering | |
CN105453139A (en) | Sparse GPU voxelization for 3D surface reconstruction | |
CN110766777A (en) | Virtual image generation method and device, electronic equipment and storage medium | |
EP1986158B1 (en) | Decorating computer generated character with surface attached features | |
JP2022524891A (en) | Image processing methods and equipment, electronic devices and computer programs | |
US20140085312A1 (en) | Seamless fracture in a production pipeline | |
CN108629834A (en) | A kind of three-dimensional hair method for reconstructing based on single picture | |
EP1986157B1 (en) | Placing skin-attached features on a computer generated character | |
CN108447111B (en) | Normal map processing method and device, storage medium, processor and terminal | |
CN108197555B (en) | Real-time face fusion method based on face tracking | |
CN109151540A (en) | The interaction processing method and device of video image | |
CN113450435A (en) | Vertex animation processing method and device | |
US11010952B1 (en) | Method and user interface for generating tangent vector fields usable for generating computer-generated imagery | |
US8009171B2 (en) | Image processing apparatus and method, and program | |
Pawaskar et al. | Expression transfer: A system to build 3D blend shapes for facial animation | |
Xu et al. | Adaptive multi-resolution fitting and its application to realistic head modeling | |
Zhang et al. | Integrated image and graphics technologies | |
CN115686202A (en) | Three-dimensional model interactive rendering method across Unity/Optix platform |
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 |