Animation generation method, device, electronic device and storage medium
By determining the vertices to be fused in animation generation and fusing positions and normals, combined with the secondary fusion of user-guided maps, the problems of color exceptions and time-consuming in animation generation are solved, and efficient animation generation is achieved.
Patent Information
- Application Number
- CN202111349319.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2041-11-15
AI Technical Summary
When generating animations, direct fusion of normals of mixed shapes will lead to color exceptions, and the prior art requires position and normals to be fused to all vertices, resulting in large and long calculations.
By obtaining the target object model, determine the vertices to be fused with the position and normal, and use the fusion weight to fuse the position and normal of the vertices, calculate the normal of each vertex, and use the user guide diagram to perform quadratic fusion of the normal results. , to generate target animation.
Fixed color abnormalities caused by direct fusion of normals, reducing calculation amount, saving fusion time and improving fusion efficiency.
Smart Images

Figure CN114119820B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to image processing technology, and in particular to an animation generation method, device, electronic device and storage medium. Background Art
[0002] When generating animations, you can use blend shapes (BlendShape). Blend shapes are a type of technology that represents animations in computers, that is, the fusion of shapes. It allows a single model to deform to several predefined target states, and can smoothly transition between target states to produce animation effects. Blend shapes are often used to implement facial animations. For example, Animoji captures facial expressions through a camera and converts them into a set of expression coefficients to drive the blend shapes of virtual characters, thereby achieving fascinating and interesting animation effects. When generating animations, it is generally necessary to fuse shapes. At this time, the geometric properties of the blend shapes, such as position, normal, etc., need to be fused to determine the geometric information of the target state.
[0003] When generating an animation, it is necessary to traverse each blend shape state and fuse the position and normal recorded by each vertex according to its weighted coefficient to obtain the fused target state. Directly fusing normals at the place where the shape patch is folded in the blend shape will cause anomalies, causing the generated animation to produce color mutations. Designers need to spend a lot of time and energy to modify it to avoid color anomalies. Summary of the invention
[0004] The present disclosure provides an animation generation method, device, electronic device and storage medium to at least solve the problems of abnormal color and long time consumption of generated animation in the related art. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, there is provided an animation generation method, comprising:
[0006] Acquire a target object model corresponding to the animation to be generated, wherein the target object model includes a reference state of the target object, a target state, a user guidance map corresponding to the target state, and a model topological relationship, wherein the reference state includes a reference position and a reference normal corresponding to a vertex of the target object, wherein the target state includes a target position, a target normal, and a fusion weight of the vertex, wherein the user guidance map is used to characterize a normal blending coefficient of each vertex, and wherein the fusion weight is a weight used when performing position fusion and normal fusion;
[0007] Determine, according to the reference position and the target position, the vertex to be subjected to position fusion in the target state, and, according to the reference normal and the target normal, determine the vertex to be subjected to normal fusion in the target state;
[0008] Using the fusion weights, position fusion is performed on the vertices to be positionally fused in the target state to obtain a position fusion result corresponding to the target state, and normal fusion is performed on the vertices to be normal fused in the target state to obtain a normal fusion result corresponding to the target state;
[0009] Calculate the normal of each vertex in the target state according to the position fusion result and the model topological relationship to obtain the normal calculation result in the target state;
[0010] Using the user guidance map corresponding to the target state, the normal calculation result and the normal fusion result are fused to obtain a normal secondary fusion result corresponding to the target state;
[0011] A target animation is generated according to the position fusion result and the normal secondary fusion result.
[0012] Optionally, determining, according to the reference position and the target position, a vertex to be positionally fused in the target state includes:
[0013] Determining a vertex offset distance of a vertex in the target state relative to the same vertex in the reference state according to a reference position and a target position of the same vertex in the reference state and the target state;
[0014] The vertices whose vertex offset distances are greater than a first distance threshold are determined as vertices to be positionally fused in the target state.
[0015] Optionally, determining, according to the reference normal and the target normal, vertices to be subjected to normal fusion in the target state includes:
[0016] Determine, based on a reference normal and a target normal of the same vertex in the reference state and the target state, a normal offset distance of a target normal of the vertex in the target state relative to a reference normal of the same vertex in the reference state;
[0017] The vertices whose normal offset distance is greater than a second distance threshold are determined as vertices to be subjected to normal fusion in the target state.
[0018] Optionally, using the fusion weight, position fusion is performed on the vertices to be position fused in the target state to obtain a position fusion result corresponding to the target state, including:
[0019] After determining the vertices to be positionally fused in the target state, generating a position guidance graph, and using a first preset value in the position guidance graph to represent the vertices to be positionally fused in the target state, and using a second preset value to represent the vertices that do not need to be positionally fused in the target state;
[0020] The fusion weights of the vertices in the target state are used to perform weighted summation on the target position and the reference position corresponding to the vertices whose values in the position guidance graph are the first preset values, so as to obtain a position fusion result corresponding to the target state.
[0021] Optionally, performing normal fusion on vertices to be normal fused in the target state to obtain a normal fusion result corresponding to the target state includes:
[0022] After determining the vertices to be subjected to normal fusion in the target state, generating a normal guide map, and using a third preset value in the normal guide map to represent the vertices to be subjected to normal fusion in the target state, and using a fourth preset value to represent the vertices that do not need to be subjected to normal fusion in the target state;
[0023] The fusion weights of the vertices in the target state are used to perform weighted summation on the target normals and the reference normals corresponding to the vertices whose values in the normal guide map are the third preset values, so as to obtain a normal fusion result corresponding to the target state.
[0024] Optionally, calculating the normal of each vertex in the target state according to the position fusion result and the model topological relationship to obtain the normal calculation result in the target state includes:
[0025] For an i-th vertex in the position fusion result, when a normal blending coefficient of the i-th vertex is greater than 0, determining an adjacent triangle of the i-th vertex according to the position fusion result and the model topological relationship;
[0026] Perform a vector cross product calculation on the position difference vectors of the other two vertices in each of the adjacent triangles and the i-th vertex to obtain a vector cross product result, and sum the vector cross product results of each of the adjacent triangles to obtain a normal calculation result of the i-th vertex, where i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
[0027] Optionally, using a user guidance map corresponding to the target state, the normal calculation result and the normal fusion result are fused to obtain a normal secondary fusion result corresponding to the target state, including:
[0028] Determine the weight of the normal calculation result corresponding to the i-th vertex according to the normal blending coefficient corresponding to the i-th vertex, and determine the weight of the normal fusion result corresponding to the i-th vertex;
[0029] According to the weight of the normal calculation result corresponding to the i-th vertex and the weight of the normal fusion result, the normal calculation result and the normal fusion result of the i-th vertex are weighted summed to obtain the normal secondary fusion result of the i-th vertex, where i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
[0030] Optionally, determining the weight of the normal calculation result corresponding to the i-th vertex according to the normal blending coefficient corresponding to the i-th vertex, and determining the weight of the normal fusion result corresponding to the i-th vertex, includes:
[0031] The normal blending coefficient corresponding to the i-th vertex is determined as the weight of the normal calculation result corresponding to the i-th vertex, and the difference between 1 and the normal blending coefficient of the i-th vertex is determined as the weight of the normal fusion result corresponding to the i-th vertex.
[0032] According to a second aspect of an embodiment of the present disclosure, there is provided an animation generating device, comprising:
[0033] An acquisition module is configured to acquire a target object model corresponding to the animation to be generated, wherein the target object model includes a reference state of the target object, a target state, a user guidance map corresponding to the target state, and a model topological relationship, wherein the reference state includes a reference position and a reference normal corresponding to a vertex of the target object, wherein the target state includes a target position, a target normal, and a fusion weight of the vertex, wherein the user guidance map is used to characterize a normal blending coefficient of each vertex, and wherein the fusion weight is a weight used when performing position fusion and normal fusion;
[0034] a module for determining data to be fused, configured to determine vertices to be fused in position in the target state according to the reference position and the target position, and to determine vertices to be fused in normal in the target state according to the reference normal and the target normal;
[0035] a fusion module configured to perform position fusion on the vertices to be positionally fused in the target state using the fusion weights to obtain a position fusion result corresponding to the target state, and to perform normal fusion on the vertices to be normal fused in the target state to obtain a normal fusion result corresponding to the target state;
[0036] A normal calculation module is configured to calculate the normal of each vertex in the target state according to the position fusion result and the model topological relationship, so as to obtain a normal calculation result in the target state;
[0037] A normal secondary fusion module is configured to use the user guidance map corresponding to the target state to fuse the normal calculation result and the normal fusion result to obtain a normal secondary fusion result corresponding to the target state;
[0038] The animation generation module is configured to generate a target animation according to the position fusion result and the normal secondary fusion result.
[0039] Optionally, the module for determining the data to be fused includes:
[0040] a vertex offset determining unit configured to determine a vertex offset distance of a vertex in the target state relative to the same vertex in the reference state according to a reference position and a target position of the same vertex in the reference state and the target state;
[0041] The position fusion vertex determination unit is configured to determine the vertices whose vertex offset distance is greater than a first distance threshold as vertices to be positionally fused in the target state.
[0042] Optionally, the module for determining the data to be fused includes:
[0043] a normal offset determining unit configured to determine a normal offset distance of a target normal of a vertex in the target state relative to a reference normal of the same vertex in the reference state based on a reference normal and a target normal of the same vertex in the reference state and the target state;
[0044] The normal fusion vertex determination unit is configured to determine the vertices whose normal offset distance is greater than a second distance threshold as vertices to be subjected to normal fusion in the target state.
[0045] Optionally, the fusion module includes:
[0046] a position guidance map determining unit, configured to generate a position guidance map after determining the vertices to be positionally fused in the target state, and to represent the vertices to be positionally fused in the target state with a first preset value in the position guidance map, and to represent the vertices that do not need to be positionally fused in the target state with a second preset value;
[0047] The vertex fusion unit is configured to perform weighted summation of the target position and the reference position corresponding to the vertex whose value in the position guidance graph is the first preset value using the fusion weight of the vertex in the target state, so as to obtain the position fusion result corresponding to the target state.
[0048] Optionally, the fusion module includes:
[0049] a normal guide map determining unit configured to generate a normal guide map after determining the vertices to be subjected to normal fusion in the target state, and to represent the vertices to be subjected to normal fusion in the target state with a third preset value in the normal guide map, and to represent the vertices that do not need to be subjected to normal fusion in the target state with a fourth preset value;
[0050] The normal fusion unit is configured to perform weighted summation of the target normal and the reference normal corresponding to the vertex with a third preset value in the normal guidance map using the fusion weights of the vertices in the target state to obtain a normal fusion result corresponding to the target state.
[0051] Optionally, the normal calculation module includes:
[0052] an adjacent triangle determining unit, configured to determine, for an i-th vertex in the position fusion result, an adjacent triangle of the i-th vertex according to the position fusion result and the model topological relationship when a normal blending coefficient of the i-th vertex is greater than 0;
[0053] The normal calculation unit is configured to perform a vector cross product calculation on the position difference vectors of the other two vertices in each of the adjacent triangles and the i-th vertex to obtain a vector cross product result, and sum the vector cross product results of each of the adjacent triangles to obtain a normal calculation result of the i-th vertex, wherein i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
[0054] Optionally, the normal secondary fusion module includes:
[0055] A weight determination unit, configured to determine the weight of the normal calculation result corresponding to the i-th vertex according to the normal blending coefficient corresponding to the i-th vertex, and determine the weight of the normal fusion result corresponding to the i-th vertex;
[0056] The secondary fusion unit is configured to perform weighted summation of the normal calculation result and the normal fusion result of the i-th vertex according to the weight of the normal calculation result corresponding to the i-th vertex and the weight of the normal fusion result, so as to obtain the secondary fusion result of the normal of the i-th vertex, wherein i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
[0057] Optionally, the weight determination unit is configured to execute:
[0058] The normal blending coefficient corresponding to the i-th vertex is determined as the weight of the normal calculation result corresponding to the i-th vertex, and the difference between 1 and the normal blending coefficient of the i-th vertex is determined as the weight of the normal fusion result corresponding to the i-th vertex.
[0059] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0060] processor;
[0061] a memory for storing instructions executable by the processor;
[0062] The processor is configured to execute the instructions to implement the animation generation method as described in the first aspect.
[0063] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer storage medium are executed by a processor of an electronic device, the electronic device can execute the animation generation method as described in the first aspect.
[0064] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program or computer instructions, which implement the animation generation method described in the first aspect when executed by a processor.
[0065] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0066] The disclosed embodiment determines, after acquiring the target object model to be animated, vertices to be subjected to position fusion based on the reference positions and target positions of the vertices of the target object, and determines multiple vertices to be subjected to normal fusion based on the reference normals and target normals of the vertices, performs position fusion on the vertices to be subjected to position fusion in the target state according to the fusion weights of the multiple vertices to obtain a position fusion result, performs normal fusion on the vertices to be subjected to normal fusion in the target state to obtain a normal fusion result, calculates the normal of each vertex according to the position fusion result and the topological relationship of the model to obtain a normal calculation result, and uses a user guidance map corresponding to the target state to calculate the normal calculation result. The position fusion result is fused with the normal fusion result to obtain the normal secondary fusion result, and the target animation is generated according to the position fusion result and the normal secondary fusion result. Since the normal calculation result can be calculated based on the position fusion result and the model topological relationship, and the normal calculation result and the normal fusion result are fused, the color anomaly caused by direct normal fusion can be corrected, thereby solving the color anomaly problem caused by normal fusion. Moreover, only the position fusion needs to be performed on the vertices to be subjected to position fusion and the normal fusion needs to be performed on the vertices to be subjected to normal fusion. Compared with performing position fusion and normal fusion on all vertices, the amount of calculation is reduced, thereby saving fusion time and improving fusion efficiency.
[0067] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0069] Figure 1 is a flow chart of an animation generation method according to an exemplary embodiment;
[0070] Figure 2 is an overall flow chart of the animation generation method in the embodiment of the present disclosure;
[0071] Figure 3 is a block diagram of an animation generating device according to an exemplary embodiment;
[0072] Figure 4 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0073] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0074] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0075] Figure 1 is a flowchart of an animation generation method according to an exemplary embodiment. Figure 1 As shown, the animation generation method is used in electronic devices such as mobile phones, computers, and tablet computers, and includes the following steps.
[0076] In step S11, a target object model corresponding to the animation to be generated is obtained, wherein the target object model includes a reference state, a target state, a user guidance map corresponding to the target state, and a model topological relationship of the target object, wherein the reference state includes a reference position and a reference normal corresponding to the vertices of the target object, wherein the target state includes a target position, a target normal, and a fusion weight of the vertex, wherein the user guidance map is used to characterize a normal blending coefficient of each vertex, and the fusion weight is a weight used for position fusion and normal fusion.
[0077] The target object is an object to be deformed to generate animation, such as a human face, etc. The target object model can be represented by a blend shape, which is a technique of deforming a single mesh to achieve a combination of many predefined shapes and any number of shapes. For example, a single mesh is a basic shape of a default shape (such as an expressionless face), and other shapes of the basic shape are used for blending and deformation to give different expressions (such as smiling, frowning, and closing eyelids).
[0078] When the user needs to generate an animation, he needs to provide the target object model corresponding to the target object to be animated. The target object model includes a reference state and one or more target states. The reference state provides the reference position and reference normal corresponding to the vertex of the target object, and the target state provides the target position, target normal and fusion weight of the vertex. The vertices in the reference state and the target state are the same, but the positions and normals have some slight changes. The fusion weights in the target state are used when performing position fusion and normal fusion. Among them, the same vertices in the reference state and the target state have the same vertex identifier.
[0079] In step S12, the vertices to be positionally fused in the target state are determined according to the reference position and the target position, and the vertices to be normal-fused in the target state are determined according to the reference normal and the target normal.
[0080] A complete target object model includes a reference state and one or more target states. The disclosed embodiment obtains vertices to be fused in position and vertices to be fused in normal by analyzing the difference between each target state and the reference state, so that only the vertices to be fused in position are fused in position, and the vertices to be fused in normal are fused in normal. That is, the difference between the target position of the vertex in each target state and the reference position of the same vertex in the reference state is compared to obtain the vertices to be fused in position in the target state, and the difference between the target normal of the vertex in each target state and the reference normal of the same vertex in the reference state is compared to obtain the vertices to be fused in normal in the target state.
[0081] In an exemplary embodiment, the vertices to be positionally fused in the target state are determined based on the reference position and the target position, including: determining the vertex offset distance of the vertex in the target state relative to the same vertex in the reference state based on the reference position and the target position of the same vertex in the reference state and the target state; and determining the vertices whose vertex offset distance is greater than a first distance threshold as the vertices to be positionally fused in the target state.
[0082] The vertex offset distance may be a Euclidean distance, a spherical distance, or other distances. The first distance threshold may be set as required, for example, 0.001.
[0083] According to the reference position of the vertex in the reference state and the target position of the vertex in the target state, the vertex offset distance of the vertex in the target state relative to the same vertex in the reference state can be determined. When the vertex offset distance is 0, the vertex in the target state corresponding to the vertex offset distance does not need to be positionally fused. When the vertex offset distance is large, such as greater than the first distance threshold, the vertex in the target state corresponding to the vertex offset distance needs to be positionally fused, and the vertex is the vertex to be positionally fused in the target state. When there are multiple target states in the target object model, for each target state, the vertex offset distance is determined in the above manner and the vertex to be positionally fused in each target state is determined based on the vertex offset distance.
[0084] By determining the vertices to be positionally fused in the target state based on the vertex offset distance between the target state and the reference state, the vertices with position differences from the reference state can be accurately determined, so that the positions of these vertices can be fused, avoiding the fusion of the positions of all vertices, reducing the amount of calculation, and improving the fusion efficiency.
[0085] In an exemplary embodiment, the vertices to be normal-fused in the target state are determined based on the baseline normal and the target normal, including: determining the normal offset distance of the target normal of the vertex in the target state relative to the baseline normal of the same vertex in the baseline state based on the baseline normal and the target normal of the same vertex in the baseline state; and determining the vertices whose normal offset distance is greater than a second distance threshold as the vertices to be normal-fused in the target state.
[0086] The normal offset distance may be a Euclidean distance, a spherical distance, or other distances. The second distance threshold may be set as required, for example, 0.001. The second distance threshold may be the same as or different from the first distance threshold.
[0087] According to the baseline normal of the vertex in the baseline state and the target normal of the same vertex in the target state, the normal offset distance between the target normal of the vertex in the target state and the baseline normal of the same vertex in the baseline state is determined. When the normal offset distance is 0, the vertex in the target state corresponding to the normal offset distance does not need to be normal fused. When the normal offset distance is large, such as greater than the second distance threshold, the vertex in the target state corresponding to the normal offset distance needs to be normal fused. When there are multiple target states in the target object model, for each target state, the normal offset distance is determined in the above manner and the vertices to be normal fused in each target state are determined based on the normal offset distance.
[0088] By determining the vertices to be normal-fused in the target state based on the normal offset distance between the target state and the reference state, the vertices with normal differences from the reference state can be accurately determined, so that normal fusion of these vertices is performed, avoiding normal fusion of all vertices, reducing the amount of calculation, and improving fusion efficiency.
[0089] It should be noted that when determining the vertex offset distance and normal offset distance of vertices in multiple target states, each vertex in each target state can be traversed. For the vertex j in the i-th target state currently traversed, the target position pos of vertex j is calculated i,j The reference position pos of vertex j in the reference state 0,j When the vertex offset distance is the Euclidean distance, the vertex offset distance can be expressed as Calculate the target normal norm of vertex j i,j The reference normal norm of vertex j in the reference state 0,j The normal offset distance is , when the normal offset distance is the Euclidean distance, the normal offset distance is
[0090] In step S13, the fusion weights are used to perform position fusion on the vertices to be positionally fused in the target state to obtain a position fusion result corresponding to the target state, and normal fusion is performed on the vertices to be normal fused in the target state to obtain a normal fusion result corresponding to the target state.
[0091] After determining the vertices to be fused in position and the vertices to be fused in normal in the target state, position fusion can be performed on the vertices to be fused in position, and normal fusion can be performed on the vertices to be fused in normal. When performing position fusion, the fusion weight of the vertex in the target state is the weight of the target position of the vertex, and the difference between 1 and the fusion weight is the weight of the reference position of the vertex, thereby performing weighted summation on the reference position and target position corresponding to the vertex to be fused in position in the target state, and obtaining the position fusion result corresponding to the target state. When performing normal fusion, the fusion weight of the vertex in the target state is the weight of the target normal of the vertex, and the difference between 1 and the fusion weight is the weight of the reference normal of the vertex, thereby performing weighted summation on the reference normal and target normal corresponding to the vertex to be fused in normal in the target state, and obtaining the normal fusion result corresponding to the target state.
[0092] In step S14, the normal of each vertex in the target state is calculated according to the position fusion result and the model topological relationship to obtain the normal calculation result in the target state.
[0093] After normal fusion is performed on the vertices to be normal fused in the target state, the normal fusion result obtained may contain discontinuous normal data, which will cause color blocks to appear in the rendering result, that is, color anomalies, which need to be repaired. In the normal repair process, a user guidance map is needed to guide the repair. The user guidance map is used to characterize the mixing coefficient corresponding to each vertex. The user guidance map is provided by the user. Each element in the user guidance map represents the mixing coefficient of the normal calculation result and the normal fusion result, so that a smooth transition can be made from the normal calculation result to the normal fusion result.
[0094] According to the position fusion result and the model topological relationship, the normal calculation result corresponding to each vertex is determined respectively, a vertex for which the normal calculation result is to be determined is taken as the current vertex, at least one adjacent facet of the current vertex is determined, and the vector cross product of the difference vectors of other vertices in each adjacent facet and the current vertex is determined, and the sum of the vector cross products of at least one adjacent facet is determined as the normal calculation result corresponding to the current vertex. The facet can be a triangular facet or a quadrilateral facet.
[0095] In an exemplary embodiment, calculating the normal of each vertex in the target state according to the position fusion result and the model topological relationship to obtain the normal calculation result in the target state includes:
[0096] For the i-th vertex in the position fusion result, when the normal blending coefficient of the i-th vertex is greater than 0, determining the adjacent triangle of the i-th vertex according to the position fusion result and the model topological relationship;
[0097] Perform a vector cross product calculation on the position difference vectors of the other two vertices in each adjacent triangle and the i-th vertex to obtain a vector cross product result, and sum the vector cross product results of each adjacent triangle to obtain a normal calculation result of the i-th vertex, where i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
[0098] For each vertex, the normal is calculated based on the position fusion result. When the facet in the model topology is a triangular facet, traverse each vertex in the position fusion result, and for the i-th vertex in the position fusion result, determine the adjacent triangle of the i-th vertex according to the position of the i-th vertex in the position fusion result and the model topology, that is, determine the positions of the other two vertices in the adjacent triangle of the i-th vertex, perform vector cross product calculation on the position difference vectors of the other two vertices in each adjacent triangle with the i-th vertex, and obtain the vector cross product result of each adjacent triangle. Sum the vector cross product results of all adjacent triangles of the i-th vertex to obtain the normal calculation result of the i-th vertex, which can be expressed as follows by the formula:
[0099]
[0100] in, Represents the normal calculation result of the i-th vertex, is the set of adjacent triangles of vertex i, × represents the vector cross product, Δ represents an adjacent triangle, Represents the position of the 0th vertex of an adjacent triangle, that is, the position of the i-th vertex in the position fusion result. Represents the position of the first vertex of an adjacent triangle, Indicates the position of the second vertex of an adjacent triangle, and normalize indicates normalization. Wherein, i is a positive integer and is less than or equal to N, where N is the total number of vertices in the target object model. When performing a vector cross product, it is not necessary to normalize the vector cross product result, because the triangle area is used for weighting, that is, the vector cross product result is 1 / 2 of the triangle area, and the calculation can also be accelerated.
[0101] It should be noted that when calculating normals, only the normals of vertices with a blending coefficient greater than 0 need to be calculated, and other vertices do not need to be calculated. Therefore, when the normal blending coefficient corresponding to each vertex is given in the user guidance graph, only the normal blending coefficient greater than 0 is given to the vertices that are prone to abnormal fusion results, and the normal blending coefficient of vertices that are not prone to abnormalities can be 0. In this way, only a small number of (about 1 / 10) vertices need to be calculated to ensure that the fusion result does not produce abnormalities.
[0102] In step S15, the normal calculation result and the normal fusion result are fused using the user guidance map corresponding to the target state to obtain a normal secondary fusion result corresponding to the target state.
[0103] According to the normal blending coefficient corresponding to each vertex in the user guidance graph, the weights of the normal calculation result and the normal fusion result are determined, and based on the weights of the normal calculation result and the normal fusion result, the normal calculation result and the normal fusion result of each vertex are weighted and summed to obtain the normal secondary fusion result. When determining the weights of the normal calculation result and the normal fusion result according to the normal blending coefficient corresponding to each vertex, the normal blending coefficient can be used as the weight of the normal calculation result, and the difference between 1 and the normal blending coefficient can be used as the weight of the normal fusion result, or the normal blending coefficient can be used as the weight of the normal fusion result, and the difference between 1 and the normal blending coefficient can be used as the weight of the normal calculation result.
[0104] In an exemplary embodiment, the normal calculation result and the normal fusion result are fused using the user guidance map corresponding to the target state to obtain a normal secondary fusion result corresponding to the target state, including:
[0105] Determine the weight of the normal calculation result corresponding to the i-th vertex according to the normal blending coefficient corresponding to the i-th vertex, and determine the weight of the normal fusion result corresponding to the i-th vertex;
[0106] According to the weight of the normal calculation result corresponding to the i-th vertex and the weight of the normal fusion result, the normal calculation result and the normal fusion result of the i-th vertex are weighted summed to obtain the normal secondary fusion result of the i-th vertex, where i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
[0107] The vertices in the position fusion result are traversed. When the ith vertex is traversed, the normal blending coefficient of the ith vertex is determined as the weight of the normal calculation result or the weight of the normal fusion result when the normal blending coefficient of the ith vertex is greater than 0, so that the weight of the normal calculation result corresponding to the ith vertex and the weight of the normal fusion result corresponding to the ith vertex can be determined. According to the weight of the normal calculation result corresponding to the ith vertex and the weight of the normal fusion result, the normal calculation result of the ith vertex and the normal fusion result are weighted summed to obtain the secondary fusion result of the normal of the ith vertex. When the normal blending coefficient of the ith vertex is not greater than 0, the normal of the ith vertex does not need to be calculated. By performing secondary fusion of the normal result and the normal fusion result based on the normal blending coefficient, the color anomaly caused by direct normal fusion can be eliminated, and the generated animation effect can be improved.
[0108] In an exemplary embodiment, the weight of the normal calculation result corresponding to the ith vertex is determined based on the mixing coefficient corresponding to the ith vertex, and the weight of the normal fusion result corresponding to the ith vertex is determined, including: determining the normal mixing coefficient of the ith vertex as the weight of the normal calculation result corresponding to the ith vertex, and determining the difference between 1 and the normal mixing coefficient of the ith vertex as the weight of the normal fusion result corresponding to the ith vertex.
[0109] When determining the weights of the normal calculation result and the normal fusion result of the i-th vertex, the normal blending coefficient of the i-th vertex is determined as the weight of the normal calculation result corresponding to the i-th vertex, and the difference between 1 and the blending coefficient of the i-th vertex is determined as the weight of the normal fusion result corresponding to the i-th vertex. Therefore, the normal calculation result and the normal fusion result can be fused according to the following formula:
[0110]
[0111] Among them, norm i is the secondary fusion result of the normal of the i-th vertex, is the normal calculation result of the i-th vertex, is the normal fusion result of the i-th vertex, w i is the mixing coefficient of the ith vertex.
[0112] By determining the normal blending coefficient of the i-th vertex as the weight of the normal calculation result corresponding to the i-th vertex, in the user guidance map, only the normal blending coefficients of the vertices that need to be recalculated need to be given, and the normal blending coefficients of the vertices that do not need to be recalculated can be 0. In this way, vertices that are prone to color anomalies can be recalculated, thereby better eliminating color anomalies and reducing the amount of calculation.
[0113] In step S16, a target animation is generated according to the position fusion result and the normal secondary fusion result.
[0114] The vertex fusion result and the normal secondary fusion result of each vertex in the target state are spliced together to obtain the fusion state, and the reference state, fusion state and target state are synthesized into the target animation. The fusion state is a transition state between the reference state and the target state.
[0115] The animation generation method provided by the present exemplary embodiment determines, after acquiring the target object model to be animated, the vertices to be subjected to position fusion based on the reference positions and target positions of the vertices of the target object, and determines the vertices to be subjected to normal fusion based on the reference normals and target normals of the vertices, performs position fusion on the vertices to be subjected to position fusion in the target state according to the fusion weights of the vertices to be subjected to normal fusion in the target state to obtain the position fusion result, performs normal fusion on the vertices to be subjected to normal fusion in the target state to obtain the normal fusion result, calculates the normal of each vertex according to the position fusion result and the model topological relationship to obtain the normal calculation result, and uses the user guidance map corresponding to the target state to calculate the normal. The line calculation result and the normal fusion result are fused to obtain the normal secondary fusion result, and the target animation is generated according to the position fusion result and the normal secondary fusion result. Since the normal calculation result can be calculated based on the position fusion result and the model topological relationship, and the normal calculation result and the normal fusion result are fused, the color anomaly caused by direct normal fusion can be corrected, thereby solving the color anomaly problem caused by normal fusion. Moreover, only the position fusion needs to be performed on the vertices to be subjected to position fusion and the normal fusion needs to be performed on the vertices to be subjected to normal fusion. Compared with performing position fusion and normal fusion on all vertices, the amount of calculation is reduced, thereby saving fusion time and improving fusion efficiency.
[0116] On the basis of the above technical solution, the fusion weight is used to perform position fusion on the vertices to be positionally fused in the target state to obtain a position fusion result corresponding to the target state, including: after determining the vertices to be positionally fused in the target state, a position guidance map is generated, and in the position guidance map, the vertices to be positionally fused in the target state are represented by a first preset value, and the vertices that do not need to be positionally fused in the target state are represented by a second preset value; using the fusion weight of the vertex in the target state, a weighted sum is performed on the target position and the reference position corresponding to the vertex whose value in the position guidance map is the first preset value to obtain a position fusion result corresponding to the target state.
[0117] For a target state, after determining the vertices to be positionally fused in the target state, a position guidance map is generated, and the vertices to be positionally fused in the target state are represented by a first preset value in the position guidance map. For example, the first preset value may be 1, indicating that the vertex needs to participate in the position fusion, and the vertices that do not need to be positionally fused are represented by a second preset value in the position guidance map. For example, the second preset value may be 0. When positionally fusion is performed on the vertices to be positionally fused in the target state, the fusion weight of the vertex in the target state may be determined as the weight of the target position, and the difference between 1 and the fusion weight may be determined as the weight of the reference position, thereby weighted summing the target position and the reference position corresponding to the vertex whose value is the first preset value in the position guidance map of the target state, and obtaining the position fusion result corresponding to the target state. The position guidance map can clearly identify the vertices that need to be positionally fused, thereby improving the accuracy of position fusion.
[0118] On the basis of the above technical scheme, normal fusion is performed on the vertices to be normal fused in the target state to obtain a normal fusion result corresponding to the target state, including: after determining the vertices to be normal fused in the target state, a normal guidance map is generated, and the vertices to be normal fused in the target state are represented by a third preset value in the normal guidance map, and the vertices that do not need to be normal fused in the target state are represented by a fourth preset value; using the fusion weights of the vertices in the target state, weighted summation is performed on the target normal and the reference normal corresponding to the vertices whose values in the normal guidance map are the third preset value, to obtain the normal fusion result corresponding to the target state.
[0119] For a target state, after determining the vertices to be normal-fused in the target state, a normal guidance map is generated, and the vertices to be normal-fused in the target state are represented by a third preset value in the normal guidance map. For example, the third preset value may be 1, indicating that the vertex needs to participate in normal fusion. The vertices that do not need normal fusion are represented by a fourth preset value in the normal guidance map. For example, the second preset value may be 0. When fusing the vertices to be normal-fused in the target state, the fusion weight of the vertex in the target state may be determined as the weight of the target normal, and the difference between 1 and the fusion weight may be determined as the weight of the reference normal, thereby weighted summing the target normal and the reference normal corresponding to the vertex whose value in the normal guidance map in the target state is the third preset value, and obtaining the normal fusion result corresponding to the target state. The normal guidance map can clearly identify the vertices that need normal fusion, thereby improving the accuracy of normal fusion.
[0120] Figure 2 is an overall flow chart of the animation generation method in the embodiment of the present disclosure, such as Figure 2As shown, the animation generation process may include an initialization phase and a fusion phase. The initialization phase mainly generates two sets of guidance maps for positions and normals based on the size of the geometric attribute offset of each target state relative to the reference state, namely, generating a position guidance map and a normal guidance map, which are respectively used to calibrate the vertices that need to be fused. In the fusion phase, firstly, a weighted sum is performed on the target position and the reference position of the vertex whose value in the position guidance map is the first preset value to obtain a position fusion result, and a weighted sum is performed on the target normal and the reference normal of the vertex whose value in the normal guidance map is the third preset value to obtain a normal fusion result. At this time, there may be discontinuous normal data in the normal fusion result, which will cause color blocks to appear in the rendering result and need to be repaired. The normal repair process requires a user guidance map provided by the user, namely, the normal mixing coefficient corresponding to each vertex. In the user guidance map, each element w i Indicates the normal calculation result Merge result with normal The normal blending coefficient is used to perform secondary fusion of the normal fusion result and the normal settlement result, so that the normal calculation result can be smoothly transitioned to the normal fusion result. The position fusion result and the normal fusion result are spliced to obtain the fusion state. Based on the reference state, fusion state and target state, the target animation can be generated.
[0121] A reference implementation based on the above process: C++ language can be used on the CPU side to complete the relevant calculations in the initialization phase and generate the position guidance map and normal guidance map for each target state. The calculation in the fusion stage is divided into two parts, which are executed on the CPU and GPU respectively. The CPU submits the reference position, target position, reference normal, target normal, position guide map and normal guide map of all vertices to the GPU. In the vertex shader, the GPU directly weights and fuses the target position and reference position of the vertex whose value in the position guide map is the first preset value to obtain the position fusion result, and directly weights and fuses the target normal and reference normal of the vertex whose value in the normal guide map is the third preset value to obtain the normal fusion result; for the position fusion result, the CPU recalculates the vertex normals corresponding to the areas in the user guide map that are not 0 to obtain the normal calculation result; finally, the recalculated normal data, i.e., the normal calculation result, is submitted to the GPU. The GPU fuses the normal calculation result with the directly weighted fused normal data, i.e., the normal fusion result, according to the normal blending coefficient in the user guide map, to obtain the normal secondary fusion result, and splices the position fusion result and the normal secondary fusion result to obtain the fusion state, and slowly transitions the reference state to the target state through the fusion state, thereby generating the target animation. By combining CPU and GPU to perform fusion calculations, the time consumption can be further reduced.
[0122] Figure 3is a block diagram of an animation generating device according to an exemplary embodiment. Figure 3 The device includes an acquisition module 31, a to-be-fused data determination module 32, a fusion module 33, a normal calculation module 34, a normal secondary fusion module 35 and an animation generation module 36.
[0123] The acquisition module 31 is configured to execute acquisition of a target object model corresponding to the animation to be generated, wherein the target object model includes a reference state of the target object, a target state, a user guidance map corresponding to the target state, and a model topological relationship, wherein the reference state includes a reference position and a reference normal corresponding to a vertex of the target object, wherein the target state includes a target position, a target normal, and a fusion weight of the vertex, wherein the user guidance map is used to characterize a normal blending coefficient of each vertex, and wherein the fusion weight is a weight used when performing position fusion and normal fusion;
[0124] The to-be-fused data determination module 32 is configured to determine the vertices to be fused in position in the target state according to the reference position and the target position, and to determine the vertices to be fused in normal in the target state according to the reference normal and the target normal;
[0125] The fusion module 33 is configured to perform position fusion on the vertices to be positionally fused in the target state using the fusion weights to obtain a position fusion result corresponding to the target state, and to perform normal fusion on the vertices to be normal fused in the target state to obtain a normal fusion result corresponding to the target state;
[0126] The normal calculation module 34 is configured to calculate the normal of each vertex in the target state according to the position fusion result and the model topological relationship, and obtain the normal calculation result in the target state;
[0127] The normal secondary fusion module 35 is configured to use the user guidance map corresponding to the target state to fuse the normal calculation result and the normal fusion result to obtain the normal secondary fusion result corresponding to the target state;
[0128] The animation generation module 36 is configured to generate a target animation according to the position fusion result and the normal secondary fusion result.
[0129] Optionally, the module for determining the data to be fused includes:
[0130] a vertex offset determining unit configured to determine a vertex offset distance of a vertex in the target state relative to the same vertex in the reference state according to a reference position and a target position of the same vertex in the reference state and the target state;
[0131] The position fusion vertex determination unit is configured to determine the vertices whose vertex offset distance is greater than a first distance threshold as vertices to be positionally fused in the target state.
[0132] Optionally, the module for determining the data to be fused includes:
[0133] a normal offset determining unit configured to determine a normal offset distance of a target normal of a vertex in the target state relative to a reference normal of the same vertex in the reference state based on a reference normal and a target normal of the same vertex in the reference state and the target state;
[0134] The normal fusion vertex determination unit is configured to determine the vertices whose normal offset distance is greater than a second distance threshold as vertices to be subjected to normal fusion in the target state.
[0135] Optionally, the fusion module includes:
[0136] a position guidance map determining unit, configured to generate a position guidance map after determining the vertices to be positionally fused in the target state, and to represent the vertices to be positionally fused in the target state with a first preset value in the position guidance map, and to represent the vertices that do not need to be positionally fused in the target state with a second preset value;
[0137] The vertex fusion unit is configured to perform weighted summation of the target position and the reference position corresponding to the vertex whose value in the position guidance graph is the first preset value using the fusion weight of the vertex in the target state, so as to obtain the position fusion result corresponding to the target state.
[0138] Optionally, the fusion module includes:
[0139] a normal guide map determining unit configured to generate a normal guide map after determining the vertices to be subjected to normal fusion in the target state, and to represent the vertices to be subjected to normal fusion in the target state with a third preset value in the normal guide map, and to represent the vertices that do not need to be subjected to normal fusion in the target state with a fourth preset value;
[0140] The normal fusion unit is configured to perform weighted summation of the target normal and the reference normal corresponding to the vertex with a third preset value in the normal guidance map using the fusion weights of the vertices in the target state to obtain a normal fusion result corresponding to the target state.
[0141] Optionally, the normal calculation module includes:
[0142] an adjacent triangle determining unit, configured to determine, for an i-th vertex in the position fusion result, an adjacent triangle of the i-th vertex according to the position fusion result and the model topological relationship when a normal blending coefficient of the i-th vertex is greater than 0;
[0143] The normal calculation unit is configured to perform a vector cross product calculation on the position difference vectors of the other two vertices in each of the adjacent triangles and the i-th vertex to obtain a vector cross product result, and sum the vector cross product results of each of the adjacent triangles to obtain a normal calculation result of the i-th vertex, wherein i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
[0144] Optionally, the normal secondary fusion module includes:
[0145] A weight determination unit, configured to determine the weight of the normal calculation result corresponding to the i-th vertex according to the normal blending coefficient corresponding to the i-th vertex, and determine the weight of the normal fusion result corresponding to the i-th vertex;
[0146] The secondary fusion unit is configured to perform weighted summation of the normal calculation result and the normal fusion result of the i-th vertex according to the weight of the normal calculation result corresponding to the i-th vertex and the weight of the normal fusion result, so as to obtain the secondary fusion result of the normal of the i-th vertex, wherein i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
[0147] Optionally, the weight determination unit is configured to execute:
[0148] The normal blending coefficient corresponding to the i-th vertex is determined as the weight of the normal calculation result corresponding to the i-th vertex, and the difference between 1 and the normal blending coefficient of the i-th vertex is determined as the weight of the normal fusion result corresponding to the i-th vertex.
[0149] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0150] Figure 4 4 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0151] Reference Figure 4, the electronic device 400 may include one or more of the following components: a processing component 402 , a memory 404 , a power component 406 , a multimedia component 408 , an audio component 410 , an input / output (I / O) interface 412 , a sensor component 414 , and a communication component 416 .
[0152] The processing component 402 generally controls the overall operation of the electronic device 400, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.
[0153] The memory 404 is configured to store various types of data to support operations on the electronic device 400. Examples of such data include instructions for any application or method operating on the electronic device 400, contact data, phone book data, messages, pictures, videos, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0154] The power supply component 406 provides power to the various components of the electronic device 400. The power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 400.
[0155] The multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0156] The audio component 410 is configured to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC), and when the electronic device 400 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 404 or sent via the communication component 416. In some embodiments, the audio component 410 also includes a speaker for outputting audio signals.
[0157] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0158] The sensor assembly 414 includes one or more sensors for providing various aspects of status assessment for the electronic device 400. For example, the sensor assembly 414 can detect the open / closed state of the electronic device 400, the relative positioning of the components, such as the display and keypad of the electronic device 400, and the sensor assembly 414 can also detect the position change of the electronic device 400 or a component of the electronic device 400, the presence or absence of contact between the user and the electronic device 400, the orientation or acceleration / deceleration of the electronic device 400, and the temperature change of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 414 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0159] The communication component 416 is configured to facilitate wired or wireless communication between the electronic device 400 and other devices. The electronic device 400 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0160] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0161] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, and the above instructions can be executed by a processor 420 of an electronic device 400 to perform the above method. Alternatively, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0162] In an exemplary embodiment, a computer program product is also provided, including a computer program or a computer instruction, wherein the computer program or the computer instruction implements the above animation generation method when executed by a processor.
[0163] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0164] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. An animation generation method, characterized in that: include: Acquire a target object model corresponding to the animation to be generated, wherein the target object model includes a reference state of the target object, a target state, a user guidance map corresponding to the target state, and a model topological relationship, wherein the reference state includes a reference position and a reference normal corresponding to a vertex of the target object, wherein the target state includes a target position, a target normal, and a fusion weight of the vertex, wherein the user guidance map is used to characterize a normal blending coefficient of each vertex, and wherein the fusion weight is a weight used when performing position fusion and normal fusion; Determine, according to the reference position and the target position, the vertex to be subjected to position fusion in the target state, and, according to the reference normal and the target normal, determine the vertex to be subjected to normal fusion in the target state; Using the fusion weights, position fusion is performed on the vertices to be positionally fused in the target state to obtain a position fusion result corresponding to the target state, and normal fusion is performed on the vertices to be normal fused in the target state to obtain a normal fusion result corresponding to the target state; Calculate the normal of each vertex in the target state according to the position fusion result and the model topological relationship to obtain the normal calculation result in the target state; Using the user guidance map corresponding to the target state, the normal calculation result and the normal fusion result are fused to obtain a normal secondary fusion result corresponding to the target state; Generate a target animation according to the position fusion result and the normal secondary fusion result; Wherein, calculating the normal of each vertex in the target state according to the position fusion result and the model topological relationship to obtain the normal calculation result in the target state includes: For an i-th vertex in the position fusion result, when a normal blending coefficient of the i-th vertex is greater than 0, determining an adjacent triangle of the i-th vertex according to the position fusion result and the model topological relationship; Performing a vector cross product calculation on the position difference vectors of the other two vertices in each of the adjacent triangles and the i-th vertex to obtain a vector cross product result, and summing the vector cross product results of each of the adjacent triangles to obtain a normal calculation result of the i-th vertex, wherein i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model; The normal calculation result and the normal fusion result are fused using the user guidance map corresponding to the target state to obtain a normal secondary fusion result corresponding to the target state, including: Determine the weight of the normal calculation result corresponding to the i-th vertex according to the normal blending coefficient corresponding to the i-th vertex, and determine the weight of the normal fusion result corresponding to the i-th vertex; According to the weight of the normal calculation result corresponding to the i-th vertex and the weight of the normal fusion result, the normal calculation result and the normal fusion result of the i-th vertex are weighted summed to obtain the normal secondary fusion result of the i-th vertex, where i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
2. The method according to claim 1, characterized in that: Determining, according to the reference position and the target position, vertices to be positionally fused in the target state, including: Determining a vertex offset distance of a vertex in the target state relative to the same vertex in the reference state according to a reference position and a target position of the same vertex in the reference state and the target state; The vertices whose vertex offset distances are greater than a first distance threshold are determined as vertices to be positionally fused in the target state.
3. The method according to claim 1, characterized in that Determining, according to the reference normal and the target normal, vertices to be subjected to normal fusion in the target state, comprising: Determine, based on a reference normal and a target normal of the same vertex in the reference state and the target state, a normal offset distance of a target normal of the vertex in the target state relative to a reference normal of the same vertex in the reference state; The vertices whose normal offset distance is greater than a second distance threshold are determined as vertices to be subjected to normal fusion in the target state.
4. The method according to any one of claims 1 to 3, characterized in that: Using the fusion weight, position fusion is performed on the vertices to be positionally fused in the target state to obtain a position fusion result corresponding to the target state, including: After determining the vertices to be positionally fused in the target state, generating a position guidance graph, and using a first preset value in the position guidance graph to represent the vertices to be positionally fused in the target state, and using a second preset value to represent the vertices that do not need to be positionally fused in the target state; The fusion weights of the vertices in the target state are used to perform weighted summation on the target position and the reference position corresponding to the vertices whose values in the position guidance graph are the first preset values, so as to obtain a position fusion result corresponding to the target state.
5. The method according to any one of claims 1 to 3, characterized in that: Performing normal fusion on the vertices to be normal fused in the target state to obtain a normal fusion result corresponding to the target state, including: After determining the vertices to be subjected to normal fusion in the target state, generating a normal guide map, and using a third preset value in the normal guide map to represent the vertices to be subjected to normal fusion in the target state, and using a fourth preset value to represent the vertices that do not need to be subjected to normal fusion in the target state; The fusion weights of the vertices in the target state are used to perform weighted summation on the target normals and the reference normals corresponding to the vertices whose values in the normal guide map are the third preset values, so as to obtain a normal fusion result corresponding to the target state.
6. The method according to claim 1, characterized in that Determining the weight of the normal calculation result corresponding to the i-th vertex according to the normal blending coefficient corresponding to the i-th vertex, and determining the weight of the normal fusion result corresponding to the i-th vertex, including: The normal blending coefficient corresponding to the i-th vertex is determined as the weight of the normal calculation result corresponding to the i-th vertex, and the difference between 1 and the normal blending coefficient of the i-th vertex is determined as the weight of the normal fusion result corresponding to the i-th vertex.
7. An animation generating device, characterized in that: include: An acquisition module is configured to acquire a target object model corresponding to the animation to be generated, wherein the target object model includes a reference state of the target object, a target state, a user guidance map corresponding to the target state, and a model topological relationship, wherein the reference state includes a reference position and a reference normal corresponding to a vertex of the target object, wherein the target state includes a target position, a target normal, and a fusion weight of the vertex, wherein the user guidance map is used to characterize a normal blending coefficient of each vertex, and wherein the fusion weight is a weight used when performing position fusion and normal fusion; a module for determining data to be fused, configured to determine vertices to be fused in position in the target state according to the reference position and the target position, and to determine vertices to be fused in normal in the target state according to the reference normal and the target normal; a fusion module configured to perform position fusion on the vertices to be positionally fused in the target state using the fusion weights to obtain a position fusion result corresponding to the target state, and to perform normal fusion on the vertices to be normal fused in the target state to obtain a normal fusion result corresponding to the target state; A normal calculation module is configured to calculate the normal of each vertex in the target state according to the position fusion result and the model topological relationship, so as to obtain a normal calculation result in the target state; A normal secondary fusion module is configured to use the user guidance map corresponding to the target state to fuse the normal calculation result and the normal fusion result to obtain a normal secondary fusion result corresponding to the target state; An animation generation module is configured to generate a target animation according to the position fusion result and the normal secondary fusion result; Wherein, the normal calculation module includes: an adjacent triangle determining unit, configured to determine, for an i-th vertex in the position fusion result, an adjacent triangle of the i-th vertex according to the position fusion result and the model topological relationship when a normal blending coefficient of the i-th vertex is greater than 0; a normal calculation unit, configured to perform a vector cross product calculation on the position difference vectors of the other two vertices in each of the adjacent triangles and the i-th vertex to obtain a vector cross product result, and sum the vector cross product results of each of the adjacent triangles to obtain a normal calculation result of the i-th vertex, wherein i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model; Wherein, the normal secondary fusion module includes: A weight determination unit, configured to determine the weight of the normal calculation result corresponding to the i-th vertex according to the normal blending coefficient corresponding to the i-th vertex, and determine the weight of the normal fusion result corresponding to the i-th vertex; The secondary fusion unit is configured to perform weighted summation of the normal calculation result and the normal fusion result of the i-th vertex according to the weight of the normal calculation result corresponding to the i-th vertex and the weight of the normal fusion result, so as to obtain the secondary fusion result of the normal of the i-th vertex, wherein i is a positive integer and is less than or equal to N, and N is the total number of vertices in the target object model.
8. The device according to claim 7, characterized in that The module for determining the data to be fused includes: a vertex offset determining unit configured to determine a vertex offset distance of a vertex in the target state relative to the same vertex in the reference state according to a reference position and a target position of the same vertex in the reference state and the target state; The position fusion vertex determination unit is configured to determine the vertices whose vertex offset distance is greater than a first distance threshold as vertices to be positionally fused in the target state.
9. The device according to claim 7, characterized in that The module for determining the data to be fused includes: a normal offset determining unit configured to determine a normal offset distance of a target normal of a vertex in the target state relative to a reference normal of the same vertex in the reference state based on a reference normal and a target normal of the same vertex in the reference state and the target state; The normal fusion vertex determination unit is configured to determine the vertices whose normal offset distance is greater than a second distance threshold as vertices to be subjected to normal fusion in the target state.
10. The device according to any one of claims 7 to 9, characterized in that: The fusion module includes: a position guidance map determining unit, configured to generate a position guidance map after determining the vertices to be positionally fused in the target state, and to represent the vertices to be positionally fused in the target state with a first preset value in the position guidance map, and to represent the vertices that do not need to be positionally fused in the target state with a second preset value; The vertex fusion unit is configured to perform weighted summation of the target position and the reference position corresponding to the vertex whose value in the position guidance graph is the first preset value using the fusion weight of the vertex in the target state, so as to obtain the position fusion result corresponding to the target state.
11. The device according to any one of claims 7 to 9, characterized in that: The fusion module includes: a normal guide map determining unit configured to generate a normal guide map after determining the vertices to be subjected to normal fusion in the target state, and to represent the vertices to be subjected to normal fusion in the target state with a third preset value in the normal guide map, and to represent the vertices that do not need to be subjected to normal fusion in the target state with a fourth preset value; The normal fusion unit is configured to perform weighted summation of the target normal and the reference normal corresponding to the vertex with a third preset value in the normal guidance map using the fusion weights of the vertices in the target state to obtain a normal fusion result corresponding to the target state.
12. The device according to claim 7, characterized in that The weight determination unit is configured to perform: The normal blending coefficient corresponding to the i-th vertex is determined as the weight of the normal calculation result corresponding to the i-th vertex, and the difference between 1 and the normal blending coefficient of the i-th vertex is determined as the weight of the normal fusion result corresponding to the i-th vertex.
13. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the animation generation method as described in any one of claims 1 to 6.
14. A computer-readable storage medium, when instructions in the computer storage medium are executed by a processor of an electronic device, enables the electronic device to execute the animation generation method according to any one of claims 1 to 6.
15. A computer program product comprising a computer program or computer instructions, characterized in that When the computer program or computer instruction is executed by a processor, the animation generation method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Image processing method and device, electronic equipment, and storage medium
CN107358643A
Systems and methods for real-time complex character animations and interactivity
CN111465965A