Search

CN-122018797-A - High-efficiency compression and quick reading and writing method for skin weight data based on sparsity theory for animation production

CN122018797ACN 122018797 ACN122018797 ACN 122018797ACN-122018797-A

Abstract

The invention provides a sparsity theory-based high-efficiency compression and quick reading and writing method of skin weight data for animation production, which comprises the following steps of (1) circularly traversing each vertex by using a cmds.skinPercent command and obtaining a skin weight value, (2) compressing the skin weight data, only reserving a non-zero weight value and a joint index corresponding to the non-zero weight value, (3) storing the compressed data to a magnetic disk in a binary format, (4) reading the stored data in the binary format from the magnetic disk and decompressing, and (5) applying the decompressed skin weight data to a target model. The invention can solve the problems of large file volume, low reading and writing efficiency, poor flexibility and the like in the prior art.

Inventors

  • XU LELE
  • YANG CHANGGENG
  • LI YONGQIN
  • ZHONG HUAJIE
  • WANG LIWEN
  • LIU JIEDONG

Assignees

  • 岭南师范学院

Dates

Publication Date
20260512
Application Date
20260127
Priority Date
20251222

Claims (4)

  1. 1. The high-efficiency compression and quick reading and writing method for skin weight data based on sparsity theory for animation production is characterized by comprising the following steps of: (1) Circularly traversing each vertex of the three-dimensional model by using a cmds. SkinPercent command to acquire skin weight data of joints with affected vertices; (2) Compressing the skin weight data, and only reserving a non-zero weight value and a joint index corresponding to the non-zero weight value; (3) Storing the compressed data to a disk in a binary format; (4) Reading the stored data in the binary format from the disk and decompressing; (5) And applying the decompressed skin weight data to the target model.
  2. 2. The method for efficient compression and fast reading and writing of skin weight data based on sparsity theory for animation according to claim 1, wherein the compression processing in the step (2) comprises the following steps: (2.1) weight data extraction and compression preparation, namely storing skin weight data of all vertexes into a one-dimensional weight Array 'weights _array' in sequence; (2.2) non-zero weight screening, namely traversing each skin weight data in 'weights _array', storing a non-zero weight value in 'weightsNonZero _array', and simultaneously recording a joint index corresponding to the non-zero weight value; (2.3) vertex boundary marks, namely calling SKINPERCENT commands in a maya-cmds module in the traversal process, finishing all joint weight processing of each vertex, recording the position of the current non-zero weight value in the weightsNonZero _array, and storing the position as the vertex boundary marks into a vertex segmentation Array VERTSPLIT _array; (2.4) joint index mapping, namely sequentially storing the joint indexes corresponding to all the non-zero weight values into a joint index Array 'infMap _array' to form a mapping relation between the non-zero weight values and the joint indexes; (2.5) converting into NumPy arrays of multi-dimensional values the three key arrays generated in the previous step are converted from the Python list format to the multi-dimensional array ndarray format of NumPy by the np-array () function of the NumPy library.
  3. 3. The method for efficient compression and fast reading and writing of skin weight data based on sparsity theory for animation according to claim 2, wherein the processing manner of storing the vertex partition Array VERTSPLIT _array in step (2.3) is as follows: Vertex boundary segmentation: Defining a vertex segmentation function S (i): S(i) = |{ (i',j) ∈ N | i' ≤ i }| wherein N represents a vertex pair set with non-zero weight, and i represents the index of the current vertex; Each element is a doublet (i ', j), where i' is a "row/vertex index" and j is a "column/adjacency vertex index"; storing the calculation result of S (i) by using a vertex segmentation Array VERTSPLIT _array: vertSplit_Array = [S(0), S(1), ..., S(V - 1), S(V)] Where V represents the total number of vertices, i.e., the maximum value of the row/vertex index +1.
  4. 4. The method for efficient compression and fast reading and writing of skin weight data based on sparsity theory for animation according to any one of claims 1-3, wherein the data storage in the step (3) uses savez functions of NumPy library, and the converted NumPy array is saved as a compressed npz format file.

Description

High-efficiency compression and quick reading and writing method for skin weight data based on sparsity theory for animation production Technical Field The invention relates to the field of three-dimensional animation image data processing, in particular to a high-efficiency compression and quick read-write method for skin weight data based on sparsity theory for animation production. Background In three-dimensional animation, skin weight data is used to define the influence relationship between model vertices and skeletal joints, and is one of the core data of character animation. The traditional method and the defects thereof mainly comprise: 1. And the UV mapping method is used for encoding weight information into an image, so that the file size is large, the precision is low, and the topology change is not supported. 2. The JSON text method is human readable, has serious redundancy, large file size and low reading and writing efficiency. 3. C++ plug-in method has high performance, complex development, poor flexibility and difficult maintenance. Maya traditionally uses UV mapping to store and transfer skin weights. However, this approach has a key limitation in that it is only applicable to models with exactly the same topology. For example, a base sphere and its complex model obtained by "extruding" a surface, both of which differ in three-dimensional shape and in the number of vertices. Even though their UV layouts look similar, the original sphere-based UV weight map cannot be exactly applied to the new model because the underlying vertex relationship becomes, resulting in a weight distribution confusion. For example, in a game development scenario, hundreds of soldiers (e.g., soldiers with different equipment and skin colors) with variations in appearance and general skeleton animation are required, and unified skeletons (e.g., humanoid 15-20 joints) are required to be bound to support sharing animation such as running, jumping, attacking and the like. The biggest pain point at this time is that if each variant (hair, equipment trim) is manually modeled, key-by-key binding, weight is manually brushed, it takes several months and "weight deviation" is liable to occur resulting in animation threading. This will greatly slow down the efficiency of the animation workflow. With the improvement of model precision and joint number, the traditional method has difficulty in meeting the double requirements of modern animation on efficiency and precision. Thus, there is a need for an efficient, lossless, easy-to-use three-dimensional animation data management scheme. Disclosure of Invention Aiming at the defects of the prior art, the invention provides a high-efficiency compression and quick read-write method for skin weight data based on sparsity theory for animation production, which aims to solve the problems of large file volume, low read-write efficiency, poor flexibility and the like in the prior art. The aim of the invention can be achieved by the following technical measures: A skin weight data high-efficiency compression and quick read-write method based on sparsity theory for animation production comprises the following steps: (1) Circularly traversing each vertex of the three-dimensional model by using a cmds. SkinPercent command to acquire skin weight data of joints with affected vertices; (2) Compressing the skin weight data, and only reserving a non-zero weight value and a joint index corresponding to the non-zero weight value; (3) Storing the compressed data to a disk in a binary format; (4) Reading the stored data in the binary format from the disk and decompressing; (5) And applying the decompressed skin weight data to the target model. Further, the compression processing in the step (2) is as follows: (2.1) weight data extraction and compression preparation, namely storing skin weight data of all vertexes into a one-dimensional weight Array 'weights _array' in sequence; (2.2) non-zero weight screening, namely traversing each skin weight data in 'weights _array', storing a non-zero weight value in 'weightsNonZero _array', and simultaneously recording a joint index corresponding to the non-zero weight value; (2.3) vertex boundary markers, namely calling SKINPERCENT commands in a maya. Cmds module in the traversal process, recording the position of the current non-zero weight value in the weightsNonZero _array, and storing the position as vertex boundary markers in a vertex segmentation Array VERTSPLIT _array; Further, the processing manner of storing the vertex partition Array VERTSPLIT _array in the step (2.3) is as follows: Vertex boundary segmentation: Defining a vertex segmentation function S (i): S(i) = |{ (i',j) ∈ N | i' ≤ i }| wherein N represents a vertex pair set with non-zero weight, and i represents the index of the current vertex; Each element is a doublet (i ', j), where i' is a "row/vertex index" and j is a "column/adjacency vertex index"; storing the calculation result of S (i) by