Animation data processing method and device, storage medium and electronic equipment
By using a self-collision loss function to train the target motion model in animation data processing, generating target vertex data and rendering it, the problem of low animation simulation accuracy caused by virtual object self-collision is solved, and higher animation data accuracy is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2026-03-10
AI Technical Summary
During the animation data rendering process, the self-collision phenomenon of virtual objects leads to a low accuracy of animation simulation.
By acquiring the object animation data and initial vertex data of the target object, inputting them into a pre-trained target motion model, training the initial motion model using a self-collision loss function, generating target vertex data, and rendering based on the target vertex data to generate target animation data that matches the object animation data.
It improves the accuracy of animation data, ensuring that virtual objects can be correctly superimposed and intersected during movement, and reduces self-interpenetration.
Smart Images

Figure CN121639870A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, and in particular, to a method and device for processing animation data, a storage medium, and an electronic device. BACKGROUND
[0002] Currently, in the process of rendering animation data, the shape and speed of the object change frequently and are easily affected by environmental factors, such as wind force, gravity, and the like. Taking a virtual cloth as an example, the virtual cloth is usually set to be in a non-interpenetration state before animation simulation, that is, the virtual cloth maintains a natural state without external interference, which means that the virtual cloth will not be pulled, squeezed, or folded. Then, the motion trajectory and deformation of the virtual cloth under different environments are calculated by simulating the physical properties of the virtual cloth, such as elasticity, gravity, friction, and the like. In other words, in the related art, the virtual cloth is not simulated for interpenetration, so that the virtual cloth will appear to penetrate during the movement, that is, a part of the virtual cloth will penetrate through another part, which cannot correctly superimpose and intersect, resulting in an unnatural visual phenomenon. In summary, there is a technical problem in the related art that the accuracy of animation simulation is low due to the self-collision phenomenon of the object.
[0003] At present, there is no effective solution to the above problem. SUMMARY
[0004] Embodiments of the present application provide a method and device for processing animation data, a storage medium, and an electronic device to at least solve the technical problem that the accuracy of animation simulation is low due to the self-collision phenomenon of the virtual object during animation rendering.
[0005] According to an aspect of an embodiment of the present application, a method for processing animation data is provided, including: obtaining object animation data associated with a target object and initial vertex data, wherein the initial vertex data includes initial positions of each vertex of a virtual object configured for the target object in a global coordinate system, and the object animation data is used to indicate a motion process of a virtual skeleton of the target object; inputting the object animation data and the initial vertex data into a pre-trained target motion model to obtain target vertex data, wherein the target vertex data includes positions of each vertex of the virtual object in the global coordinate system that match the object animation data, the target motion model represents a model obtained by training an initial motion model, a loss function used in a training process of the initial motion model includes a self-collision loss function, and the self-collision loss function is used to indicate a degree of collision of any two triangular facets associated with the virtual object, the triangular facets being composed of the vertices; and performing rendering based on the target vertex data to generate target animation data that matches the object animation data.
[0006] According to another aspect of the embodiments of this application, an animation data processing apparatus is also provided, comprising: an acquisition module, configured to acquire object animation data and initial vertex data associated with a target object, wherein the initial vertex data includes the initial positions of each vertex of a virtual object configured for the target object in a global coordinate system, and the object animation data is used to indicate the motion process of the virtual skeleton of the target object; an execution module, configured to input the object animation data and the initial vertex data into a pre-trained target motion model to obtain target vertex data, wherein the target vertex data includes the positions of each vertex of the virtual object that match the object animation data in the global coordinate system, the target motion model represents a model obtained by training the initial motion model, and the loss function used in the training process of the initial motion model includes a self-collision loss function, the self-collision loss function being used to indicate the degree of collision between any two triangular faces associated with the virtual object, the triangular faces being composed of the vertices; and a generation module, configured to render based on the target vertex data to generate target animation data matching the object animation data.
[0007] Optionally, the device is further configured to: acquire sample object animation data associated with the sample object, wherein the sample object animation data is used to indicate the motion process of the virtual skeleton of the sample object; input the sample object animation data and the initial vertex data into the initial motion model to obtain sample vertex data, wherein the sample vertex data includes the positions of each vertex of the virtual object that match the sample object animation data in the global coordinate system; determine the loss function of the initial motion model based on the sample vertex data, and determine the initial motion model as the target motion model if the loss function satisfies a preset condition, wherein the self-collision loss function is determined by the length of the intersection line segment of any two triangular facets.
[0008] Optionally, the device is configured to determine the loss function of the initial motion model based on the sample vertex data in the following manner, and determine the initial motion model as the target motion model if the loss function satisfies a preset condition: combining any two triangular faces of the virtual object to determine multiple pairs of triangular faces; obtaining the length of the intersection line segment of each pair of triangular faces; performing an accumulation operation on the length of the intersection line segment of each pair of triangular faces to obtain the value of the self-collision loss function; determining the value of the loss function based on the value of the self-collision loss function, and determining the initial motion model as the target motion model if the value of the loss function satisfies a preset value condition.
[0009] Optionally, the device is configured to obtain the length of the intersecting line segment of each pair of triangular facets in the plurality of pairs of triangular facets by: obtaining a first triangular facet and a second triangular facet, wherein the first triangular facet and the second triangular facet represent any pair of triangular facets in the plurality of pairs of triangular facets; determining whether the first triangular facet and the second triangular facet intersect; if the first triangular facet and the second triangular facet intersect, obtaining the centroid coordinate data of the intersection point, wherein the centroid coordinate data represents the position of the intersection point in the local coordinate system; determining the intersection point coordinate data based on the facet vertex data of the first triangular facet or the second triangular facet and the centroid coordinate data, wherein the intersection point coordinate data represents the position of the intersection point in the global coordinate system; and determining the length of the target intersecting line segment associated with the first triangular facet and the second triangular facet based on the intersection point coordinate data, wherein the intersecting line segment includes the target intersecting line segment.
[0010] Optionally, the device is configured to determine the intersection coordinate data based on the vertex data of the first or second triangular facet and the centroid coordinate data in the following manner: acquiring the first vertex data of the first triangular facet and performing a weighted operation on the coordinates of each vertex in the first vertex data based on the centroid coordinate data to determine the intersection coordinate data; or acquiring the second vertex data of the second triangular facet and performing a weighted operation on the coordinates of each vertex in the second vertex data based on the centroid coordinate data to determine the intersection coordinate data.
[0011] Optionally, the device is configured to determine the value of the loss function based on the value of the self-collision loss function in the following manner, and determine the initial motion model as the target motion model when the value of the loss function satisfies a preset value condition: obtaining a set of potential energy functions set for the initial motion model, wherein the potential energy functions in the set of potential energy functions are used to constrain the shape and size of arbitrary triangular facets of the virtual object; determining the value of the loss function as the sum of the values of each potential energy function in the set of potential energy functions and the value of the self-collision loss function; and determining the initial motion model as the target motion model when the value of the loss function satisfies the preset value condition.
[0012] Optionally, the device is used to input the object animation data and the initial vertex data into a pre-trained target motion model to obtain target vertex data in the following manner: extracting animation data from frame ip to frame i+q from the object animation data, wherein the object animation data includes N frames, i≤N, ip≤N, i+q≤N, and i, p, q, and N are all positive integers; determining static animation data and dynamic animation data corresponding to frame i based on the animation data from frame ip to frame i+q, wherein the static animation data includes the bone rotation information of the target object in each frame, and the dynamic animation data includes the bone rotation speed of the target object in each frame; and determining the target vertex data corresponding to frame i based on the static animation data, the dynamic animation data, and the initial vertex data.
[0013] Optionally, the device is configured to determine the static animation data and dynamic animation data corresponding to the i-th frame based on the animation data from the ip-th frame to the (i+q-th frame)-th frame in the following manner: determining the animation data of the i-th frame as the static animation data, wherein the static animation data further includes gravity data for each frame; and determining the animation data from the ip-th to the (i-1-th frame)-th frame and the animation data from the (i+1-th frame)-th (i+q-th frame)-th frame as the dynamic animation data, wherein the dynamic animation data further includes acceleration data for each frame.
[0014] Optionally, the apparatus is configured to determine the target vertex data corresponding to the i-th frame based on the static animation data, the dynamic animation data, and the initial vertex data in the following manner: inputting the static animation data into a static encoder to obtain a static latent space, wherein the target motion model includes the static encoder; inputting the dynamic animation data into a dynamic encoder to obtain a dynamic latent space, wherein the target motion model includes the dynamic encoder; inputting the static latent space and the dynamic latent space into a target fully connected layer, and combining the initial vertex data to determine the target vertex data corresponding to the i-th frame.
[0015] Optionally, the device is configured to input the static latent space and the dynamic latent space into the target fully connected layer in the following manner, and determine the target vertex data corresponding to the i-th frame by combining the initial vertex data: inputting the static latent space and the dynamic latent space into the target fully connected layer to determine the vertex offset data corresponding to the i-th frame, wherein the vertex offset data represents the offset of each vertex of the virtual object in the global coordinate system; determining unskinned vertex data based on the initial vertex data and the vertex offset data; performing a linear blending skinning operation on the unskinned vertex data to determine the target vertex data corresponding to the i-th frame.
[0016] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described animation data processing method when running.
[0017] According to another aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the animation data processing method described above.
[0018] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described animation data processing method through the computer program.
[0019] In this embodiment, object animation data and initial vertex data associated with the target object are acquired. The initial vertex data includes the initial positions of each vertex of the virtual cloth configured for the target object in the global coordinate system. The object animation data is used to indicate the motion process of the virtual skeleton of the target object. The object animation data and initial vertex data are input into a pre-trained target motion model to obtain target vertex data. The target vertex data includes the positions of each vertex of the virtual cloth in the global coordinate system that match the object animation data. The target motion model represents the model obtained by training the initial motion model. The loss function used in the training of the initial motion model includes a self-collision loss function, which indicates the degree of collision between any two triangular faces associated with the virtual cloth. Each triangular face is composed of vertices. Rendering is performed based on the target vertex data. The method of generating target animation data that matches the object's animation data involves first acquiring the target object's animation data and initial vertex data, inputting them into a pre-trained target motion model, and then processing the animation data and initial vertex data based on the self-collision loss function in the target motion model to obtain target vertex data. Next, rendering is performed based on the target vertex data to generate target animation data, which is used to better simulate the movement and deformation of virtual objects under different conditions. For example, considering the self-interlacing phenomenon of virtual cloth, the virtual cloth is further adjusted and optimized through the aforementioned self-collision loss function to ensure that the virtual cloth can correctly overlap and cross during the movement, thereby achieving the technical effect of improving the accuracy of target animation data. In turn, it solves the technical problem of low accuracy in animation simulation caused by the self-collision phenomenon of virtual objects during animation rendering. Attached Figure Description
[0020] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0021] Figure 1 This is a schematic diagram of an application environment for an optional animation data processing method according to an embodiment of this application;
[0022] Figure 2 This is a flowchart illustrating an optional animation data processing method according to an embodiment of this application;
[0023] Figure 3 This is a schematic diagram of an optional animation data processing method according to an embodiment of this application;
[0024] Figure 4 This is a schematic diagram of another optional animation data processing method according to an embodiment of this application;
[0025] Figure 5 This is a schematic diagram of another optional animation data processing method according to an embodiment of this application;
[0026] Figure 6 This is a schematic diagram of another optional animation data processing method according to an embodiment of this application;
[0027] Figure 7 This is a schematic diagram of another optional animation data processing method according to an embodiment of this application;
[0028] Figure 8 This is a schematic diagram of another optional animation data processing method according to an embodiment of this application;
[0029] Figure 9 This is a schematic diagram of another optional animation data processing method according to an embodiment of this application;
[0030] Figure 10 This is a schematic diagram of another optional animation data processing method according to an embodiment of this application;
[0031] Figure 11 This is a schematic diagram of the structure of an optional animation data processing apparatus according to an embodiment of this application;
[0032] Figure 12 This is a schematic diagram of the structure of an optional animation data processing product according to an embodiment of this application;
[0033] Figure 13 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application. Detailed Implementation
[0034] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0035] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0036] The present application will be described below with reference to embodiments:
[0037] According to one aspect of the embodiments of this application, a method for processing animation data is provided. Optionally, in this embodiment, the above-described animation data processing method can be applied to, for example... Figure 1 The hardware environment shown consists of server 101 and terminal device 103. For example... Figure 1As shown, server 101 is connected to terminal device 103 via a network and can be used to provide services to terminal device or applications installed on terminal device. Application 107 can be video application, instant messaging application, browser application, educational application, game application, etc. Database 105 can be set up on the server or independently of the server to provide data storage services for server 101, such as a game data storage server. The network mentioned above can include, but is not limited to, wired networks and wireless networks. The wired network includes local area networks, metropolitan area networks, and wide area networks. The wireless network includes Bluetooth, WIFI, and other networks that enable wireless communication. Terminal device 103 can be a terminal configured with an application, and can include, but is not limited to, at least one of the following: mobile phones (such as Android phones, iOS phones, etc.), laptops, tablets, handheld computers, MID (Mobile Internet Devices), PADs, desktop computers, smart TVs, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, virtual reality (VR) terminals, augmented reality (AR) terminals, mixed reality (MR) terminals, and other computer devices. The server mentioned above can be a single server, a server cluster composed of multiple servers, or a cloud server.
[0038] Combination Figure 1 As shown, the above-mentioned animation data processing method can be executed by an electronic device, which can be a terminal device or a server. The above-mentioned animation data processing method can be implemented by the terminal device or the server respectively, or by the terminal device and the server together.
[0039] The above is merely an example, and this embodiment does not impose any specific limitations.
[0040] Alternatively, as an alternative implementation method, such as Figure 2 As shown, the processing method for the above animation data includes:
[0041] S202, Obtain object animation data and initial vertex data associated with the target object, wherein the initial vertex data includes the initial position of each vertex of the virtual object configured for the target object in the global coordinate system, and the object animation data is used to indicate the movement process of the virtual skeleton of the target object;
[0042] For example, the embodiments of this application can be applied to various scenarios such as movie special effects, game development, and virtual reality.
[0043] Optionally, in the embodiments of this application, the target object may include, but is not limited to, virtual characters, virtual animals, etc., and the object animation data may include, but is not limited to, skeletal animation data, shape keyframe data, deformation animation data, etc.
[0044] It should be noted that the aforementioned virtual objects include, but are not limited to, virtual cloth, virtual hair, virtual clothing, virtual headdress, virtual halo, etc. Taking virtual cloth as an example, the aforementioned virtual cloth refers to the cloth associated with the target object, used to simulate the effect of the cloth worn by the target object when it moves. The virtual cloth may include, but is not limited to, attributes such as texture, color, and quality. The virtual cloth may include several of the aforementioned vertices. The several vertices of the virtual cloth can form the boundary of a polygon. By limiting the shape and structure of the virtual cloth in the virtual space corresponding to the aforementioned global coordinate system, it can be understood that by applying force and constraints to the vertices, the deformation and shape of the virtual cloth in motion can be simulated. The aforementioned initial vertex data may include, but is not limited to, the initial position and initial velocity of each vertex of the virtual cloth in the global coordinate system.
[0045] For example, Figure 3 This is a schematic diagram of an optional animation data processing method according to an embodiment of this application, such as... Figure 3 As shown, the target object's clothing is composed of virtual cloth. The global coordinate system is displayed as the X-axis, Y-axis, and Z-axis. The virtual cloth includes vertices A and B. Taking vertex A as an example, the initial position of vertex A can be represented as (2, -4, 5). It can also include the initial velocity of vertex A, for example, the initial velocity is 10 m / s. Thus, the velocity vector of vertex A is determined to be (10, 0, 0) m / s, so that when the virtual cloth starts to move, it can adaptively adjust its speed according to the motion properties of the virtual cloth to move, ensuring that the state changes of the virtual cloth are more realistic.
[0046] In an exemplary embodiment, the target object is a virtual character that will perform a walking action. The object animation data may include, but is not limited to, the rotation and translation information of each skeletal joint of the target object, such as the rotation information of the head bones, the translation information of the body bones, the rotation information of the arm bones, the rotation and translation information of the leg bones, and the translation information of the foot bones.
[0047] S204, Input the object animation data and initial vertex data into the pre-trained target motion model to obtain target vertex data. The target vertex data includes the positions of each vertex of the virtual cloth in the global coordinate system that match the object animation data. The target motion model represents the model obtained by training the initial motion model. The loss function used in the training process of the initial motion model includes the self-collision loss function. The self-collision loss function is used to indicate the degree of collision between any two triangular faces associated with the virtual cloth. The triangular face is composed of vertices.
[0048] Optionally, in the embodiments of this application, the initial motion model may include, but is not limited to, a neural network model, and the target motion model is a model obtained after training the initial motion model. It can be used to generate the target vertex data. Specifically, during the process of the target object adjusting its position, speed, etc. according to the object animation data, the position, speed, etc. of each vertex of the virtual cloth change synchronously, and the target vertex data can be used to indicate how each vertex of the virtual cloth should be adjusted. The triangular facet can be understood as a part of the virtual cloth, and the triangular facet can be composed of three vertices.
[0049] In one exemplary embodiment, Figure 4 This is a schematic diagram illustrating another optional animation data processing method according to an embodiment of this application, such as... Figure 4 As shown, collisions can occur between different parts of the virtual cloth. The collision between different triangular faces in a pair of triangular faces is determined by checking whether they intersect. Specifically, if two triangular faces in a pair intersect, it means that the two triangular faces have collided.
[0050] In another exemplary embodiment, for each pair of triangular facets, the bounding boxes of the triangular facets are first calculated. If the two bounding boxes do not intersect, it can be directly determined that the two triangular facets do not intersect. If the two bounding boxes intersect, the intersection detection of rays and triangles is further performed. This can include, but is not limited to, using a ray-triangle intersection algorithm to check whether two triangular facets intersect. Assume that there are triangular facets A and B in the virtual cloth, which form a pair of triangular facets with vertex coordinates A1, A2, A3 and B1, B2, B3, respectively. First, the bounding boxes of the two triangular facets are calculated. If the bounding boxes intersect, the intersection detection of rays and triangles is continued. Specifically, by calculating the intersection point of rays and triangular facets, if there is an intersection point, it means that the two triangular facets intersect and there is a collision. The collision of triangular facets A and B will cause them to be displaced or deformed.
[0051] For example, during the training of the initial motion model described above, the loss function may include, but is not limited to, the self-collision loss function described above, which may be expressed as, but is not limited to: Among them, v i ,、v j , is the plane vertex where the virtual cloth intersects, for example, Figure 5 This is a schematic diagram illustrating another optional animation data processing method according to an embodiment of this application, such as... Figure 5 As shown, the plane is a triangular facet, b i ,、b j , are the centroid coordinates of the two endpoints of the intersecting line segments of the intersecting triangular facets.
[0052] Furthermore, during each training session, a set of triangular faces exhibiting self-intersection is collected. Then, the intersection points of each intersecting triangular face are calculated one by one. The length of the line segment between two intersection points is then determined using these intersection points. The lengths of all intersecting line segments are summed to obtain the value of the self-collision loss function. This self-collision loss function is then combined with other loss functions from the initial motion model and trained using backpropagation. This can be represented, but is not limited to, as: L total =L selfcollision +L bending +L edge +L gravity +…, where L total L represents the sum of loss functions used during the initial motion model training process. selfcollision L represents the value of the self-collision loss function. bending L edge L gravity All of these are other loss functions in the initial motion model mentioned above. After training, it is ensured that the self-collision loss generated by the model parameters of the initial motion model reaches the minimum value, thus obtaining the target motion model mentioned above. This effectively reduces the number of self-interlacing phenomena generated during the virtual cloth movement indicated by the target vertex data generated by the target motion model.
[0053] It should also be noted that, Figure 6 This is a schematic diagram illustrating another optional animation data processing method according to an embodiment of this application, such as... Figure 6 As shown, the above L bending The loss function representing the bending constraint of adjacent triangular facets 602 can be, but is not limited to, expressed as: Where k is bending stiffness, which can be adjusted manually; L is the side length of the triangular facet; a is the sum of the areas of adjacent triangular facets; b is the current normal angle of adjacent triangular facets; and b′ is the initial angle of adjacent facets, which can be directly determined from the initial vertex data mentioned above. edge The loss function value representing the deformation constraint of the 604-sided triangular facet can be, but is not limited to, expressed as L. edge =k(LL′) 2 Where k is the deformation stiffness, which can be adjusted manually; L is the current side length of the triangular facet; and L′ is the side length of the triangular facet in its initial state, which can be directly determined using the initial vertex data mentioned above. gravity The loss function representing the gravity constraint of the triangular facet can take values including, but not limited to, L. gravity = -Mxg, where M is the weight of the triangular facet, g is the gravitational acceleration vector, and x is the current vertex position.
[0054] S206, renders based on target vertex data, and generates target animation data that matches the object animation data.
[0055] Optionally, in the embodiments of this application, the aforementioned target animation data can be understood as including, but not limited to, data on the deformation, movement, deformation, and folding of virtual cloth.
[0056] For example, the target object is a virtual character, such as... Figure 3 As shown, the target vertex data can change according to the virtual character's movements while wearing a robe. For example, when the virtual character walks, the cloth will sway with the character's leg movements, and when the character bends over, the cloth will deform with the character's body bending. By rendering the virtual character, the virtual cloth can be controlled to deform, move, deform, and fold.
[0057] In an exemplary embodiment, the animation data processing method proposed in this application can be applied to the field of game rendering development. Assuming the target object is a virtual character in a game, and the virtual cloth is the clothing worn by the virtual character, specifically... Figure 7 This is a schematic diagram illustrating another optional animation data processing method according to an embodiment of this application, such as... Figure 7 As shown, including but not limited to:
[0058] S702, acquire angle animation data, that is, object animation data and initial vertex data associated with the virtual character. Object animation data includes data for a period of time before and after the current frame, which can be denoted as (X0, X1, X2...X...). n ), where X0, X1, X2...Xn This represents the rotation information of all bones in the skeletal animation relative to the parent bone in each frame of the object animation data. The first frame corresponds to X0, the second frame corresponds to X1, and so on.
[0059] S704 processes the object animation data and divides the processing results into static information and dynamic information. The static information includes the local spatial rotation information and gravity of the skeleton in each frame, while the dynamic information includes the motion velocity and acceleration of the skeleton in each frame.
[0060] S706, static information and dynamic information are used as inputs to the pre-trained target motion model, respectively, and fed into the static encoder and dynamic encoder in the target motion model for neural network inference, to obtain the combination of static latent space and dynamic latent space output by the static encoder and dynamic encoder, and the initial vertex data obtained in S702 is input into the pre-trained target motion model.
[0061] S708, after processing the combination of static and dynamic latent spaces and the combination of static and dynamic latent spaces through the fully connected layer of the target motion model, the vertex offset of the unskinned clothing fabric animation is obtained.
[0062] S710, in the target motion model, combine the clothing fabric animation vertex offset with the clothing fabric vertices in the initial vertex data obtained in S702 to obtain the unskinned clothing vertex data.
[0063] S712, use character skeletal animation to perform LBS processing on the unskinned clothing vertex data to obtain the skinned clothing vertex data as the above target vertex data. The LBS processing interpolates each vertex of the character model according to its weight with each joint to obtain the final vertex position. During the animation, the character model is naturally deformed, and objects such as clothing fabric attached to the character model can also deform accordingly with the character animation.
[0064] S714 uses target vertex data for rendering, generates target animation data, and uses the target animation data to adaptively adjust the clothing of the virtual character during movement.
[0065] In one exemplary embodiment, the animation data processing method proposed in this application can be applied to the field of film special effects production. Assuming the target object is a virtual character in a film, and the virtual fabric is clothing worn by the virtual character, it may include, but is not limited to:
[0066] S1, Obtain angle animation data, that is, object animation data and initial vertex data associated with the virtual character. Object animation data includes data for a period of time before and after the current frame, which can be denoted as (X0, X1, X2...Xn). Where X0, X1, X2...Xn represent the rotation information of all bones in the skeletal animation relative to the parent bone in each frame of object animation data. The first frame corresponds to X0, the second frame corresponds to X1, and so on.
[0067] S2 processes the object's animation data and divides the processing results into static information and dynamic information. The static information includes the local spatial rotation information and gravity of the skeleton in each frame, while the dynamic information includes the motion velocity and acceleration of the skeleton in each frame.
[0068] S3, static information and dynamic information are used as inputs to the pre-trained target motion model, respectively, and fed into the static encoder and dynamic encoder in the target motion model for neural network inference, to obtain the combination of static latent space and dynamic latent space output by the static encoder and dynamic encoder, and the initial vertex data obtained in S702 is input into the pre-trained target motion model.
[0069] S4, after processing the combination of static and dynamic latent spaces and the combination of static and dynamic latent spaces through the fully connected layer of the target motion model, the vertex offset of the unskinned clothing fabric animation is obtained.
[0070] S5, in the target motion model, combine the clothing fabric animation vertex offset and the clothing fabric vertices in the initial vertex data obtained in S702 to obtain the unskinned clothing vertex data.
[0071] S6. Use character skeletal animation to perform LBS processing on the unskinned clothing vertex data to obtain the skinned clothing vertex data as the target vertex data mentioned above. In the LBS processing, each vertex of the character model is interpolated according to its weight with each joint to obtain the final vertex position. During the animation process, the natural deformation of the character model is realized, and the objects such as clothing fabric attached to the character model can also deform accordingly with the character animation.
[0072] S7 uses target vertex data for rendering, generates target animation data, and uses the target animation data to adaptively adjust the clothing of the virtual character during movement.
[0073] In this embodiment, object animation data and initial vertex data associated with a target object are acquired. The initial vertex data includes the initial positions of each vertex of the virtual cloth configured for the target object in the global coordinate system. The object animation data indicates the motion process of the virtual skeleton of the target object. The object animation data and initial vertex data are input into a pre-trained target motion model to obtain target vertex data. The target vertex data includes the positions of each vertex of the virtual cloth in the global coordinate system that match the object animation data. The target motion model represents the model obtained by training the initial motion model. The loss function used in the training of the initial motion model includes a self-collision loss function, which indicates the degree of collision between any two triangular faces associated with the virtual cloth. Each triangular face is composed of vertices. Rendering is then performed based on the target vertex data. The method for generating target animation data that matches the object's animation data involves first acquiring the target object's animation data and initial vertex data, inputting them into a pre-trained target motion model, and then processing the animation data and initial vertex data based on the self-collision loss function in the target motion model to obtain target vertex data. Next, rendering is performed based on the target vertex data to generate target animation data, which better simulates the movement and deformation of virtual cloth under different conditions. Furthermore, considering the cloth's self-interlacing phenomenon, the virtual cloth is further adjusted and optimized using the aforementioned self-collision loss function to ensure that the virtual cloth can correctly overlap and intersect during movement. This achieves the technical effect of improving the accuracy of the target animation data, thereby solving the technical problem of low accuracy in cloth animation simulation due to the self-collision phenomenon of cloth during animation rendering.
[0074] As an optional approach, the method further includes: acquiring sample object animation data associated with the sample object, wherein the sample object animation data is used to indicate the motion process of the virtual skeleton of the sample object; inputting the sample object animation data and the initial vertex data into the initial motion model to obtain sample vertex data, wherein the sample vertex data includes the positions of each vertex of the virtual cloth that match the sample object animation data in the global coordinate system; determining the loss function of the initial motion model based on the sample vertex data; and determining the initial motion model as the target motion model when the loss function satisfies a preset condition, wherein the self-collision loss function is determined by the length of the intersection line segment of any two triangular facets.
[0075] For example, the target motion model can be obtained by training the initial motion model. Specifically, as in the embodiments of this application, the sample object animation data and the initial vertex data can be input into the initial motion model to obtain the sample vertex data. Based on the sample vertex data, the loss function of the initial motion model is determined. Then, by adjusting the model loss value, the initial motion model ends training when the loss function meets the preset conditions, and the target motion model is obtained.
[0076] Optionally, in the embodiments of this application, the above-mentioned sample objects may include, but are not limited to, virtual characters, virtual animals, etc., and the above-mentioned sample object animation data may include, but are not limited to, skeletal animation data, shape keyframe data, deformation animation data, etc.
[0077] For example, if the sample object is a virtual character that will perform a walking action, then the animation data of the sample object may include, but is not limited to, the rotation and translation information of each skeletal joint of the sample object, such as the rotation information of the head bones, the translation information of the body bones, the rotation information of the arm bones, the rotation and translation information of the leg bones, and the translation information of the foot bones.
[0078] In an exemplary embodiment, the above-mentioned sample object animation data and the above-mentioned initial vertex data are input into the above-mentioned initial motion model, and the model output is the sample vertex data. The loss function of the initial motion model may include, but is not limited to, the expression: L total =L selfcollision +L bending +L edge +L gravity +…, where L total L represents the sum of loss functions used during the initial motion model training process. selfcollision L represents the value of the self-collision loss function. bending L edge L gravity These are all other loss functions in the initial motion model described above.
[0079] Furthermore, the aforementioned preset conditions can be flexibly set. For example, when the value of the loss function is less than or equal to a preset value (which can be set according to actual business needs), the loss function is considered to meet the preset conditions, and the current initial motion model can be determined as the aforementioned target motion model.
[0080] It should be noted that the loss function mentioned above includes a self-collision loss function, which can be understood as follows: when two triangular faces of the virtual cloth intersect, the longer the length of the intersection line segment, the more severe the collision between the two faces, and the greater the loss. This self-collision loss function can be used as an indicator to evaluate the severity of the collision in order to optimize collision detection and solve collision problems.
[0081] In one exemplary embodiment, Figure 8 This is a schematic diagram illustrating another optional animation data processing method according to an embodiment of this application, such as... Figure 8 As shown, including but not limited to:
[0082] S802, Obtain angle animation data, that is, sample object animation data and initial vertex data associated with the sample object. The object animation data includes data for a period of time before and after the current frame, which can be denoted as (X0, X1, X2...Xn). Where X0, X1, X2...Xn represent the rotation information of all bones in the skeletal animation relative to the parent bone in each frame of object animation data. The first frame corresponds to X0, the second frame corresponds to X1, and so on.
[0083] S804 processes the animation data of the sample object and divides the processing results into static information and dynamic information. The static information includes the local spatial rotation information and gravity of the skeleton in each frame, and the dynamic information includes the motion velocity and acceleration in the local spatial space of the skeleton in each frame.
[0084] S806, static information and dynamic information are used as inputs to the pre-trained initial motion model, respectively, and fed into the static encoder and dynamic encoder in the initial motion model for neural network inference, to obtain the combination of static latent space and dynamic latent space output by the static encoder and dynamic encoder, and the initial vertex data obtained in S802 is input into the pre-trained initial motion model.
[0085] S808, after processing the combination of static and dynamic latent spaces and the combination of static and dynamic latent spaces through the fully connected layer of the initial motion model, obtains the vertex offset of the unskinned clothing fabric animation.
[0086] S810, in the initial motion model, the offset of the clothing fabric animation vertex and the clothing fabric vertex in the initial vertex data obtained in S802 are combined to obtain the unskinned clothing vertex data.
[0087] S812, use character skeletal animation to perform LBS processing on the unskinned clothing vertex data to obtain the skinned clothing vertex data as the above sample vertex data. In the LBS processing, each vertex of the character model is interpolated according to its weight with each joint to obtain the final vertex position. During the animation, the natural deformation of the character model is realized, and the objects such as clothing fabric attached to the character model can also deform accordingly with the character animation.
[0088] S814 uses sample vertex data to determine the loss function of the initial motion model, trains the initial motion model in multiple rounds to make the loss function meet the preset conditions, and obtains the target motion model.
[0089] In this embodiment, the animation data of the sample object associated with the sample object is first obtained; the animation data of the sample object and the initial vertex data are input into the initial motion model to obtain the sample vertex data; the loss function of the initial motion model is determined according to the sample vertex data; and if the loss function meets the preset conditions, the initial motion model is determined as the target motion model to achieve the purpose of training the initial motion model, ensure the accuracy of the initial motion model training, and improve the stability and usability of the target motion model.
[0090] As an optional approach, the above-mentioned loss function for determining the initial motion model based on the sample vertex data, and determining the initial motion model as the target motion model when the loss function meets preset conditions, includes: combining any two triangular facets of the virtual cloth to determine multiple pairs of triangular facets; obtaining the length of the intersection line segment of each pair of triangular facets; performing an accumulation operation on the length of the intersection line segment of each pair of triangular facets to obtain the value of the self-collision loss function; determining the value of the loss function based on the value of the self-collision loss function; and determining the initial motion model as the target motion model when the value of the loss function meets preset value conditions.
[0091] For example, after determining the above sample vertex data, as in the embodiments of this application, any two triangular faces of the above virtual cloth can be combined to determine multiple pairs of triangular faces; then, the length of the intersecting line segments of each pair of triangular faces is calculated and accumulated to obtain the value of the self-collision loss function; then, the value of the loss function is determined according to the self-collision loss function, and the target motion model is determined after the preset conditions are met.
[0092] Optionally, in the embodiments of this application, the virtual cloth includes several vertices, any three vertices can determine one of the above-mentioned triangular facets, and any two triangular facets can be used as a pair of triangular facets.
[0093] In one exemplary embodiment, assuming the virtual cloth has 4 vertices, then 4 triangular facets and 6 pairs of triangular facets can be determined.
[0094] In another exemplary embodiment, the length of the intersecting line segment of each of the six pairs of triangular facets is first obtained, which can be denoted as L1 to L6. Further, the above accumulation operation can be understood as: obtaining the value L of L1+L2+L3+L4+L5+L6, and using L as the value of the above self-collision loss function.
[0095] In another exemplary embodiment, the above accumulation operation can also be understood as: setting weights for the lengths of each intersecting line segment based on factors such as the degree of overlap of each pair of triangular facets and the fabric type corresponding to each triangular facet, and taking the weighted sum of L1 to L6 as the value of the above self-collision loss function. By setting weights, different degrees of punishment or compensation are achieved for collisions of different fabric types, making collision detection more accurate and flexible, and better simulating the impact of different collision situations in the real world. Furthermore, by adjusting the weights, the accuracy of the self-collision loss function can be adjusted according to specific needs.
[0096] In this embodiment, multiple pairs of triangular facets are determined by combining any two triangular facets of the virtual cloth; the length of the intersection line segment of each pair of triangular facets is obtained; the length of the intersection line segment of each pair of triangular facets is accumulated to obtain the value of the self-collision loss function; the value of the loss function is determined based on the value of the self-collision loss function; and the initial motion model is determined as the target motion model when the value of the loss function meets the preset value conditions, thereby improving the accuracy of self-collision detection of the virtual cloth.
[0097] As an optional approach, obtaining the length of the intersecting line segment of each pair of triangular facets in the plurality of pairs of triangular facets includes: obtaining a first triangular facet and a second triangular facet, wherein the first triangular facet and the second triangular facet represent any pair of triangular facets in the plurality of pairs of triangular facets; determining whether the first triangular facet and the second triangular facet intersect; if the first triangular facet and the second triangular facet intersect, obtaining the centroid coordinate data of the intersection point, wherein the centroid coordinate data represents the position of the intersection point in the local coordinate system; determining the intersection point coordinate data based on the facet vertex data of the first triangular facet or the second triangular facet and the centroid coordinate data, wherein the intersection point coordinate data represents the position of the intersection point in the global coordinate system; and determining the length of the target intersecting line segment associated with the first triangular facet and the second triangular facet based on the intersection point coordinate data, wherein the intersecting line segment includes the target intersecting line segment.
[0098] For example, after determining the multiple pairs of triangular facets, as in the embodiments of this application, the length of the intersecting line segment of each pair of triangular facets can be obtained first, and it can be determined in turn whether there are intersecting triangular facets. Then, the centroid coordinate data of the intersection point is obtained, the intersection point coordinate data is obtained, and then the length of the intersecting line segment is determined using the intersection point coordinate data. Finally, the value of the self-collision loss function is determined using the length of the intersecting line segment, thereby realizing the training of the initial motion model.
[0099] Optionally, in the embodiments of this application, the first triangular facet and the second triangular facet refer to different triangular facets in a pair of triangular facets, which may or may not collide. The centroid coordinate data refers to the coordinate data of the two endpoints (the intersection points) of the intersecting line segments.
[0100] For example, such as Figure 5 As shown, the triangle includes a first triangular facet and a second triangular facet. The endpoints of the line segments intersecting the triangle are endpoint A and endpoint B, respectively. Therefore, the above centroid coordinate data includes the coordinate data of endpoint A (2, 3, 4) and the coordinate data of endpoint B (5, 6, 7).
[0101] It should be noted that the above centroid coordinate data represents the coordinate position of the intersection point in the coordinate system (the above local coordinate system) related to the triangular facet, and its origin may include, but is not limited to, the center position of the triangular facet.
[0102] Furthermore, after obtaining the above-mentioned centroid coordinate data, the coordinate system of the centroid coordinate data can be transformed so that the center coordinate data is mapped from the local coordinate system to the global coordinate system, thereby obtaining the intersection point coordinate data. This can include, but is not limited to, obtaining the coordinate position of the intersection point in the global coordinate system based on the above-mentioned face vertex data in the global coordinate system. That is, the intersection point coordinate data is obtained. Then, the distance between the two intersection points corresponding to the intersection point coordinates is determined using the intersection point coordinate data as the above-mentioned target intersection length.
[0103] Through the embodiments of this application, the following steps are taken: obtaining a first triangular facet and a second triangular facet; determining whether the first and second triangular facets intersect; if the first and second triangular facets intersect, obtaining the centroid coordinate data of the intersection point; determining the intersection point coordinate data based on the facet vertex data and centroid coordinate data of the first or second triangular facet; and determining the length of the target intersecting line segment associated with the first and second triangular facets based on the intersection point coordinate data. These operations are performed on each pair of triangular facets to effectively determine the position of the intersection point and obtain the length of the intersecting line segment, thereby improving the usability and accuracy of the intersection point coordinate data.
[0104] As an optional approach, determining the intersection coordinate data based on the vertex data of the first or second triangular facet and the centroid coordinate data includes: obtaining the first vertex data of the first triangular facet and performing a weighted operation on the coordinates of each vertex in the first vertex data based on the centroid coordinate data to determine the intersection coordinate data; or obtaining the second vertex data of the second triangular facet and performing a weighted operation on the coordinates of each vertex in the second vertex data based on the centroid coordinate data to determine the intersection coordinate data.
[0105] For example, after obtaining the above-mentioned centroid coordinate data, the intersection coordinate data can be determined based on the first vertex data and centroid coordinate data of the first triangular facet and the second vertex data and centroid coordinate data of the second triangular facet, as in the embodiments of this application.
[0106] Optionally, in the embodiments of this application, the first vertex data may include, but is not limited to, the coordinate data of the three vertices of the first triangular facet, and the second vertex data may include, but is not limited to, the coordinate data of the three vertices of the second triangular facet.
[0107] Furthermore, after obtaining the first vertex data, the centroid coordinate data can be used to perform a weighted operation on the coordinates of each vertex in the first vertex data to obtain the intersection coordinate data.
[0108] In an exemplary embodiment, the first vertex data includes the coordinates of vertex A Va:(Xa, Ya, Za), the coordinates of vertex B Vb:(Xb, Yb, Zb), and the coordinates of vertex C Vc:(Xc, Yc, Zc). A weighted operation is performed based on the centroid coordinate data. Assuming the centroid coordinate data are (X1, Y1, Z1) and (X2, Y2, Z2), the intersection point coordinate data can be represented as (Va*X1, Vb*Y1, Vc*Z1) and (Va*X2, Vb*Y2, Vc*Z2). Accordingly, the intersection length of the aforementioned targets can be determined as the distance between the intersection point represented by (Va*X1, Vb*Y1, Vc*Z1) and the intersection point represented by (Va*X2, Vb*Y2, Vc*Z2).
[0109] In another exemplary embodiment, the second vertex data includes the coordinates of vertex A, V'a: (Xa, Ya, Za), the coordinates of vertex B, V'b: (Xb, Yb, Zb), and the coordinates of vertex C, V'c: (Xc, Yc, Zc). A weighted operation is performed based on the centroid coordinate data. Assuming the centroid coordinate data are (X1, Y1, Z1) and (X2, Y2, Z2), the intersection point coordinate data can be represented as (V'a*X1, V'b*Y1, V'c*Z1) and (V'a*X2, V'b*Y2, V'c*Z2). Accordingly, the target intersection length can be determined as the distance between the intersection point represented by (V'a*X1, V'b*Y1, V'c*Z1) and the intersection point represented by (V'a*X2, V'b*Y2, V'c*Z2).
[0110] In one exemplary embodiment, Figure 9 This is a schematic diagram illustrating another optional animation data processing method according to an embodiment of this application, such as... Figure 9 As shown, including but not limited to:
[0111] S902, calculate whether the first triangular facet and the second triangular facet intersect. If they do, execute S904; otherwise, end.
[0112] S904, obtain the centroid coordinates of the triangular facets at the intersection points;
[0113] S906 obtains vertex coordinate data from the Cloth Vertex Parameter Matrix (information of each vertex corresponding to the global coordinate system), and performs a weighted operation using the centroid coordinate data. The Cloth Vertex Parameter Matrix is a matrix used to store vertex coordinate data. In computer graphics, it is used to represent the vertex position information in cloth simulation. By accessing this matrix, the specific coordinate data of each vertex can be obtained, thereby realizing the control and adjustment of cloth simulation.
[0114] S908, obtain the coordinates of the intersection point;
[0115] S910, calculates the length of intersecting line segments using the intersection point coordinate data;
[0116] S912, sum the Loss values of all intersecting triangular faces to obtain the Self-collision Loss.
[0117] S914, End.
[0118] As an optional approach, determining the value of the loss function based on the value of the self-collision loss function, and determining the initial motion model as the target motion model when the value of the loss function meets a preset value condition, includes: obtaining a set of potential energy functions set for the initial motion model, wherein the potential energy functions in the set are used to constrain the shape and size of arbitrary triangular facets of the virtual cloth; determining the value of the loss function as the sum of the values of each potential energy function in the set and the value of the self-collision loss function; and determining the initial motion model as the target motion model when the value of the loss function meets the preset value condition.
[0119] For example, during the training of the initial motion model, the set of potential energy functions is first obtained, then the values of each potential energy function are obtained, and the values of the loss function are generated using these multiple values and the values of the self-collision loss function. Then, the model parameters of the initial motion model are adjusted based on the values of the loss function to train the model.
[0120] Optionally, in this embodiment, the set of potential energy functions may include several potential energy functions. These potential energy functions refer to the energy possessed by the target object under force, that is, the potential energy value at different locations. This may include, but is not limited to, the bending constraint potential energy function L of adjacent surfaces. bending Side-length deformation constraint potential energy function L edge Gravitational constraint potential energy function L gravity wait.
[0121] For example, such as Figure 6 As shown, the bending constraint potential energy function L bending It can be represented as including but not limited to Side-length deformation constraint potential energy function L edge It can be represented as L, but is not limited to. edge =k(LL′) 2 Gravitational constraint potential energy function L gravity It can be represented as L, but is not limited to. gravity =-Mxg.
[0122] In an exemplary embodiment, the shape constraint potential energy function of the triangular facet is used to constrain the shape of the triangular facet, for example, to keep the side length or angle of the triangular facet within a certain range; the side length deformation constraint potential energy function is used to constrain the side length of the triangular facet; the self-collision loss function is used to constrain the collision between different parts inside the virtual cloth, to avoid the cloth itself from interpenetrating or overlapping. The value of the above loss function can be expressed as the sum of the value of the above potential energy function and the value of the self-collision function. When the value of the above loss function meets the preset value condition, the initial motion model can be determined as the target motion model to ensure the accuracy of the target motion model.
[0123] As an optional approach, the above-mentioned input of the object animation data and the initial vertex data into the pre-trained target motion model to obtain target vertex data includes: extracting animation data from frame ip to frame i+q from the object animation data, wherein the object animation data includes N frames, i≤N, ip≤N, i+q≤N, and i, p, q, and N are all positive integers; determining the static animation data and dynamic animation data corresponding to frame i based on the animation data from frame ip to frame i+q, wherein the static animation data includes the bone rotation information of the target object in each frame, and the dynamic animation data includes the bone rotation speed of the target object in each frame; and determining the target vertex data corresponding to frame i based on the static animation data, the dynamic animation data, and the initial vertex data.
[0124] For example, in the above target motion model, in the process of determining the target vertex data based on the object animation data and the initial vertex data, as in the embodiments of this application, a pre-trained target motion model can be used to extract the animation data from frame ip to frame i+q by combining the object animation data and the initial vertex data, determine the static animation data and dynamic animation data corresponding to each frame, and finally generate the target vertex data.
[0125] Optionally, in the embodiments of this application, the animation data from the ipth frame to the i+qth frame may include, but is not limited to, the target object, which may perform virtual actions such as movement in these frames of animation data.
[0126] In an exemplary embodiment, it is assumed that the above object animation data includes the skeletal rotation information and skeletal rotation speed of frames 1 to 10, and i is 5. That is, it is necessary to determine the static animation data and dynamic animation data corresponding to frame 5. The static animation data refers to the skeletal rotation information of frame 5, and the dynamic animation data refers to the skeletal rotation speed of frame 5. Given the skeletal rotation information and skeletal rotation speed of frames 1 to 4 and frames 6 to 10, the static animation data and dynamic animation data of frame 5 can be determined based on the skeletal rotation information and skeletal rotation speed of frames 1 to 4 and frames 6 to 10. Specifically, this can be achieved by prediction using linear interpolation or other interpolation algorithms, including but not limited to.
[0127] Through the embodiments of this application, the animation data of the i-th frame can be inferred based on the known bone rotation information and speed information, making the entire animation sequence more visually coherent and natural. Furthermore, the target vertex data can be generated using the aforementioned static and dynamic animation data corresponding to each frame.
[0128] As an optional approach, the above-mentioned determination of the static animation data and dynamic animation data corresponding to the i-th frame based on the animation data from the i-th frame to the i+q-th frame includes: determining the animation data of the i-th frame as the static animation data, wherein the static animation data further includes gravity data for each frame; and determining the animation data from the i-th frame to the i-1-th frame and the animation data from the i+1-th frame to the i+q-th frame as the dynamic animation data, wherein the dynamic animation data further includes acceleration data for each frame.
[0129] For example, in the process of determining the static animation data and dynamic animation data corresponding to the i-th frame, as in the embodiments of this application, the animation data of the i-th frame can be determined by using the animation data of the i-th frame to the i+q-th frame, and the animation data of the i-th frame and the gravity data of each frame can be used as the static animation data. Then, the dynamic animation data of each frame can be determined.
[0130] Optionally, in the embodiments of this application, the aforementioned static animation data may include, but is not limited to, static image data, audio data, animation effect data, object design data, layout design data, color design data, text animation data, special effects data, etc.; the aforementioned gravity data may include, but is not limited to, gravitational field strength, gravitational potential energy, gravitational field gradient, etc.; the aforementioned acceleration data may include, but is not limited to: linear acceleration data: describing the acceleration of an object in linear motion, usually expressed in meters per second. 2 Angular acceleration data: describes the acceleration of an object during rotational motion, usually expressed in radians per second. 2The data can be categorized as follows: Three-axis acceleration data: describes the acceleration changes of an object along three axes, usually expressed as acceleration values along the X, Y, and Z axes; Vibration acceleration data: describes the acceleration changes of an object during vibration or oscillation, usually expressed as frequency and amplitude; Impact acceleration data: describes the instantaneous acceleration changes of an object when subjected to impact or collision, etc.
[0131] In an exemplary embodiment, assuming the object animation data includes data from frame 1 to frame 10, and it is necessary to determine the static animation data and dynamic animation data of frame 5, firstly, the animation data of frame 5 is determined as static animation data, including the position, rotation, and scaling data of frame 5, as well as gravity data; then, the data from frames 1 to 4 and frames 6 to 10 are determined as dynamic animation data, including the position, rotation, and scaling data of each frame, as well as acceleration data.
[0132] In the embodiments of this application, the animation data of the i-th frame is determined as the static animation data; and the animation data of the i-th to i-1-th frames and the animation data of the i+1 to i+q-th frames are determined as the dynamic animation data, thereby ensuring the accuracy of the static and dynamic animation data.
[0133] As an optional approach, determining the target vertex data corresponding to the i-th frame based on the static animation data, the dynamic animation data, and the initial vertex data includes: inputting the static animation data into a static encoder to obtain a static latent space, wherein the target motion model includes the static encoder; inputting the dynamic animation data into a dynamic encoder to obtain a dynamic latent space, wherein the target motion model includes the dynamic encoder; inputting the static latent space and the dynamic latent space into a target fully connected layer, and combining the initial vertex data to determine the target vertex data corresponding to the i-th frame.
[0134] For example, after obtaining the static animation data and the dynamic animation data, the static latent space is determined based on the static animation data; similarly, the dynamic latent space is determined based on the dynamic animation data, and then the static latent space and the dynamic latent space are input into the target fully connected layer to obtain the target vertex data.
[0135] Optionally, in this embodiment, the static encoder can be understood as converting the input static data into a fixed-length vector representation. The static encoder can be a module of the target motion model. The static latent space refers to the vector space representing the static features of the virtual cloth obtained in the static encoder. The dynamic encoder can be understood as converting the input dynamic data into a fixed-length vector representation. The dynamic encoder can be a module of the target motion model. The dynamic latent space refers to the vector space representing the dynamic features of the virtual cloth obtained in the dynamic encoder. The target fully connected layer is used to combine the information of the static latent space and the dynamic latent space to determine the target vertex data corresponding to each frame.
[0136] In an exemplary embodiment, it is assumed that the static animation data is an image of a static target object, which is converted into a static latent space by a static encoder. Meanwhile, the dynamic animation data is the target object dancing, which is converted into a dynamic latent space by a dynamic encoder. Then, the static latent space and the dynamic latent space are input into the target fully connected layer, and the data of the target object dancing in each frame is determined by combining the virtual cloth associated with the target object, so as to show the process of the target object dancing.
[0137] In this embodiment, static animation data is input into a static encoder to obtain a static latent space; dynamic animation data is input into a dynamic encoder to obtain a dynamic latent space; the static latent space and the dynamic latent space are input into a target fully connected layer, and the target vertex data corresponding to the i-th frame is determined by combining the initial vertex data, thereby improving the accuracy of the target vertex data.
[0138] As an optional approach, the above-mentioned input of the static latent space and the dynamic latent space to the target fully connected layer, and the determination of the target vertex data corresponding to the i-th frame in combination with the initial vertex data, includes: inputting the static latent space and the dynamic latent space to the target fully connected layer to determine the vertex offset data corresponding to the i-th frame, wherein the vertex offset data represents the offset of each vertex of the virtual cloth in the global coordinate system; determining the unskinned vertex data based on the initial vertex data and the vertex offset data; and performing a linear blending skinning operation on the unskinned vertex data to determine the target vertex data corresponding to the i-th frame.
[0139] For example, after obtaining the static latent space and the dynamic latent space, the static latent space, the dynamic latent space, and the initial vertex data are input into the target fully connected layer. As in the embodiments of this application, the static latent space and the dynamic latent space are used to determine the vertex offset data. Then, the unskinned vertex data is obtained based on the vertex offset data and the initial vertex data. A linear blending skinning operation is performed on the unskinned vertex data to obtain the target vertex data.
[0140] Optionally, in the embodiments of this application, the vertex offset data mentioned above refers to the offset of the vertices of the virtual cloth relative to their initial positions; the unskinned vertex data mentioned above can be understood as the vertex data of the virtual cloth that has not undergone material mapping processing, that is, the original vertex coordinates, normals, texture coordinates and other information of the virtual cloth.
[0141] For example, assuming the virtual cloth includes several vertices, the vertex offset data of the i-th frame is obtained. The unskinned vertex data can be calculated by adding the coordinates of each vertex according to the corresponding offset data. If normal data exists, the same operation is required to calculate the new unskinned cloth normal data. The calculation method of the normal data can be determined by adding the initial normal data and the corresponding offset data.
[0142] Furthermore, after obtaining the above-mentioned unskinned vertex data, a linear blending skinning operation can be performed on the unskinned vertex data to obtain the above-mentioned target vertex data. The above-mentioned linear blending skinning operation refers to calculating the weight of each vertex in different bones and performing a skinning operation on each vertex according to these weights.
[0143] In one exemplary embodiment, the animation data processing method proposed in this application can be applied to cloth simulation application scenarios based on neural networks.
[0144] First, some nouns or terms that appear in the description of the embodiments of this application shall be interpreted as follows:
[0145] Neural networks: Neural networks are computational models that simulate the structure of neurons in the human brain, and are widely used in machine learning and artificial intelligence. By learning the features and patterns of data, neural networks can perform tasks such as prediction, classification, and regression.
[0146] Cloth simulation: Cloth simulation is an important problem in computer graphics, which mainly studies how to accurately and realistically simulate the movement and shape changes of cloth in a computer.
[0147] Energy optimization problems refer to finding a set of variables that minimizes a certain energy function. In cloth simulations, the energy function typically describes the difference between the physical state and the ideal state of the cloth.
[0148] Physical state: Physical state describes the state of a physical system at a certain moment, such as the shape and velocity of cloth.
[0149] External forces: External forces are forces that act on a physical system, such as gravity and wind.
[0150] Optimization algorithms: Optimization algorithms are a class of algorithms used to find the values of variables that maximize or minimize a given function. In this context, optimization algorithms are used to find the physical states that minimize the energy function.
[0151] Collision-free: This usually means that at the start of the simulation, there are no collisions between the cloth and other objects (including different parts of the cloth itself).
[0152] The loss function is used to train a neural network for cloth simulation. This loss function consists of multiple parts, each corresponding to a physical constraint, such as mass-spring deformation constraints, bending constraints, gravity constraints, etc. Each constraint defines a loss term representing the difference between the model's predicted cloth state and that constraint.
[0153] Bending stiffness describes a fabric's ability to resist bending when subjected to a bending force. The greater the bending stiffness, the less the fabric bends when subjected to the same bending force.
[0154] LBS: Linear Blend Skinning, a technique commonly used in computer graphics to achieve shape deformation and animation of 3D models.
[0155] Specifically, the embodiments of this application can solve the cloth self-collision problem in neural network simulation. The loss function of the target motion model does not depend on the collision-free assumption, and therefore is suitable for the network training process of deep learning.
[0156] For example, Figure 10 This is a schematic diagram illustrating another optional animation data processing method according to an embodiment of this application, such as... Figure 10As shown in Figure 1002, the cloth simulation effect before adding self-collision (the self-collision loss function) is as shown in Figure 1004, and the cloth simulation effect after adding self-collision is as shown in Figure 1004. It should be noted that in physics, potential energy is the energy possessed by a system due to its internal state (such as position, shape, etc.). In optimization problems, the potential energy function can be defined as a loss function, making minimizing the potential energy function equivalent to minimizing the loss function.
[0157] Specifically, we first define a potential energy function that describes the difference between the system's internal state and the target state we want to achieve. For example, we can define the potential energy function as the squared error between the predicted and actual values. When the predicted value is close to the actual value, the value of the potential energy function will be very small. Next, we define a dynamic system, where the stable point of the dynamic system is the minimum point of the potential energy function. In the dynamic system, the system's state will naturally evolve towards the minimum point of the potential energy function. At this point, we design a neural network (the target motion model mentioned above). The dynamic behavior of this neural network is the evolution process of the dynamic system. By training the neural network, it can learn how to simulate the evolution process of the dynamic system, thereby learning how to minimize the potential energy function.
[0158] Furthermore, in practical applications, the movement of the clothing (the aforementioned virtual cloth) is related to the character's movement over a period of time and external forces (such as gravity). Therefore, in the training process, the animation data of the character (the aforementioned sample object) over a period of time is first collected. For example, the rotation information X of all bones relative to the parent bone in each frame of skeletal animation, the animation information at time t0 is called X0, the animation information at time t1 is called X1, and the animation information at time tn is called Xn. X1 to Xn are processed, and the processing results are divided into static information and dynamic information. The static information includes the local spatial rotation information and gravity of each frame of bones, and the dynamic information includes the motion velocity and acceleration in the local spatial space of each frame of bones. The static information and dynamic information are respectively input into the static encoder and the dynamic encoder for neural network inference. After obtaining the combination of the static latent space and the dynamic latent space output by the encoder, the static latent space and the dynamic latent space are then input into a fully connected layer to obtain the vertex offset of the unskinned clothing cloth animation output by the network. This is combined with the clothing vertices and then LBS processing is performed using the character skeletal animation to obtain the skinned clothing vertex data. Finally, the neural network outputs clothing fabric data, and the loss function is used to calculate the loss to complete the neural network parameter learning.
[0159] For example, in the inference phase of the target motion model, the animation information of the character for a period of time before and after the current frame is first obtained, that is, the rotation information X of all bones in the skeletal animation relative to the parent bone during this period. Similar to the training phase, X is processed into two parts, dynamic information and static information, and then input into the network. The offset of the clothing fabric vertex output by the model is determined, and after LBS processing, the clothing vertex data (the above target vertex data) is obtained. Finally, the fabric vertex is rendered to the screen.
[0160] It is understandable that the aforementioned self-collision loss can be interpreted as a history-free method for handling self-collision issues in cloth simulations. The self-collision handling for each frame is independent, independent of the state or collision handling result of the previous frame. This means that self-collision in the current frame can be handled directly without needing to know how the cloth moved or collided in the past. Even if the cloth is in a self-interlacing state in the current frame, it can still be handled. The processing flow may include, but is not limited to:
[0161] S1. First, detect the self-collision of the fabric. This is usually done by checking whether each pair of triangular facets of the fabric intersects. If two triangular facets intersect, then there is a self-collision.
[0162] S2, Once a self-collision is detected, the algorithm needs to calculate a correction amount so that the intersecting triangles no longer intersect after the correction amount is applied;
[0163] S3 applies the correction to the fabric's state, including its position and velocity. This can be done by directly modifying the fabric's state or by applying an impulse. After applying the correction, intersecting triangles should no longer intersect.
[0164] The process from S1 to S3 will be repeated until all self-collisions are resolved. In each step, the algorithm will find a self-collision and try to resolve the collision problem.
[0165] In an exemplary embodiment, a self-collision loss function (as described above) can be designed. This function utilizes the principle of history-free self-collision processing to solve the problems of traditional collision processing. It does not rely on collision-free states and can therefore be freely incorporated into the training of the cloth simulation neural network. Among them, v i, v j, b is the vertex of the intersecting triangle. i, b j, These are the centroid coordinates of the intersection points within the triangle.
[0166] Furthermore, during each training iteration, a set of all self-collision triangles is collected, and the intersection points of each intersecting triangle are calculated one by one. The length of the line segment between any two intersection points is then determined. The overall loss function of the model is the sum of the lengths of all intersecting line segments. Next, the values of the self-collision loss and other loss functions are combined and fed into the backpropagation of the neural network, which can be expressed as L... total =L selfcollision +L bending +L edge +L gravity +…
[0167] Through the embodiments of this application, the self-collision loss generated by the model parameters after the initial motion model training is minimized, ensuring that the target vertex data generated by the target motion model will not or will have less self-collision.
[0168] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0169] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0170] According to another aspect of the embodiments of this application, an animation data processing apparatus for implementing the above-described animation data processing method is also provided. For example... Figure 11 As shown, the device includes:
[0171] The acquisition module 1102 is used to acquire object animation data and initial vertex data associated with the target object. The initial vertex data includes the initial positions of each vertex of the virtual cloth configured for the target object in the global coordinate system, and the object animation data is used to indicate the movement process of the virtual skeleton of the target object.
[0172] The execution module 1104 is used to input object animation data and initial vertex data into a pre-trained target motion model to obtain target vertex data. The target vertex data includes the positions of each vertex of the virtual cloth in the global coordinate system that match the object animation data. The target motion model represents the model obtained by training the initial motion model. The loss function used in the training process of the initial motion model includes a self-collision loss function. The self-collision loss function is used to indicate the degree of collision between any two triangular faces associated with the virtual cloth. The triangular face is composed of vertices.
[0173] The generation module 1106 is used to render based on the target vertex data and generate target animation data that matches the object animation data.
[0174] As an optional solution, the above-mentioned device is further used to: acquire sample object animation data associated with the sample object, wherein the sample object animation data is used to indicate the motion process of the virtual skeleton of the sample object; input the sample object animation data and initial vertex data into the initial motion model to obtain sample vertex data, wherein the sample vertex data includes the positions of each vertex of the virtual cloth that match the sample object animation data in the global coordinate system; determine the loss function of the initial motion model based on the sample vertex data, and determine the initial motion model as the target motion model when the loss function meets the preset conditions, wherein the self-collision loss function is determined by the length of the intersection line segment of any two triangular facets.
[0175] As an optional approach, the aforementioned device is used to determine the loss function of the initial motion model based on sample vertex data in the following manner, and to determine the initial motion model as the target motion model if the loss function meets preset conditions: combining any two triangular facets of the virtual cloth to determine multiple pairs of triangular facets; obtaining the length of the intersection line segment of each pair of triangular facets; performing an accumulation operation on the length of the intersection line segment of each pair of triangular facets to obtain the value of the self-collision loss function; determining the value of the loss function based on the value of the self-collision loss function, and determining the initial motion model as the target motion model if the value of the loss function meets preset value conditions.
[0176] As an optional solution, the above-described apparatus is used to obtain the length of the intersecting line segment of each pair of triangular facets in a plurality of pairs of triangular facets in the following manner: obtaining a first triangular facet and a second triangular facet, wherein the first triangular facet and the second triangular facet represent any pair of triangular facets in the plurality of pairs of triangular facets; determining whether the first triangular facet and the second triangular facet intersect; if the first triangular facet and the second triangular facet intersect, obtaining the centroid coordinate data of the intersection point, wherein the centroid coordinate data represents the position of the intersection point in the local coordinate system; determining the intersection point coordinate data based on the facet vertex data and centroid coordinate data of the first or second triangular facet, wherein the intersection point coordinate data represents the position of the intersection point in the global coordinate system; and determining the length of the target intersecting line segment associated with the first triangular facet and the second triangular facet based on the intersection point coordinate data, wherein the intersecting line segment includes the target intersecting line segment.
[0177] As an optional solution, the above-mentioned device is used to determine the intersection coordinate data based on the vertex data and centroid coordinate data of the first or second triangular facet in the following manner: obtaining the first vertex data of the first triangular facet, and performing a weighted operation on the coordinates of each vertex in the first vertex data based on the centroid coordinate data to determine the intersection coordinate data; or obtaining the second vertex data of the second triangular facet, and performing a weighted operation on the coordinates of each vertex in the second vertex data based on the centroid coordinate data to determine the intersection coordinate data.
[0178] As an optional approach, the aforementioned device is used to determine the value of the loss function based on the value of the self-collision loss function in the following manner: when the value of the loss function meets a preset value condition, the initial motion model is determined as the target motion model: obtaining a set of potential energy functions set for the initial motion model, wherein the potential energy functions in the set of potential energy functions are used to constrain the shape and size of arbitrary triangular facets of the virtual cloth; determining the value of the loss function by the sum of the values of each potential energy function in the set of potential energy functions and the value of the self-collision loss function; and determining the initial motion model as the target motion model when the value of the loss function meets the preset value condition.
[0179] As an optional approach, the aforementioned device is used to input object animation data and initial vertex data into a pre-trained target motion model to obtain target vertex data in the following manner: extracting animation data from frame ip to frame i+q from the object animation data, wherein the object animation data includes N frames, i≤N, ip≤N, i+q≤N, and i, p, q, and N are all positive integers; determining static animation data and dynamic animation data corresponding to frame i based on the animation data from frame ip to frame i+q, wherein the static animation data includes the bone rotation information of the target object in each frame, and the dynamic animation data includes the bone rotation speed of the target object in each frame; and determining the target vertex data corresponding to frame i based on the static animation data, dynamic animation data, and initial vertex data.
[0180] As an optional approach, the above-mentioned device is used to determine the static animation data and dynamic animation data corresponding to the i-th frame based on the animation data from the ip-th frame to the i+q-th frame in the following manner: the animation data of the i-th frame is determined as static animation data, wherein the static animation data also includes gravity data for each frame; the animation data from the ip-th frame to the (i-1)-th frame and the animation data from the i+1-th frame to the i+q-th frame are determined as dynamic animation data, wherein the dynamic animation data also includes acceleration data for each frame.
[0181] As an optional approach, the aforementioned apparatus is used to determine the target vertex data corresponding to the i-th frame based on static animation data, dynamic animation data, and initial vertex data in the following manner: inputting the static animation data into a static encoder to obtain a static latent space, wherein the target motion model includes a static encoder; inputting the dynamic animation data into a dynamic encoder to obtain a dynamic latent space, wherein the target motion model includes a dynamic encoder; inputting the static latent space and the dynamic latent space into the target fully connected layer, and combining the initial vertex data to determine the target vertex data corresponding to the i-th frame.
[0182] As an optional approach, the aforementioned device is used to input the static latent space and dynamic latent space into the target fully connected layer in the following manner, and combine the initial vertex data to determine the target vertex data corresponding to the i-th frame: inputting the static latent space and dynamic latent space into the target fully connected layer to determine the vertex offset data corresponding to the i-th frame, wherein the vertex offset data represents the offset of each vertex of the virtual cloth in the global coordinate system; determining the unskinned vertex data based on the initial vertex data and the vertex offset data; performing a linear blending skinning operation on the unskinned vertex data to determine the target vertex data corresponding to the i-th frame.
[0183] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0184] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0185] According to one aspect of this application, a computer program product is provided, the computer program product comprising a computer program.
[0186] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0187] Figure 12 A schematic block diagram of a computer system architecture for implementing an electronic device according to embodiments of the present application is shown.
[0188] It should be noted that, Figure 12 The computer system 1200 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0189] like Figure 12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1202 or programs loaded from storage section 1208 into random access memory (RAM). The RAM 1203 also stores various programs and data required for system operation. The CPU 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An input / output interface 1205 (I / O interface) is also connected to the bus 1204.
[0190] The following components are connected to the input / output interface 1205: an input section 1206 including a keyboard, mouse, etc.; an output section 1207 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a local area network card, modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the input / output interface 1205 as needed. A removable medium 1211, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1210 as needed so that computer programs read from it can be installed into the storage section 1208 as needed.
[0191] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1209, and / or installed from removable medium 1211. When the computer program is executed by central processing unit 1201, it performs various functions defined in the system of this application.
[0192] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1209, and / or installed from the removable medium 1211. When the computer program is executed by the central processing unit 1201, it performs various functions provided in the embodiments of this application.
[0193] According to another aspect of the embodiments of this application, an electronic device for implementing the above-described animation data processing method is also provided. This electronic device may be... Figure 1 The terminal device or server shown. This embodiment uses this electronic device as an example for illustration. Figure 13 As shown, the electronic device includes a memory 1302 and a processor 1304. The memory 1302 stores a computer program, and the processor 1304 is configured to execute the steps of any of the above method embodiments through the computer program.
[0194] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.
[0195] Optionally, in this embodiment, the processor may be configured to execute the methods in the embodiments of this application via a computer program.
[0196] Alternatively, as those skilled in the art will understand, Figure 13 The structure shown is for illustrative purposes only. Figure 13 This does not limit the structure of the aforementioned electronic devices. For example, the electronic device may also include components that are more... Figure 13 The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 13 The different configurations shown.
[0197] The memory 1302 can be used to store software programs and modules, such as the program instructions / modules corresponding to the animation data processing method and apparatus in this embodiment. The processor 1304 executes various functional applications and data processing by running the software programs and modules stored in the memory 1302, thereby realizing the above-mentioned animation data processing method. The memory 1302 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1302 may further include memory remotely located relative to the processor 1304, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 1302 may be used, but is not limited to, to store information such as object animation data and initial vertex data. As an example, such as Figure 13 As shown, the memory 1302 may include, but is not limited to, the acquisition module 1102, execution module 1104, and generation module 1106 of the animation data processing device. Furthermore, it may include, but is not limited to, other module units of the animation data processing device, which will not be elaborated upon in this example.
[0198] Optionally, the transmission device 1306 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 1306 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 1306 is a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0199] In addition, the aforementioned electronic device also includes: a display 1308 for displaying the aforementioned target animation data; and a connection bus 1310 for connecting the various module components in the aforementioned electronic device.
[0200] In other embodiments, the aforementioned terminal device or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer network, and any form of computing device, such as a server, terminal, or other electronic device, can become a node in the blockchain system by joining this peer-to-peer network.
[0201] According to one aspect of this application, a computer-readable storage medium is provided, wherein a processor of an electronic device reads computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the electronic device to perform the animation data processing method provided in various alternative implementations of the above-described animation data processing aspect.
[0202] Optionally, in this embodiment, the computer-readable storage medium described above may be configured to store methods for performing the embodiments of this application.
[0203] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0204] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0205] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more electronic devices to execute all or part of the steps of the methods described in the various embodiments of this application.
[0206] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0207] In the several embodiments provided in this application, it should be understood that the disclosed application can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0208] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0209] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0210] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method of processing animation data, characterized by, The method comprises: obtaining object animation data associated with a target object and initial vertex data, wherein the initial vertex data comprises initial positions of each vertex of a virtual object configured for the target object in a global coordinate system, and the object animation data is used to indicate a motion process of a virtual skeleton of the target object; inputting the object animation data and the initial vertex data into a pre-trained target motion model to obtain target vertex data, wherein the target vertex data comprises positions of each vertex of the virtual object in the global coordinate system that match the object animation data, the target motion model is a model obtained by training an initial motion model, and a loss function used in the training process of the initial motion model comprises a self-collision loss function used to indicate a degree of collision between any two triangular facets associated with the virtual object, and the triangular facets are composed of the vertices; based on the target vertex data, rendering is performed to generate target animation data that matches the object animation data.
2. The method of claim 1, wherein, The method further comprises: obtaining sample object animation data associated with a sample object, wherein the sample object animation data is used to indicate a motion process of a virtual skeleton of the sample object; inputting the sample object animation data and the initial vertex data into the initial motion model to obtain sample vertex data, wherein the sample vertex data comprises positions of each vertex of the virtual object in the global coordinate system that match the sample object animation data; determining the loss function of the initial motion model according to the sample vertex data, and determining the initial motion model as the target motion model in a case where the loss function meets a preset condition, wherein the self-collision loss function is determined by a length of an intersection line segment of the any two triangular facets.
3. The method of claim 2, wherein, The determination of the loss function of the initial motion model according to the sample vertex data and the determination of the initial motion model as the target motion model in a case where the loss function meets a preset condition comprise: combining the any two triangular facets of the virtual object to determine a plurality of pairs of triangular facets; obtaining a length of an intersection line segment of each pair of triangular facets in the plurality of pairs of triangular facets; performing an accumulation operation on the length of the intersection line segment of each pair of triangular facets to obtain a value of the self-collision loss function; determining a value of the loss function according to the value of the self-collision loss function, and determining the initial motion model as the target motion model in a case where the value of the loss function meets a preset value condition.
4. The method of claim 3, wherein, The obtaining of the length of the intersection line segment of each pair of triangular facets in the plurality of pairs of triangular facets comprises: obtaining a first triangular facet and a second triangular facet, wherein the first triangular facet and the second triangular facet represent any one pair of triangular facets in the plurality of pairs of triangular facets; in a case where the first triangular facet and the second triangular facet intersect, obtaining barycentric coordinate data of an intersection point, wherein the barycentric coordinate data represents a position of the intersection point in a local coordinate system; determine intersection point coordinate data according to the patch vertex data of the first or second triangular patch and the barycentric coordinate data, wherein the intersection point coordinate data represents a position of the intersection point in the global coordinate system; determine a length of a target intersection line segment associated with the first and second triangular patches according to the intersection point coordinate data, wherein the intersection line segment includes the target intersection line segment.
5. The method of claim 4, wherein, The determining of the intersection point coordinate data according to the patch vertex data of the first or second triangular patch and the barycentric coordinate data comprises: obtaining first vertex data of the first triangular patch, and performing a weighted operation on each vertex coordinate in the first vertex data based on the barycentric coordinate data to determine the intersection point coordinate data; or obtaining second vertex data of the second triangular patch, and performing a weighted operation on each vertex coordinate in the second vertex data based on the barycentric coordinate data to determine the intersection point coordinate data.
6. The method of claim 3, wherein, The determining of the loss function value according to the value of the self-collision loss function comprises: obtaining a set of potential energy functions set for the initial motion model, wherein a potential energy function in the set of potential energy functions is used to constrain the shape and size of any triangular patch of the virtual object; determining the value of the loss function as a sum of the values of each potential energy function in the set of potential energy functions and the value of the self-collision loss function; in a case where the value of the loss function meets a preset value condition, determining the initial motion model as the target motion model.
7. The method of claim 1, wherein, The inputting of the object animation data and the initial vertex data into the pre-trained target motion model to obtain target vertex data comprises: extracting i-pth frame to i+qth frame animation data from the object animation data, wherein the object animation data includes N frames, i≤N, i-p≤N, i+q≤N, i, p, q, and N are all positive integers; determining static animation data and dynamic animation data corresponding to the i-th frame according to the i-pth frame to i+qth frame animation data, wherein the static animation data includes bone rotation information of each frame of the target object, and the dynamic animation data includes bone rotation speed of each frame of the target object; determining the target vertex data corresponding to the i-th frame according to the static animation data, the dynamic animation data, and the initial vertex data.
8. The method of claim 7, wherein, The determining of the static animation data and the dynamic animation data corresponding to the i-th frame according to the i-pth frame to i+qth frame animation data comprises: determining i-th frame animation data as the static animation data, wherein the static animation data further includes gravity data of each frame; determining i-pth frame to i-1th frame animation data and i+1th frame to i+qth frame animation data as the dynamic animation data, wherein the dynamic animation data further includes acceleration data of each frame.
9. The method of claim 7, wherein, The determining the target vertex data corresponding to the i-th frame according to the static animation data, the dynamic animation data and the initial vertex data comprises: inputting the static animation data into a static encoder to obtain a static latent space, wherein the target motion model comprises the static encoder; inputting the dynamic animation data into a dynamic encoder to obtain a dynamic latent space, wherein the target motion model comprises the dynamic encoder; inputting the static latent space and the dynamic latent space into a target fully connected layer to determine the target vertex data corresponding to the i-th frame in combination with the initial vertex data.
10. The method of claim 9, wherein, The determining the target vertex data corresponding to the i-th frame according to the static animation data, the dynamic animation data and the initial vertex data comprises: inputting the static latent space and the dynamic latent space into a target fully connected layer to determine vertex offset data corresponding to the i-th frame, wherein the vertex offset data represents an offset amount of each vertex of the virtual object in the global coordinate system; determining un-skinned vertex data according to the initial vertex data and the vertex offset data; performing a linear blend skinning operation on the un-skinned vertex data to determine the target vertex data corresponding to the i-th frame.
11. An apparatus for processing animation data, characterized by comprise: an acquisition module, configured to acquire object animation data and initial vertex data associated with a target object, wherein the initial vertex data comprises initial positions of each vertex of a virtual object configured for the target object in a global coordinate system, and the object animation data is used to indicate a motion process of a virtual skeleton of the target object; an execution module, configured to input the object animation data and the initial vertex data into a pre-trained target motion model to obtain target vertex data, wherein the target vertex data comprises positions of each vertex of the virtual object in the global coordinate system that match the object animation data, the target motion model represents a model obtained by training an initial motion model, and a loss function used in a training process of the initial motion model comprises a self-collision loss function, the self-collision loss function is used to indicate a degree of collision of any two triangular facets associated with the virtual object, and the triangular facets are composed of the vertices; a generation module, configured to perform rendering based on the target vertex data to generate target animation data that matches the object animation data.
12. A computer readable storage medium, characterized in that, The computer-readable storage medium comprises a stored computer program, wherein the computer program can be run by an electronic device to execute the method described in any one of claims 1 to 10.
13. A computer program product comprising a computer program, characterized in that, The computer program is executed by a processor to implement the steps of the method described in any one of claims 1 to 10.
14. An electronic device comprising a memory and a processor, characterized in that The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 10 by using the computer program. The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 10 by using the computer program.