Animation track compression method and device, equipment and storage medium
By setting the compression ratio parameters based on bone type grouping and hierarchical relationships of the animation track, the problems of insufficient compression and reduced restoration in the existing technology are solved, and flexible animation file compression and efficient storage space utilization are achieved.
Patent Information
- Application Number
- CN202311360967.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-19
- Publication Date
- 2025-01-10
AI Technical Summary
The prior art lacks flexibility when compressing animation files, resulting in insufficient compression or reduced animation restoration, and cannot effectively reduce the storage space occupied by game installation.
Group according to the bone type of animation tracks, set the basic compression ratio parameters of different track groups, and increment the compression ratio parameters step by step according to the hierarchical relationships within the track group, ensuring that the compression ratio parameters of animation tracks in each track group are different, and achieving flexibility compression processing.
While maintaining the compression of the animation track, the animation restoration degree is improved and the game storage space is effectively reduced.
Smart Images

Figure CN119295612A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to an animation track compression method, device, equipment and storage medium. Background Art
[0002] In the related art, the art designer of the game will design the animation file used in the game, and the animation file contains the animation data corresponding to different animation tracks. It is understandable that the characters in the game are composed of three-dimensional models, which contain multiple bones and skins. Each bone has its own action path, which can be carried in the animation data, so the corresponding animation track can be set for each bone separately.
[0003] Generally speaking, the game running files contain the above animation files, so that these animation files can be called at appropriate times during the game. Since the file data volume of the animation files is large, the file data volume of the game running files is large, and thus if you want to install a game on the client, you need a large storage space. Based on this, it is necessary to reduce the file data volume of the animation files, and then reduce the file data volume of the game running files, so as to reduce the storage space occupied by installing the game.
[0004] In order to reduce the file data volume of animation files, in the related art, the animation files are compressed. Specifically, each animation track contained in the animation file is compressed according to the same compression ratio parameter. However, in this way, if the compression ratio parameter used is small, the compression degree is insufficient, and the file data volume of the compressed animation file is still large. If the compression ratio parameter used is large, the animation restoration degree will be reduced due to the deep compression degree. It can be seen that the method of reducing the file data volume of animation files provided in the related art lacks flexibility. Summary of the invention
[0005] The embodiment of the present invention provides an animation track compression method, device, equipment and storage medium, which are used to improve the flexibility of setting compression ratio parameters.
[0006] In a first aspect, an embodiment of the present invention provides an animation track compression method, the method comprising:
[0007] Grouping the multiple animation tracks according to the bone types corresponding to the multiple animation tracks to obtain multiple track groups, wherein the multiple animation tracks belong to the same animation;
[0008] Get the basic compression ratio parameters corresponding to each track group;
[0009] Determine compression ratio parameters corresponding to the animation tracks in the plurality of track groups based on the basic compression ratio parameters corresponding to the plurality of track groups and the hierarchical relationship between the animation tracks in the plurality of track groups;
[0010] According to the compression ratio parameters of the animation tracks respectively included in the plurality of track groups, compression processing is performed on the animation tracks respectively included in the plurality of track groups.
[0011] Optionally, for any track group among the multiple track groups, the hierarchical relationship between the multiple animation tracks included in the any track group is consistent with the driver hierarchical relationship between the bones corresponding to the multiple animation tracks included in the any track group;
[0012] The determining, based on the basic compression ratio parameters corresponding to the multiple track groups and the hierarchical relationship between the animation tracks respectively included in the multiple track groups, the compression ratio parameters respectively corresponding to the animation tracks respectively included in the multiple track groups include:
[0013] Based on the hierarchical relationship between the multiple animation tracks included in any one track group and the basic compression ratio parameter corresponding to any one track group, the compression ratio parameter corresponding to each animation track included in any one track group is determined.
[0014] Optionally, determining the compression ratio parameter corresponding to each animation track included in any track group based on the hierarchical relationship between the multiple animation tracks included in any track group and the basic compression ratio parameter corresponding to any track group includes:
[0015] Set the compression ratio parameter corresponding to the root animation track in any track group to the basic compression ratio parameter;
[0016] Starting from the root animation track, the compression ratio parameter is increased step by step from the parent animation track to the child animation track to obtain the compression ratio parameter corresponding to each animation track included in any track group, wherein the larger the compression ratio parameter, the deeper the compression degree, and the smaller the compression ratio parameter, the smaller the compression degree.
[0017] Optionally, the multiple animation tracks are grouped according to the bone types corresponding to the multiple animation tracks to obtain multiple track groups, including:
[0018] Get the bone names corresponding to multiple animation tracks;
[0019] Based on the correspondence between the preset bone names and the bone types, and the bone names corresponding to the animation tracks, determine the bone types corresponding to the animation tracks;
[0020] The animation tracks corresponding to the same bone type among the multiple animation tracks are divided into a track group to obtain multiple track groups.
[0021] Optionally, obtaining basic compression ratio parameters corresponding to each track group includes:
[0022] Receive basic compression ratio parameters corresponding to each track group input by the user; or,
[0023] Based on the correspondence between the preset bone type and the basic compression ratio parameter, and the bone type corresponding to each of the track groups, the basic compression ratio parameter corresponding to each of the track groups is determined.
[0024] Optionally, the driver hierarchical relationship between the bones is recorded in a tree structure relationship.
[0025] Optionally, the method further comprises:
[0026] Obtaining a compression ratio parameter of the animation track corresponding to the character's clothing, wherein the compression ratio parameter of the animation track corresponding to the character's clothing is greater than the compression ratio parameter of the animation tracks corresponding to all bones;
[0027] The animation track corresponding to the character costume is compressed according to the compression ratio parameter of the animation track corresponding to the character costume.
[0028] In a second aspect, an embodiment of the present invention provides an animation track compression device, comprising:
[0029] A grouping module, used for grouping the plurality of animation tracks according to the bone types corresponding to the plurality of animation tracks, to obtain a plurality of track groups, wherein the plurality of animation tracks belong to the same animation;
[0030] An acquisition module is used to obtain basic compression ratio parameters corresponding to each track group;
[0031] A determination module, configured to determine the compression ratio parameters corresponding to the animation tracks respectively included in the plurality of track groups based on the basic compression ratio parameters corresponding to the plurality of track groups and the hierarchical relationship between the animation tracks respectively included in the plurality of track groups;
[0032] The compression module is used to compress each animation track contained in each of the plurality of track groups according to the compression ratio parameters of each animation track contained in each of the plurality of track groups.
[0033] Optionally, for any track group among the multiple track groups, the hierarchical relationship between the multiple animation tracks included in the any track group is consistent with the driver hierarchical relationship between the bones corresponding to the multiple animation tracks included in the any track group;
[0034] The determining module is used to:
[0035] Based on the hierarchical relationship between the multiple animation tracks included in any one track group and the basic compression ratio parameter corresponding to any one track group, the compression ratio parameter corresponding to each animation track included in any one track group is determined.
[0036] Optionally, the grouping module is used to:
[0037] Get the bone names corresponding to multiple animation tracks;
[0038] Based on the correspondence between the preset bone names and the bone types, and the bone names corresponding to the animation tracks, determine the bone types corresponding to the animation tracks;
[0039] The animation tracks corresponding to the same bone type among the multiple animation tracks are divided into a track group to obtain multiple track groups.
[0040] Optionally, the acquisition module is used to:
[0041] Receive basic compression ratio parameters corresponding to each track group input by the user; or,
[0042] Based on the correspondence between the preset bone type and the basic compression ratio parameter, and the bone type corresponding to each of the track groups, the basic compression ratio parameter corresponding to each of the track groups is determined.
[0043] Optionally, the determining module is used to:
[0044] Set the compression ratio parameter corresponding to the root animation track in any track group to the basic compression ratio parameter;
[0045] Starting from the root animation track, the compression ratio parameter is increased step by step from the parent animation track to the child animation track to obtain the compression ratio parameter corresponding to each animation track included in any track group, wherein the larger the compression ratio parameter, the deeper the compression degree, and the smaller the compression ratio parameter, the smaller the compression degree.
[0046] Optionally, the driver hierarchical relationship between the bones is recorded in a tree structure relationship.
[0047] Optionally, the compression module is further used to:
[0048] Obtaining a compression ratio parameter of the animation track corresponding to the character's clothing, wherein the compression ratio parameter of the animation track corresponding to the character's clothing is greater than the compression ratio parameter of the animation tracks corresponding to all bones;
[0049] The animation track corresponding to the character costume is compressed according to the compression ratio parameter of the animation track corresponding to the character costume.
[0050] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores executable code, and when the executable code is executed by the processor, the processor can at least implement the animation track compression method in the first aspect.
[0051] In a fourth aspect, an embodiment of the present invention provides a non-transitory machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor can at least implement the animation track compression method in the first aspect.
[0052] By adopting the present invention, it is no longer necessary to use the same compression ratio parameter to uniformly compress all animation tracks in an animation file. In the present invention, each animation track can be grouped based on the bone type corresponding to each animation track to obtain multiple track groups. Then, based on the importance of different track groups, the basic compression ratio parameters corresponding to each track group are set, and then for each track group, the compression ratio parameters corresponding to each of the multiple animation tracks contained in the current track group can be calculated one by one in each track group based on the basic compression ratio parameters corresponding to the current track group. In this way, the basic compression ratio parameters used between different track groups are different, and the compression ratio parameters used by different animation tracks contained in each track group are also different, which realizes setting the respective compression ratio parameters according to the importance of the track group and the hierarchical relationship between the animation tracks in the track group, thereby realizing the flexibility of setting the compression ratio parameters, so that the animation track can be compressed as much as possible while retaining the restoration degree of the key animation track. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0054] Figure 1 A schematic diagram of a flow chart of an animation track compression method provided by an embodiment of the present invention;
[0055] Figure 2 A schematic diagram of a tree structure provided by an embodiment of the present invention;
[0056] Figure 3 A schematic flow chart of another animation track compression method provided by an embodiment of the present invention;
[0057] Figure 4 A schematic structural diagram of an animation track compression device provided by an embodiment of the present invention;
[0058] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.
[0061] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0062] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0063] Figure 1 The present invention provides a flowchart of an animation track compression method, which can be applied to electronic devices. Figure 1 As shown, the method comprises the following steps:
[0064] 101. Group the multiple animation tracks according to the bone types corresponding to the multiple animation tracks to obtain multiple track groups, wherein the multiple animation tracks belong to the same animation.
[0065] 102. Obtain basic compression ratio parameters corresponding to each track group.
[0066] 103. Based on the basic compression ratio parameters corresponding to the plurality of track groups and the hierarchical relationship between the animation tracks contained in the plurality of track groups, compression ratio parameters corresponding to the animation tracks contained in the plurality of track groups are determined.
[0067] 104. Perform compression processing on each animation track included in each of the plurality of track groups according to the compression ratio parameters of each animation track included in each of the plurality of track groups.
[0068] In game design, the actions of the character model can be recorded through animation tracks. Specifically, if you want to record the actions of a complete character model, it is not achieved through only one animation track, but a corresponding animation track is set for each bone according to the number of bones that make up the character model, such as pelvis, waist, sternum, arm bones, etc. Among them, the arm bones can be subdivided into upper arm bones, lower arm bones, hand bones, etc.
[0069] It should be noted that when setting animation tracks, since bones have a hierarchical relationship, such as the arm bone can contain the upper arm bone, the lower arm bone, and the hand bone, it is necessary to set the animation track accordingly based on the smallest level of bones. For example, since the arm bone is not the smallest level bone, Void sets an animation track for the arm bone alone, while the upper arm bone, the lower arm bone, and the hand bone are the smallest level bones, so it is necessary to set separate animation tracks for the upper arm bone, the lower arm bone, and the hand bone.
[0070] It is worth noting that the corresponding skeleton's movements are recorded in the animation track through the animation track data, so the compression of the animation track is actually equivalent to the compression of the animation track data. The animation track data can actually be understood as a set of animation frames that record the corresponding skeletal animation. The animation track data has a variety of data forms. Specifically, it can be a sequence frame of a frame-by-frame animation, a key frame of an interpolated animation, or a fixed point of an animation curve, etc. The embodiment of the present invention does not limit the specific form of the animation track data.
[0071] It should be noted that the bones that make up the character model can be divided into multiple levels of hierarchical relationships. For example, the bones of the character model can be divided into trunk bones and limb bones as a whole, which are two major bone categories. Among them, for the trunk bones, they can be further subdivided into pelvis, waist bones, sternum, etc., and for the limb bones, they can be further subdivided into arm bones and leg bones. Among them, taking the arm bones as an example, as mentioned above, under the arm bones, they can be further subdivided into upper arm bones, lower arm bones, hand bones, etc., that is to say, upper arm bones, lower arm bones, and hand bones all belong to arm bones.
[0072] Since each animation track corresponds to a minimum-level bone, and the minimum-level bone can be divided into a higher-level bone category according to the contained hierarchical relationship, multiple animation tracks can be grouped according to the minimum-level bones corresponding to each of the multiple animation tracks included in the animation file, and the higher-level bone categories to which the minimum-level bones belong. For example, the animation track corresponding to the upper arm bone, the animation track corresponding to the forearm bone, and the animation track corresponding to the hand bone can all be divided into the arm bone-track group. In this way, multiple animation tracks can be grouped to obtain multiple track groups.
[0073] In some optional embodiments, the process of grouping multiple animation tracks can be implemented as follows: obtaining the bone name corresponding to each of the multiple animation tracks; determining the bone type corresponding to each of the animation tracks based on the correspondence between preset bone names and bone types, and the bone name corresponding to each of the animation tracks; and dividing the animation tracks corresponding to the same bone type in the multiple animation tracks into a track group to obtain multiple track groups.
[0074] It is understandable that each bone has a corresponding bone name, and the bone name can be entered by the artist when building the skeleton. Since the bone category needs to be identified according to the bone name, the bones need to be named strictly according to the naming standard, and the bone name must at least include the keyword used to identify the current bone category. For example, the bone names with keywords such as "Arm", "Hand", "Wrist", "Elbow", etc. are used to identify the corresponding bones as different components of the arm skeleton. In this way, the bones named with the above keywords will be classified into the arm skeleton, and their corresponding animation tracks will also be divided into the arm bone-track group accordingly.
[0075] In practical applications, the bone names and corresponding bone types can be recorded in a table, and the table can be looked up to know what bone type a certain bone name corresponds to. For example, if the bone name contains the keyword "Arm", the corresponding bone type is marked as an arm bone. Based on this, the table can be looked up to determine that the bone type with "Arm" in the bone name is an arm bone. Accordingly, the animation tracks corresponding to the bones with "Arm" in the bone name should be grouped into the arm bone-track group.
[0076] Referring to the above method, multiple animation tracks can be grouped according to the bone names and the bones corresponding to each animation track to obtain multiple track groups, such as arm bone-track group, leg bone-track group, pelvis-track group, waist bone-track group, sternum-track group, etc.
[0077] After obtaining multiple track groups, the basic compression ratio parameters corresponding to each track group can be obtained. In some optional embodiments, the artist can input the basic compression ratio parameters corresponding to each track group, so that the basic compression ratio parameters corresponding to each track group can be obtained. Alternatively, in another optional embodiment, the correspondence between the bone type and the basic compression ratio parameter can be established in advance, and the basic compression ratio parameters corresponding to each track group can be determined based on the correspondence and the bone type corresponding to each track group.
[0078] Among them, the correspondence between the above-mentioned bone types and basic compression ratio parameters can be specifically recorded in a table, and the basic compression ratio parameters corresponding to each track group can be obtained by looking up the table. For example, the table records: arm bones-basic compression ratio parameter A, leg bones-basic compression ratio parameter B, pelvis-basic compression ratio parameter C, waist bone-basic compression ratio parameter D, sternum-basic compression ratio parameter E, etc. Assuming that the current track group is a waist bone-track group, it can be determined by looking up the table that the basic compression ratio parameter corresponding to the waist bone is D, then D can be used as the basic compression ratio parameter of the waist bone-track group.
[0079] Regardless of the method used, the corresponding basic compression ratio parameters can be set according to the importance of different track groups. For example, the movement of the torso bones will affect the limb bones, so the basic compression ratio parameters used by the torso bones should be smaller than those used by the limb bones. For another example, since there is a reference relationship between the feet and the ground, if this reference relationship is not handled properly, it is easy for the feet and the ground to be interlaced. Therefore, the animation track corresponding to the feet should use a smaller basic compression ratio than the animation track corresponding to the hands. The larger the basic compression ratio parameter, the deeper the compression, that is, the lower the degree of restoration to the original animation; the smaller the basic compression ratio parameter, the smaller the compression, that is, the higher the degree of restoration to the original animation.
[0080] It is understandable that, since each track group includes at least one animation track, after the basic compression ratio parameter corresponding to the current track group is known, it is also necessary to determine the compression ratio parameter corresponding to each animation track included in the current track group according to the basic compression ratio parameter.
[0081] In the first case, if the current track group contains only one animation track, the basic compression ratio parameter corresponding to the current track group may be determined as the compression ratio parameter of the only animation track contained in the current track group.
[0082] In the second case, if the current track group contains two or more animation tracks, the compression ratio parameters corresponding to each animation track in the current track group can be determined based on the hierarchical relationship between the multiple animation tracks in the current track group and the basic compression ratio parameters corresponding to the current track group. The hierarchical relationship between the multiple animation tracks in the current track group is consistent with the driver hierarchical relationship between the bones corresponding to the multiple animation tracks in the current track group.
[0083] It should be noted that in addition to the containment hierarchical relationship, bones also have a driving hierarchical relationship. Among them, the driving hierarchical relationship is based on the driving relationship between bones. The driving relationship can be understood as when bone A moves, it will drive bone B to move based on a certain rule, then bones A and bones B have a driving relationship. Continuing with the above example, assuming that more bones with direct or indirect driving relationships between bones A and bones B are added, a driving hierarchical relationship will be formed. For example, bone C drives bone A to move, and bone B drives bone D to move, then the driving hierarchical relationship between bones A, bones B, bones C and bones D is: bone C>bone A>bone B>bone D.
[0084] In some optional embodiments, the driver hierarchical relationship between bones can be recorded in a tree structure relationship. It is understandable that the tree structure includes leaf nodes and parent nodes, and the driver hierarchical relationship between bones can be clearly recorded through leaf nodes and parent nodes. Figure 2 As shown, the driving hierarchical relationship between the upper arm bones, the lower arm bones, and the hand bones is recorded through a tree structure.
[0085] The above introduces the hierarchical relationship between the bones in the current track group. Since the multiple animation tracks in the current track group correspond to the corresponding bones, the hierarchical relationship between the multiple animation tracks in the current track group can be determined based on the hierarchical relationship between the bones. For example, assuming that the hierarchical relationship between bones A, B, C, and D is bone C>bone A>bone B>bone D, and the animation track corresponding to bone A is S1, the animation track corresponding to bone B is S2, the animation track corresponding to bone C is S3, and the animation track corresponding to bone D is S4, then the hierarchical relationship between the animation tracks is animation track S3>animation track S1>animation track S2>animation track S4.
[0086] After knowing the hierarchical relationship between the multiple animation tracks included in the current track group and the basic compression ratio parameters corresponding to the current track group, the compression ratio parameters corresponding to the multiple animation tracks included in the current track group can be calculated. Optionally, the process can be specifically implemented as follows: setting the compression ratio parameter corresponding to the root animation track in any track group as the basic compression ratio parameter; starting from the root animation track, increasing the compression ratio parameters step by step from the parent animation track to the child animation track, and obtaining the compression ratio parameters corresponding to each animation track included in any track group, wherein the larger the compression ratio parameter, the deeper the compression degree, and the smaller the compression ratio parameter, the smaller the compression degree.
[0087] For example, if the hierarchical relationship between animation tracks is animation track S3> animation track S1> animation track S2> animation track S4, animation track S3 is the root animation track. There is no higher-level animation track before animation track S3, so animation track S3 is the root animation track. The animation track next to the “>” symbol and before the “>” symbol is the parent animation track, and the animation track next to the “>” symbol and after the “>” symbol is the child animation track.
[0088] In actual applications, the basic compression ratio parameter corresponding to the current track group can be assigned to the root animation track contained in the current track group, that is, in the above example, the compression ratio parameter of animation track S3 = the basic compression ratio parameter of the track group to which animation track S3 belongs. Then, starting from the root animation track, the compression ratio parameter can be increased step by step from the parent animation track to the child animation track, such as increasing the compression ratio parameter of each level of animation track by 0.01.
[0089] For example, suppose there is such a hierarchical relationship: upper arm bone-animation track > lower arm bone-animation track > hand bone-animation track. They all belong to the arm bone-track group. The basic compression ratio parameter corresponding to the arm bone-track group is 0.06. Since the upper arm bone-animation track is the root animation track, the compression ratio parameter of the upper arm bone-animation track can be set to 0.06. The compression ratio parameters of the subsequent animation tracks are increased by 0.01 on this basis. The compression ratio parameter of the lower arm bone-animation track is 0.07, and the compression ratio parameter of the hand bone-animation track is 0.08.
[0090] It should be noted that the larger the compression ratio parameter is, the deeper the compression degree is, that is, the lower the degree of restoration to the original animation is; the smaller the compression ratio parameter is, the smaller the compression degree is, that is, the higher the degree of restoration to the original animation is.
[0091] It is worth noting that due to the existence of the driver hierarchy between bones, when the parent bone moves, the child bone will follow it. Therefore, accordingly, the compression ratio parameter of the animation track corresponding to the parent bone can be set smaller than the compression ratio parameter of the animation track corresponding to the child bone. In this way, the degree of restoration of the original animation can be improved while compressing the animation track as much as possible.
[0092] In some optional embodiments, the compression ratio parameters can be stored in the compression data dictionary. The compression ratio parameters corresponding to each animation track can be established by using the bone name corresponding to the animation track as a keyword. The compression ratio parameters can specifically include but are not limited to: any one or more of the key frame fitting allowable error, the number of key frame floating point number retention bits, the number of floating point number retention bits of the curve slope after fitting, and the elimination of invalid key frame errors.
[0093] Finally, the animation tracks contained in the multiple track groups can be compressed according to the compression ratio parameters of the animation tracks contained in the multiple track groups. Specifically, the compression process can be implemented as follows:
[0094] 1) Keyframes are fitted into curves.
[0095] 2) Limitation on the number of floating-point digits for key frame time and value.
[0096] 3) Limitation on the number of floating-point digits for key frame slope values.
[0097] 4) Eliminate invalid keyframes.
[0098] Of course, in addition to the compression processing processes listed above, other methods can also be used to compress the animation track, which will not be introduced one by one in the embodiment of the present invention.
[0099] It should be noted that, in some optional embodiments, before grouping multiple animation tracks, animation tracks with empty animation track data may be eliminated, so as to avoid grouping of empty animation tracks and eliminate the need to compress the empty animation tracks.
[0100] like Figure 3 As shown, another embodiment of the present invention provides another animation track compression method, which may include:
[0101] 301. Group the multiple animation tracks according to the bone types corresponding to the multiple animation tracks to obtain multiple track groups, wherein the multiple animation tracks belong to the same animation.
[0102] 302. Obtain basic compression ratio parameters corresponding to each track group.
[0103] 303. Based on the basic compression ratio parameters corresponding to the multiple track groups and the hierarchical relationship between the animation tracks included in the multiple track groups, determine the compression ratio parameters corresponding to the animation tracks included in the multiple track groups.
[0104] 304. Obtain a compression ratio parameter of the animation track corresponding to the character's clothing, wherein the compression ratio parameter of the animation track corresponding to the character's clothing is greater than the compression ratio parameter of the animation tracks corresponding to all bones.
[0105] 305. Perform compression processing on each animation track included in each of the plurality of track groups according to the compression ratio parameters of each animation track included in each of the plurality of track groups.
[0106] 306. Compress the animation track corresponding to the character costume according to the compression ratio parameter of the animation track corresponding to the character costume.
[0107] Among them, the specific implementation process of the above steps 301-303 and 305 has been introduced in detail in the previous embodiment. You can refer to the description in the previous embodiment to implement steps 301-303 and 305 in this embodiment, and this embodiment of the present invention will not be elaborated on again.
[0108] It is understandable that the character model is not only composed of the body, but also has character clothing, such as the hem of the skirt. When the character model moves, the character clothing will also swing along with it. In actual applications, players will pay more attention to the movements of the character model, followed by the swing of the character clothing. Therefore, the compression ratio parameter of the animation track corresponding to the character clothing can be set to be greater than the compression ratio parameter of the animation track corresponding to all bones.
[0109] By adopting the present invention, it is no longer necessary to use the same compression ratio parameter to uniformly compress all animation tracks in an animation file. In the present invention, each animation track can be grouped based on the bone type corresponding to each animation track to obtain multiple track groups. Then, based on the importance of different track groups, the basic compression ratio parameters corresponding to each track group are set, and then for each track group, the compression ratio parameters corresponding to each of the multiple animation tracks contained in the current track group can be calculated one by one in each track group based on the basic compression ratio parameters corresponding to the current track group. In this way, the basic compression ratio parameters used between different track groups are different, and the compression ratio parameters used by different animation tracks contained in each track group are also different, which realizes setting the respective compression ratio parameters according to the importance of the track group and the hierarchical relationship between the animation tracks in the track group, thereby realizing the flexibility of setting the compression ratio parameters, so that the animation track can be compressed as much as possible while retaining the restoration degree of the key animation track.
[0110] The following will describe in detail the animation track compression device of one or more embodiments of the present invention. Those skilled in the art will appreciate that these animation track compression devices can be configured using commercially available hardware components through the steps taught in this solution.
[0111] Figure 4 A schematic diagram of the structure of an animation track compression device provided by an embodiment of the present invention is shown in FIG. Figure 4 As shown, the device comprises:
[0112] A grouping module 41 is used to group the multiple animation tracks according to the bone types corresponding to the multiple animation tracks to obtain multiple track groups, wherein the multiple animation tracks belong to the same animation;
[0113] An acquisition module 42 is used to acquire basic compression ratio parameters corresponding to each track group;
[0114] A determination module 43, configured to determine the compression ratio parameters corresponding to the animation tracks respectively included in the plurality of track groups based on the basic compression ratio parameters corresponding to the plurality of track groups and the hierarchical relationship between the animation tracks respectively included in the plurality of track groups;
[0115] The compression module 44 is used to compress each animation track contained in each of the plurality of track groups according to the compression ratio parameters of each animation track contained in each of the plurality of track groups.
[0116] Optionally, for any track group among the multiple track groups, the hierarchical relationship between the multiple animation tracks included in the any track group is consistent with the driver hierarchical relationship between the bones corresponding to the multiple animation tracks included in the any track group;
[0117] The determining module 43 is used to:
[0118] Based on the hierarchical relationship between the multiple animation tracks included in any one track group and the basic compression ratio parameter corresponding to any one track group, the compression ratio parameter corresponding to each animation track included in any one track group is determined.
[0119] Optionally, the grouping module 41 is used to:
[0120] Get the bone names corresponding to multiple animation tracks;
[0121] Based on the correspondence between the preset bone names and the bone types, and the bone names corresponding to the animation tracks, determine the bone types corresponding to the animation tracks;
[0122] The animation tracks corresponding to the same bone type among the multiple animation tracks are divided into a track group to obtain multiple track groups.
[0123] Optionally, the acquisition module 42 is used to:
[0124] Receive basic compression ratio parameters corresponding to each track group input by the user; or,
[0125] Based on the correspondence between the preset bone type and the basic compression ratio parameter, and the bone type corresponding to each of the track groups, the basic compression ratio parameter corresponding to each of the track groups is determined.
[0126] Optionally, the determining module 43 is used to:
[0127] Set the compression ratio parameter corresponding to the root animation track in any track group to the basic compression ratio parameter;
[0128] Starting from the root animation track, the compression ratio parameter is increased step by step from the parent animation track to the child animation track to obtain the compression ratio parameter corresponding to each animation track included in any track group, wherein the larger the compression ratio parameter, the deeper the compression degree, and the smaller the compression ratio parameter, the smaller the compression degree.
[0129] Optionally, the driver hierarchical relationship between the bones is recorded in a tree structure relationship.
[0130] Optionally, the compression module 44 is further configured to:
[0131] Obtaining a compression ratio parameter of the animation track corresponding to the character's clothing, wherein the compression ratio parameter of the animation track corresponding to the character's clothing is greater than the compression ratio parameter of the animation tracks corresponding to all bones;
[0132] The animation track corresponding to the character costume is compressed according to the compression ratio parameter of the animation track corresponding to the character costume.
[0133] Figure 4 The device shown can perform the aforementioned Figures 1 to 3 The animation track compression method provided in the illustrated embodiment, the detailed execution process and technical effects are described in the aforementioned embodiment, and will not be repeated here.
[0134] In one possible design, the above Figure 4 The structure of the animation track compression device shown can be implemented as an electronic device, such as Figure 5 As shown, the electronic device may include: a processor 51 and a memory 52. The memory 52 stores executable code, and when the executable code is executed by the processor 51, the processor 51 can at least implement the above-mentioned Figures 1 to 3 The animation track compression method provided in the illustrated embodiment.
[0135] Optionally, the electronic device may further include a communication interface 53 for communicating with other devices.
[0136] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, wherein an executable code is stored on the non-transitory machine-readable storage medium. When the executable code is executed by a processor of an electronic device, the processor can at least implement the above-mentioned Figures 1 to 3 The animation track compression method provided in the illustrated embodiment.
[0137] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0138] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0139] The animation track compression method provided in the embodiment of the present invention can be executed by a certain program / software, and the program / software can be provided by the network side. The electronic device mentioned in the above embodiment can download the program / software to a local non-volatile storage medium, and when it needs to execute the above animation track compression method, the program / software is read into the memory by the CPU, and then the CPU executes the program / software to implement the animation track compression method provided in the above embodiment. The execution process can refer to the above Figures 1 to 3 Instructions in .
[0140] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for compressing an animation track, characterized in that: include: Grouping the multiple animation tracks according to the bone types corresponding to the multiple animation tracks to obtain multiple track groups, wherein the multiple animation tracks belong to the same animation; Get the basic compression ratio parameters corresponding to each track group; Determine compression ratio parameters corresponding to the animation tracks in the plurality of track groups based on the basic compression ratio parameters corresponding to the plurality of track groups and the hierarchical relationship between the animation tracks in the plurality of track groups; According to the compression ratio parameters of the animation tracks respectively included in the plurality of track groups, compression processing is performed on the animation tracks respectively included in the plurality of track groups.
2. The method according to claim 1, characterized in that For any track group among the multiple track groups, the hierarchical relationship between the multiple animation tracks included in the any track group is consistent with the driver hierarchical relationship between the bones corresponding to the multiple animation tracks included in the any track group; The determining, based on the basic compression ratio parameters corresponding to the multiple track groups and the hierarchical relationship between the animation tracks respectively included in the multiple track groups, the compression ratio parameters respectively corresponding to the animation tracks respectively included in the multiple track groups include: Based on the hierarchical relationship between the multiple animation tracks included in any one track group and the basic compression ratio parameter corresponding to any one track group, the compression ratio parameter corresponding to each animation track included in any one track group is determined.
3. The method according to claim 2, characterized in that The determining, based on the hierarchical relationship between the multiple animation tracks included in any one track group and the basic compression ratio parameter corresponding to any one track group, the compression ratio parameter corresponding to each animation track included in any one track group includes: Set the compression ratio parameter corresponding to the root animation track in any track group to the basic compression ratio parameter; Starting from the root animation track, the compression ratio parameter is increased step by step from the parent animation track to the child animation track to obtain the compression ratio parameter corresponding to each animation track included in any track group, wherein the larger the compression ratio parameter, the deeper the compression degree, and the smaller the compression ratio parameter, the smaller the compression degree.
4. The method according to claim 1, characterized in that: The multiple animation tracks are grouped according to the bone types corresponding to the multiple animation tracks to obtain multiple track groups, including: Get the bone names corresponding to multiple animation tracks; Based on the correspondence between the preset bone names and the bone types, and the bone names corresponding to the animation tracks, determine the bone types corresponding to the animation tracks; The animation tracks corresponding to the same bone type among the multiple animation tracks are divided into a track group to obtain multiple track groups.
5. The method according to claim 1, characterized in that The obtaining of the basic compression ratio parameters corresponding to each track group includes: Receive basic compression ratio parameters corresponding to each track group input by the user; or, Based on the correspondence between the preset bone type and the basic compression ratio parameter, and the bone type corresponding to each of the track groups, the basic compression ratio parameter corresponding to each of the track groups is determined.
6. The method according to claim 1, characterized in that The driver hierarchical relationship between the bones is recorded in a tree structure relationship.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: Obtaining a compression ratio parameter of the animation track corresponding to the character's clothing, wherein the compression ratio parameter of the animation track corresponding to the character's clothing is greater than the compression ratio parameter of the animation tracks corresponding to all bones; The animation track corresponding to the character costume is compressed according to the compression ratio parameter of the animation track corresponding to the character costume.
8. An animation track compression device, characterized in that: include: A grouping module, used for grouping the plurality of animation tracks according to the bone types corresponding to the plurality of animation tracks, to obtain a plurality of track groups, wherein the plurality of animation tracks belong to the same animation; An acquisition module is used to obtain basic compression ratio parameters corresponding to each track group; A determination module, configured to determine the compression ratio parameters corresponding to the animation tracks respectively included in the plurality of track groups based on the basic compression ratio parameters corresponding to the plurality of track groups and the hierarchical relationship between the animation tracks respectively included in the plurality of track groups; The compression module is used to compress each animation track contained in each of the plurality of track groups according to the compression ratio parameters of each animation track contained in each of the plurality of track groups.
9. An electronic device, characterized in that: include: A memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the animation track compression method as described in any one of claims 1-7.
10. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable codes, and when the executable codes are executed by a processor of an electronic device, the processor is caused to execute the animation track compression method according to any one of claims 1 to 7.