Methods, apparatus, storage media, and electronic devices for generating skeletal animation
By generating skeletal point clouds and constructing skeletal matrices, the problem of rigid body animations in game engines being unable to be converted into skeletal animations was solved, achieving efficient skeletal animation generation and meeting the needs of skinned animations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2023-01-19
- Publication Date
- 2026-07-31
AI Technical Summary
Existing game engines cannot effectively convert rigid body animation into skeletal animation, resulting in the inability to generate skinning and animation for models, thus failing to meet the project requirements related to skinning and animation.
By obtaining the target position of the rigid body model, a skeletal point cloud is generated, and a skeletal matrix is constructed based on the rigid body animation. This drives the rigid body model to generate skeletal animation, and rotation, scaling, and offset information are recorded to achieve binding relationships.
It enables the conversion from rigid body animation to skeletal animation, improves the conversion effect, meets the needs of skinned animation, increases generation efficiency, and reduces costs.
Smart Images

Figure CN116012502B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computers, and more specifically, to a method, apparatus, storage medium, and electronic device for generating skeletal animation. Background Technology
[0002] Skeletal animation is a type of model animation. In skeletal animation, the model has a skeleton structure composed of interconnected "bones". Animation is generated for the model by changing the orientation and position of the bones.
[0003] Currently, some game engines support GPU (Graphics Processing Unit) generation of skeletal animation; however, others do not support non-skeletal skinned animation, such as rigid body animation. To reproduce rigid body animation of a model within a game engine, the rigid body animation must be converted into skeletal animation that the game engine can recognize.
[0004] However, in related technologies, some game engines cannot convert rigid body animation into skeletal animation; even if some game engines can convert rigid body animation into skeletal animation, they cannot generate the model's skeleton during the conversion process, and therefore cannot generate skinning and animation, thus failing to meet the needs of projects that require skinning animation.
[0005] There is currently no effective solution to the above problems. Summary of the Invention
[0006] This disclosure provides at least some embodiments of a method, apparatus, storage medium, and electronic device for generating skeletal animation, in order to at least solve the technical problem in the related art that it is impossible to generate skeletal animation from rigid body animation of rigid body models.
[0007] According to one embodiment of this disclosure, a method for generating skeletal animation is provided, comprising: acquiring at least one rigid body model, wherein the at least one rigid body model is a virtual model with a fixed structure; generating a skeletal point cloud corresponding to each rigid body model based on the target position of the at least one rigid body model; constructing a bone matrix corresponding to the skeletal point cloud based on the rigid body animation corresponding to the at least one rigid body model; and driving the at least one rigid body model to generate a skeletal animation corresponding to the at least one rigid body model based on the bone matrix corresponding to the skeletal point cloud, wherein the bone matrix is used to record at least the animation information of the rigid body model corresponding to the bone matrix, and the animation information includes at least the rotation information, scaling information, and offset information of the at least one rigid body model.
[0008] According to one embodiment of this disclosure, a skeletal animation generation apparatus is also provided, comprising: an acquisition module for acquiring at least one rigid body model, wherein the at least one rigid body model is a virtual model with a fixed structure; a point cloud generation module for generating a skeletal point cloud corresponding to each rigid body model based on the target position of the at least one rigid body model; a matrix construction module for constructing a bone matrix corresponding to the skeletal point cloud based on the rigid body animation corresponding to the at least one rigid body model; and an animation generation module for driving the at least one rigid body model to generate a skeletal animation corresponding to the at least one rigid body model based on the bone matrix corresponding to the skeletal point cloud, wherein the bone matrix is used to record at least the animation information of the rigid body model corresponding to the bone matrix, and the animation information includes at least the rotation information, scaling information, and offset information of the at least one rigid body model.
[0009] According to one embodiment of this disclosure, a computer-readable storage medium is also provided, which stores a computer program configured to execute the above-described method for generating skeletal animation at runtime.
[0010] According to one embodiment of this disclosure, 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 run the computer program to perform the above-described method for generating skeletal animation.
[0011] In at least some embodiments of this disclosure, a method for constructing a skeleton matrix based on rigid body animation of a rigid body model is adopted. After obtaining at least one rigid body model with a fixed structure, a skeleton point cloud corresponding to each rigid body model is generated according to the target position of the at least one rigid body model. Then, a skeleton matrix corresponding to the skeleton point cloud is constructed based on the rigid body animation corresponding to the at least one rigid body model. Based on the skeleton matrix corresponding to the skeleton point cloud, at least one rigid body model is driven to generate a skeleton animation corresponding to the at least one rigid body model. The skeleton matrix is used to record at least the animation information of the rigid body model corresponding to the skeleton matrix. The animation information includes at least the rotation information, scaling information and offset information of the at least one rigid body model.
[0012] In the above process, by constructing a bone matrix corresponding to the skeletal point cloud, the skeletal animation corresponding to the rigid body model can be generated. That is, the solution provided in this disclosure can generate skeletal animation from rigid body animation of a rigid body model. Furthermore, during the generation of skeletal animation, a skeletal point cloud is generated based on the target position of the rigid body model, thereby establishing a binding relationship between the rigid body model and the bones in the skeletal animation. Then, by driving the rigid body model with a bone matrix that records the animation information of the rigid body animation, the generation of skeletal animation can be achieved. In this process, the bones corresponding to the rigid body model are generated. Therefore, the solution provided in this disclosure can meet the needs of skinned animation projects and improve the conversion effect of rigid body animation to skeletal animation.
[0013] Therefore, the solution provided in this disclosure achieves the goal of generating skeletal animation from rigid body animation of rigid body model, thereby improving the conversion effect of rigid body animation to skeletal animation and solving the technical problem in related technologies that it is impossible to generate skeletal animation from rigid body animation of rigid body model. Attached Figure Description
[0014] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this application, illustrate exemplary embodiments of the present disclosure and are used to explain the disclosure, but do not constitute an undue limitation thereof. In the drawings:
[0015] Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of generating skeletal animation according to an embodiment of the present disclosure.
[0016] Figure 2 This is a flowchart of a method for generating skeletal animation according to one embodiment of the present disclosure;
[0017] Figure 3 This is a schematic diagram of a rigid body model according to one embodiment of the present disclosure;
[0018] Figure 4 This is a schematic diagram illustrating the generation of a skeletal matrix according to one embodiment of the present disclosure;
[0019] Figure 5 This is a schematic diagram illustrating the generation of a skeletal matrix according to one embodiment of the present disclosure;
[0020] Figure 6 This is a schematic diagram of the export interface for skeletal animation according to one embodiment of the present disclosure;
[0021] Figure 7 This is a structural block diagram of a skeletal animation generation apparatus according to one embodiment of the present disclosure;
[0022] Figure 8 This is a schematic diagram of an electronic device according to one alternative embodiment of the present disclosure. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present disclosure, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present disclosure, and not all embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present disclosure.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this disclosure 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 disclosure 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.
[0025] In one possible implementation, regarding the methods commonly used in the generation of skeletal animation in the computer field, after practice and careful research, the inventors found that there is still a technical problem in the related technologies that cannot realize the generation of skeletal animation from rigid body animation of rigid body models. Based on this, the present disclosure proposes a method for generating skeletal animation. The technical concept adopted is based on the method of constructing a bone matrix from the rigid body animation of a rigid body model, thereby realizing the purpose of generating skeletal animation from the rigid body animation of a rigid body model. This solves the technical problem in the related technologies that cannot realize the generation of skeletal animation from the rigid body animation of a rigid body model, and thus achieves the technical effect of improving the conversion effect of rigid body animation to skeletal animation.
[0026] The methods and embodiments described above in this disclosure can be executed on mobile terminals, computer terminals, or similar computing devices. Taking a mobile terminal as an example, the mobile terminal can be a smartphone, tablet computer, PDA, mobile internet device, PAD, game console, or other terminal device. Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of generating skeletal animation according to an embodiment of this disclosure. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. Processor 102 (processor 102 may include, but is not limited to, a central processing unit (CPU), graphics processing unit (GPU), digital signal processing (DSP) chip, microprocessor (MCU), programmable logic device (FPGA), neural network processor (NPU), tensor processor (TPU), artificial intelligence (AI) type processor, etc.) and memory 104 for storing data. In one embodiment of this disclosure, it may also include: input / output device 108 and display device 110.
[0027] In some optional embodiments primarily focused on gaming scenarios, the aforementioned device may also provide a human-computer interaction interface with a touch-sensitive surface. This interface can sense finger contact and / or gestures to interact with a graphical user interface (GUI). The human-computer interaction functions may include the following: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. Executable instructions for performing the aforementioned human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.
[0028] Those skilled in the art will understand that Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0029] According to one embodiment of this disclosure, an embodiment of a method for generating skeletal animation is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0030] In one possible implementation, this disclosure provides a method for generating skeletal animation, which can be applied to a terminal device, wherein the terminal device can be a local terminal device or a client device in a cloud interactive system. Figure 2 This is a flowchart of a method for generating skeletal animation according to one embodiment of the present disclosure, such as... Figure 2 As shown, the method includes the following steps:
[0031] Step S202: Obtain at least one rigid body model.
[0032] In step S202, at least one rigid body model is a virtual model with a fixed structure. Specifically, the rigid body model is a three-dimensional virtual model that does not have structural deformation, but only displacement, rotation, or scaling. For example, in animations such as cracking without a diagram or the impact reaction of hard matter, the rigid body model will not deform, but will only generate corresponding dynamic feedback. All vertices of the rigid body model are subjected to uniform forces and undergo motion changes.
[0033] It should be noted that at least one of the rigid body models mentioned above can be a sub-model within the target rigid body model, for example, in Figure 3In the schematic diagram of the rigid body model shown, the target rigid body model includes at least rigid body model 1, rigid body model 2, and rigid body model 3. Alternatively, at least one of the above rigid body models can be an independent model; for example, rigid body model A in at least one rigid body model could be the armor of a virtual character, and rigid body model B could be the rocks surrounding the virtual character.
[0034] Optionally, the terminal device can read relevant information about the rigid body model using 3D computer graphics software (e.g., Houdini) and generate skeletal animation based on the rigid body animation corresponding to the rigid body model.
[0035] Step S204: Generate a skeletal point cloud corresponding to each rigid body model based on the target position of at least one rigid body model.
[0036] In step S204, the target position of at least one rigid body model can be either the center point of the rigid body model or its center of gravity. Typically, the center point or center of gravity of each independent rigid body model remains constant in rigid body animation. Therefore, by determining the bone point cloud corresponding to each rigid body based on its center point or center of gravity, the association between the skeleton and the rigid body model can be established. Furthermore, the skeletal animation corresponding to the rigid body model can be generated based on this association.
[0037] In addition, the skeleton corresponding to the rigid body model can be generated through step S204. That is, the solution provided by this disclosure can meet the needs of skinned animation projects and improve the conversion effect of rigid body animation to skeletal animation.
[0038] Step S206: Construct the skeleton matrix corresponding to the skeleton point cloud based on the rigid body animation corresponding to at least one rigid body model.
[0039] In step S206, the rigid body animation corresponding to the rigid body model is achieved through physical rigid body calculation, which quickly obtains more accurate and efficient animation effects without the need for manual frame-by-frame animation settings. However, rigid body animation cannot be displayed in the game engine; therefore, it needs to be converted into skeletal animation. Each bone point cloud corresponds to a bone matrix, and the bone matrix is used to record at least the animation information of the rigid body model corresponding to the bone matrix. The animation information includes at least the rotation information, scaling information, and offset information of at least one rigid body model.
[0040] This disclosure establishes the relationship between rigid body models and bones through a skeletal matrix, which in turn establishes the relationship between rigid body animation and skeletal animation, thereby realizing the generation of skeletal animation.
[0041] In addition, in this disclosure, skeletal animation is generated based on rigid body animation, that is, the skeletal animation generated by this disclosure does not require setting animation frame by frame, thereby improving the generation efficiency of skeletal animation and reducing the generation cost of skeletal animation.
[0042] Step S208: Based on the bone matrix corresponding to the bone point cloud, drive at least one rigid body model to generate a skeletal animation corresponding to at least one rigid body model.
[0043] After obtaining the skeletal matrix corresponding to the skeletal point cloud, the terminal device can drive the corresponding rigid body model through the skeletal matrix corresponding to each skeletal point cloud, thereby making the rigid body model move and obtaining the animation of the rigid body model moving in the game engine, i.e., skeletal animation.
[0044] Based on the scheme defined in steps S202 to S208 above, it can be understood that in at least some embodiments of this disclosure, a method of constructing a skeleton matrix based on rigid body animation of a rigid body model is adopted. After obtaining at least one rigid body model with a fixed structure, a skeleton point cloud corresponding to each rigid body model is generated according to the target position of the at least one rigid body model. Then, a skeleton matrix corresponding to the skeleton point cloud is constructed based on the rigid body animation corresponding to the at least one rigid body model. Based on the skeleton matrix corresponding to the skeleton point cloud, at least one rigid body model is driven to generate a skeleton animation corresponding to the at least one rigid body model. The skeleton matrix is used to record at least the animation information of the rigid body model corresponding to the skeleton matrix. The animation information includes at least the rotation information, scaling information and offset information of at least one rigid body model.
[0045] It is noteworthy that, in the above process, by constructing a bone matrix corresponding to the skeletal point cloud, the skeletal animation corresponding to the rigid body model can be generated. That is, the solution provided in this disclosure can generate skeletal animation from rigid body animation of a rigid body model. Furthermore, during the generation of skeletal animation, a skeletal point cloud is generated based on the target position of the rigid body model, thereby establishing a binding relationship between the rigid body model and the bones in the skeletal animation. Then, by driving the rigid body model with a bone matrix that records the animation information of the rigid body animation, the skeletal animation can be generated. In this process, the bones corresponding to the rigid body model are generated. Therefore, the solution provided in this disclosure can meet the needs of skinned animation projects and improve the conversion effect of rigid body animation to skeletal animation.
[0046] Therefore, the solution provided in this disclosure achieves the goal of generating skeletal animation from rigid body animation of rigid body model, thereby improving the conversion effect of rigid body animation to skeletal animation and solving the technical problem in related technologies that it is impossible to generate skeletal animation from rigid body animation of rigid body model.
[0047] In one optional embodiment, after obtaining at least one rigid body model, the terminal device needs to mark the rigid body model. Specifically, the terminal device marks at least one rigid body model to obtain a model identifier corresponding to at least one rigid body model.
[0048] It should be noted that the labeling of rigid body models mentioned above includes, but is not limited to, naming or other identifying labels for rigid body models. Different rigid body models have different labels; that is, each rigid body model has a unique label. Uniquely labeling rigid body models facilitates subsequent indexing of the skeleton matrix based on that label.
[0049] Furthermore, such as Figure 2 As shown, after obtaining at least one rigid body model, the terminal device executes step S204, which generates a skeletal point cloud corresponding to each rigid body model based on the target position of at least one rigid body model.
[0050] Specifically, the terminal device first determines the duration of the skeletal animation to be generated, and then determines the center point of at least one rigid body model in the first frame of the animation corresponding to the duration, thus obtaining the initial target position. Then, based on the initial target position, a skinning operation is performed on at least one rigid body model to obtain the skeletal point cloud corresponding to each rigid body model.
[0051] It should be noted that during the skinning operation on at least one rigid body model, the complete skinning operation is performed on the rigid body model based on the center point of each rigid body model to generate the corresponding skeleton of the rigid body model, thereby realizing the binding between the rigid body model and the skeleton.
[0052] In addition, in this embodiment, skinning operations and bone generation of rigid body models can be realized, thereby avoiding the problem in related technologies where bones cannot be generated when rigid body animation is converted into skeletal animation, and skinning and animation cannot be generated based on the bones.
[0053] Furthermore, such as Figure 2 As shown, after determining the skeletal point cloud corresponding to each rigid body model, the terminal device can construct the skeletal matrix corresponding to the skeletal point cloud based on the rigid body animation corresponding to at least one rigid body model.
[0054] Specifically, the terminal device constructs an initial skeleton matrix based on the skeletal point cloud, and determines the animation information of each rigid body model in each frame of animation based on the model identifier corresponding to at least one rigid body model and the rigid body animation corresponding to at least one rigid body model; then, it updates the initial skeleton matrix based on the animation information of each frame of animation to obtain the skeleton matrix corresponding to at least one rigid body model in each frame of animation.
[0055] It should be noted that the initial skeleton matrix mentioned above records the initial animation information corresponding to each center point in the first frame of the animation. For example... Figure 4 The diagram shown illustrates the generation of the skeleton matrix for the rigid body model. Figure 4 In this model, each rigid body model has an initial skeleton matrix in which the offset, rotation, and scaling information of the rigid body model are all unchanged initial variables. Specifically, in this embodiment, the offset information of the rigid body model is the offset relative to its position in the world coordinate system.
[0056] Furthermore, the terminal device can determine the rotation, scaling, and offset information of the rigid body model in each frame of the rigid body animation based on the model identifier. Then, based on this information, it can update the initial matrix of the rigid body model in real time, thereby updating the rotation, scaling, and offset of the rigid body model in the skeletal animation. This enables the driving of the rigid body model and generates the corresponding skeletal animation. For example, Figure 5 To Figure 4 The updated bone matrix is obtained by updating the bone matrix in the data.
[0057] Furthermore, after determining the skeletal matrix corresponding to the skeletal point cloud, the terminal device executes step S208, which is to drive at least one rigid body model based on the skeletal matrix corresponding to the skeletal point cloud to generate a skeletal animation corresponding to at least one rigid body model.
[0058] Specifically, in the current frame animation, the terminal device determines the current bone matrix corresponding to at least one rigid body model from the bone matrix corresponding to the bone point cloud based on the model identifier corresponding to at least one rigid body model; then, based on the current bone matrix, the animation information of at least one rigid body model in the previous frame animation is updated to obtain the current animation information of at least one rigid body model in the current frame animation, and the bone animation of at least one rigid body model is generated based on the current animation information of at least one rigid body model.
[0059] It should be noted that in the above process, after the skeleton matrix is updated, the terminal device updates the animation information of the corresponding rigid body model based on the updated skeleton matrix, thereby driving the rigid body model and generating skeletal animation.
[0060] In addition, the three elements required to generate skinned animation are the skinned rigid body model, the original bone positions (i.e., the information recorded in the initial bone matrix), and the skeletal animation. After obtaining the three elements required to generate skinned animation, the terminal device can use the ROP FBX Character Output function of Houdini software to export the skinned skeletal animation, which can be recognized and used by the game engine.
[0061] Optional, Figure 6 The diagram shows a schematic of the export interface for skeletal animation, which users can use to export skeletal animation. Figure 6 The parameters shown in the interface diagram are configured to set the export information for the skeletal animation. Specifically, in... Figure 6 In the settings, Start / End / Inc is used to set the start frame, end frame, and sampling interval of the exported animation; Output Fbx File is used to set the output path of the final skeletal animation; Bake Animation On Obj is used to directly convert rigid body animation to skeletal animation when bone and skin information is not needed; Geometry Name is used to set the name of the skeletal animation when exported; Boneroot Name is used to set the name of the root bone when exported.
[0062] In an optional embodiment, the solution provided in this embodiment can also achieve skeleton merging. Specifically, when there are multiple rigid body models, the terminal device determines the first rigid body model and the second rigid body model to be merged from the multiple rigid body models, and performs merging processing on the first rigid body model and the second rigid body model to obtain the target rigid body model. Then, based on the center point corresponding to the target rigid body model, the target position of the target rigid body model is determined, and a skinning operation is performed on the target rigid body model based on the target position to obtain the target skeleton point cloud corresponding to the target rigid body model.
[0063] In this embodiment, the terminal device can first merge rigid body models, then skin the merged rigid body models to generate target skeletal point clouds, and then generate the skeletal matrix of the merged rigid body model based on the target skeletal point clouds to drive the merged rigid body model and generate skeletal animation. For example, rigid body model 1 is armor and rigid body model 2 is rock. By combining the armor and rock, a target rigid body model is obtained. Then, the skeletal point cloud and target skeletal matrix are generated on the target rigid body model after the armor and rock are combined. The target rigid body model after the armor and rock are combined is determined by the target skeletal matrix, and skeletal animation is generated.
[0064] In addition, in practical applications, the terminal device can also perform skinning operations on the first rigid body model and the second rigid body model respectively to generate their respective skeletal point clouds. Then, based on their respective skeletal point clouds, their respective bone matrices are determined. Finally, the bone matrices of the first rigid body model and / or the second rigid body model are adjusted to achieve consistency of animation information in the skeletal animation of the two rigid body models, thereby realizing the merging of the skeletal animations of the two rigid body models.
[0065] In another optional embodiment, the solution provided in this embodiment can also achieve skeleton segmentation. Specifically, the terminal device determines the rigid body model to be segmented from at least one rigid body model, and performs segmentation processing on the rigid body model to be segmented to obtain a third rigid body model and a fourth rigid body model. Based on the target position of the third rigid body model, a skinning operation is performed on the third rigid body model to obtain a third skeleton point cloud; based on the target position of the fourth rigid body model, a skinning operation is performed on the fourth rigid body model to obtain a fourth skeleton point cloud. For example, if the rigid body model to be segmented is a model composed of multiple rocks, the terminal device can segment the rigid body model to be segmented into two rock models (i.e., the third rigid body model and the fourth rigid body model mentioned above), and then determine the skeleton point clouds and the corresponding skeleton matrices of the two rock models respectively. Finally, the corresponding rock model is driven by the skeleton matrix corresponding to each rock model, thereby realizing the skeleton animation of different rock models.
[0066] It should be noted that after dividing the rigid body model to be segmented into multiple sub-rigid body models, users can delete some sub-rigid body models from the multiple sub-rigid body models according to actual needs; or they can select some sub-rigid body models from the multiple sub-rigid body models according to actual needs, and segment out the selected sub-rigid body models to achieve skeleton segmentation.
[0067] As described above, in this disclosure, rigid body animations created using Houdini or other rigid body rendering software are automatically converted into skeletal animations using kineFX in Houdini. These can then be exported in FBX format, or merged or split with other skeletal animations, ultimately supporting GPU skinning calculations in the game engine and restoring the rigid body animations. Secondly, using rigid body animations as skeletal animations facilitates GPU skinning-driven rigid body animations in the game engine and also facilitates the mixing of skeletal animations to create new animations.
[0068] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.
[0069] This embodiment also provides a skeletal animation generation apparatus, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0070] Figure 7 This is a structural block diagram of a skeletal animation generation apparatus according to one embodiment of the present disclosure, such as... Figure 7 As shown, the device includes: an acquisition module 701, a point cloud generation module 703, a matrix construction module 705, and an animation generation module 707.
[0071] The system includes: an acquisition module 701 for acquiring at least one rigid body model, wherein the at least one rigid body model is a virtual model with a fixed structure; a point cloud generation module 703 for generating a skeletal point cloud corresponding to each rigid body model based on the target position of the at least one rigid body model; a matrix construction module 705 for constructing a bone matrix corresponding to the skeletal point cloud based on the rigid body animation corresponding to the at least one rigid body model; and an animation generation module 707 for driving the at least one rigid body model to generate a skeletal animation corresponding to the at least one rigid body model based on the skeletal matrix corresponding to the skeletal point cloud, wherein the bone matrix is used to record at least the animation information of the rigid body model corresponding to the bone matrix, and the animation information includes at least the rotation information, scaling information, and offset information of the at least one rigid body model.
[0072] It should be noted that the above-mentioned acquisition module 701, point cloud generation module 703, matrix construction module 705 and animation generation module 707 correspond to steps S201 to S208 in the above embodiments. The examples and application scenarios implemented by the four modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiments.
[0073] Optionally, the skeletal animation generation device further includes: a marking module, used to mark at least one rigid body model after obtaining at least one rigid body model, to obtain a model identifier corresponding to at least one rigid body model.
[0074] Optionally, the point cloud generation module includes: a first determining module, a second determining module, and a first skinning module. The first determining module is used to determine the duration of the skeletal animation to be generated; the second determining module is used to determine the center point of at least one rigid body model in the first frame of the animation corresponding to the duration, obtaining an initial target position; the first skinning module is used to perform skinning operations on at least one rigid body model based on the initial target position, obtaining a skeletal point cloud corresponding to each rigid body model.
[0075] Optionally, the matrix construction module includes: a first construction module, a third determination module, and a matrix update module. The first construction module is used to construct an initial skeleton matrix based on the skeletal point cloud, wherein the initial skeleton matrix records the initial animation information corresponding to each center point in the first frame of animation. The third determination module is used to determine the animation information of each rigid body model in each frame of animation based on the model identifier corresponding to at least one rigid body model and the rigid body animation corresponding to at least one rigid body model. The matrix update module is used to update the initial skeleton matrix based on the animation information of each frame of animation to obtain the skeleton matrix corresponding to at least one rigid body model in each frame of animation.
[0076] Optionally, the animation generation module includes: a fourth determining module, an animation updating module, and a first generation module. The fourth determining module is used to determine, in the current frame of animation, the current bone matrix corresponding to at least one rigid body model from the bone matrix corresponding to the bone point cloud, based on the model identifier corresponding to at least one rigid body model. The animation updating module is used to update the animation information of at least one rigid body model in the previous frame of animation based on the current bone matrix, to obtain the current animation information of at least one rigid body model in the current frame of animation. The first generation module is used to generate the skeletal animation of at least one rigid body model based on the current animation information of at least one rigid body model.
[0077] Optionally, the point cloud generation module includes: a fifth determining module, a merging module, a sixth determining module, and a second skinning module. The fifth determining module is used to determine the first rigid body model and the second rigid body model to be merged from multiple rigid body models when there are multiple rigid body models. The merging module is used to merge the first rigid body model and the second rigid body model to obtain the target rigid body model. The sixth determining module is used to determine the target position of the target rigid body model based on its center point. The second skinning module is used to perform a skinning operation on the target rigid body model based on its target position to obtain the target skeleton point cloud corresponding to the target rigid body model.
[0078] Optionally, the point cloud generation module includes: a seventh determination module, a model segmentation module, a third skinning module, and a fourth skinning module. The seventh determination module is used to determine the rigid body model to be segmented from at least one rigid body model; the model segmentation module is used to segment the rigid body model to be segmented, obtaining a third rigid body model and a fourth rigid body model; the third skinning module is used to perform a skinning operation on the third rigid body model based on its target position, obtaining a third skeleton point cloud; and the fourth skinning module is used to perform a skinning operation on the fourth rigid body model based on its target position, obtaining a fourth skeleton point cloud.
[0079] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0080] Embodiments of this disclosure also provide a computer-readable storage medium storing a computer program configured to perform the steps in any of the above method embodiments when executed.
[0081] Optionally, in this embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0082] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0083] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a method for generating skeletal animation as described above.
[0084] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0085] In exemplary embodiments of this application, a computer-readable storage medium stores a program product capable of implementing the methods described above in this embodiment. In some possible implementations, various aspects of the embodiments of this disclosure may also be implemented as a program product including program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps according to various exemplary embodiments of this disclosure described in the "Exemplary Methods" section above.
[0086] The program product for implementing the above-described method according to embodiments of the present disclosure may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the embodiments of the present disclosure is not limited thereto. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0087] The aforementioned program product may take the form of any combination of one or more computer-readable media. Such computer-readable storage media may be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (not exhaustive) of computer-readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0088] It should be noted that the program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0089] Embodiments of this disclosure also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0090] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0091] Optionally, in this embodiment, the processor can be configured to execute the skeletal animation generation method provided above via a computer program.
[0092] Figure 8 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Figure 8 As shown, the electronic device 800 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments disclosed herein.
[0093] like Figure 8 As shown, the electronic device 800 is presented in the form of a general-purpose computing device. The components of the electronic device 800 may include, but are not limited to: at least one processor 810, at least one memory 820, a bus 830 connecting different system components (including memory 820 and processor 810), and a display 840.
[0094] The memory 820 stores program code that can be executed by the processor 810, causing the processor 810 to perform the steps described in the method section of the embodiments of this application according to various exemplary implementations of this disclosure.
[0095] The memory 820 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 8201 and / or cache memory 8202, and may further include read-only memory (ROM) 8203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0096] In some instances, memory 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, including but not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Memory 820 may further include memory remotely located relative to processor 810, which can be connected to electronic device 800 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0097] Bus 830 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processor 810, or a local bus using any of the various bus structures.
[0098] The display 840 may be, for example, a touchscreen liquid crystal display (LCD) that allows a user to interact with the user interface of the electronic device 800.
[0099] Optionally, the electronic device 800 can also communicate with one or more external devices 900 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 800, and / or any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via the input / output (I / O) interface 850. Furthermore, the electronic device 800 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via a network adapter 860. Figure 8 As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830. It should be understood that, although... Figure 8 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0100] The aforementioned electronic device 800 may also include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply, and / or a camera.
[0101] Those skilled in the art will understand that Figure 8 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device 800 may also include components that are more... Figure 8 The more or fewer components shown, or having the same Figure 8 Different configurations are shown. The memory 820 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the skeletal animation generation method in this embodiment. The processor 810 executes various functional applications and data processing by running the computer program stored in the memory 820, thereby implementing the aforementioned skeletal animation generation method.
[0102] The sequence numbers of the embodiments disclosed above are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0103] In the above embodiments of this disclosure, 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.
[0104] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, 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 coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0105] 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 units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0106] Furthermore, the functional units in the various embodiments of this disclosure 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.
[0107] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, 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 a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0108] The above description is only a preferred embodiment of this disclosure. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles of this disclosure, and these improvements and modifications should also be considered within the scope of protection of this disclosure.
Claims
1. A method of generating a skeletal animation, the method comprising: include: Obtain at least one rigid body model, wherein the at least one rigid body model is a virtual model with a fixed structure; Generate a bone point cloud corresponding to each rigid body model based on the target position of the at least one rigid body model; Construct the bone matrix corresponding to the bone point cloud based on the rigid body animation corresponding to the at least one rigid body model; Based on the bone matrix corresponding to the bone point cloud, the at least one rigid body model is driven to generate a skeletal animation corresponding to the at least one rigid body model. The bone matrix is used to record at least the animation information of the rigid body model corresponding to the bone matrix. The animation information includes at least the rotation information, scaling information and offset information of the at least one rigid body model. The process of generating a skeletal point cloud corresponding to each rigid body model based on the target position of the at least one rigid body model includes: determining the duration of the skeletal animation to be generated; determining the center point of the at least one rigid body model in the first frame of the animation corresponding to the duration to obtain an initial target position; and performing a skinning operation on the at least one rigid body model based on the initial target position to obtain a skeletal point cloud corresponding to each rigid body model.
2. The method of claim 1, wherein, After obtaining at least one rigid body model, the method further includes: The at least one rigid body model is marked to obtain the model identifier corresponding to the at least one rigid body model.
3. The method of claim 1, wherein, Constructing the bone matrix corresponding to the bone point cloud based on the rigid body animation corresponding to the at least one rigid body model includes: An initial skeleton matrix is constructed based on the skeletal point cloud, wherein the initial skeleton matrix records the initial animation information corresponding to each center point in the first frame of animation; Based on the model identifier corresponding to the at least one rigid body model and the rigid body animation corresponding to the at least one rigid body model, determine the animation information of each rigid body model in each frame of animation. The initial bone matrix is updated based on the animation information of each frame of the animation to obtain the bone matrix corresponding to the at least one rigid body model in each frame of the animation.
4. The method according to claim 3, characterized in that, Based on the bone matrix corresponding to the skeletal point cloud, drive the at least one rigid body model to generate a skeletal animation corresponding to the at least one rigid body model, including: In the current frame animation, based on the model identifier corresponding to the at least one rigid body model, the current bone matrix corresponding to the at least one rigid body model is determined from the bone matrix corresponding to the bone point cloud; Based on the current skeleton matrix, update the animation information of at least one rigid body model in the previous frame of animation to obtain the current animation information of at least one rigid body model in the current frame of animation. Generate skeletal animation of the at least one rigid body model based on the current animation information of the at least one rigid body model.
5. The method of claim 1, wherein, Generate a skeletal point cloud corresponding to each rigid body model based on the target position of the at least one rigid body model, including: When the number of the at least one rigid body model is multiple, the first rigid body model and the second rigid body model to be merged are determined from the multiple rigid body models; The first rigid body model and the second rigid body model are merged to obtain the target rigid body model; The target position of the target rigid body model is determined based on the center point corresponding to the target rigid body model. Based on the target position of the target rigid body model, a skinning operation is performed on the target rigid body model to obtain the target skeleton point cloud corresponding to the target rigid body model.
6. The method of claim 1, wherein, Generate a skeletal point cloud corresponding to each rigid body model based on the target position of the at least one rigid body model, including: Determine the rigid body model to be segmented from the at least one rigid body model; The rigid body model to be segmented is segmented to obtain a third rigid body model and a fourth rigid body model. Based on the target position of the third rigid body model, a skinning operation is performed on the third rigid body model to obtain the third skeleton point cloud. Based on the target position of the fourth rigid body model, a skinning operation is performed on the fourth rigid body model to obtain the fourth skeleton point cloud.
7. A skeletal animation generation device, characterized in that, include: An acquisition module is used to acquire at least one rigid body model, wherein the at least one rigid body model is a virtual model with a fixed structure; A point cloud generation module is used to generate a skeletal point cloud corresponding to each rigid body model based on the target position of the at least one rigid body model. A matrix construction module is used to construct the skeleton matrix corresponding to the skeleton point cloud based on the rigid body animation corresponding to the at least one rigid body model. An animation generation module is used to drive the at least one rigid body model based on the bone matrix corresponding to the bone point cloud to generate a skeletal animation corresponding to the at least one rigid body model. The bone matrix is used to record at least the animation information of the rigid body model corresponding to the bone matrix. The animation information includes at least the rotation information, scaling information and offset information of the at least one rigid body model. The point cloud generation module is further configured to: determine the duration of the skeletal animation to be generated; determine the center point of at least one rigid body model in the first frame of the animation corresponding to the duration, and obtain an initial target position; and perform a skinning operation on the at least one rigid body model based on the initial target position to obtain a skeletal point cloud corresponding to each rigid body model.
8. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program, wherein the computer program is configured to execute, when run by a processor, the method for generating skeletal animation as described in any one of claims 1 to 6. 9.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to run the computer program to perform the method for generating skeletal animation as described in any one of claims 1 to 6.