Method and terminal for implementing muscle skinning animation in unity

By importing muscle system objects and skinning objects into Unity, configuring muscle data and calculating matrices, and combining this with synchronized updates of skeletal animation, the problem of skeletal animation being unable to accurately simulate muscle deformation was solved, resulting in a more realistic muscle deformation effect.

CN115690271BActive Publication Date: 2025-12-26FUJIAN TQ DIGITAL
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110841639.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-26
Publication Date
2025-12-26
Estimated Expiration
2041-07-26

AI Technical Summary

Technical Problem

Existing skeletal animation solutions cannot accurately simulate muscle deformation, especially in application scenarios that require realistic muscle deformation, where there is a problem of insufficient simulation.

Method used

The muscle skinning animation method is adopted. By importing a pre-made character model, muscle system objects and muscle skinning objects are created, muscle data is configured, the muscle system is initialized, the muscle matrix is ​​calculated and updated, and the muscle list is refreshed synchronously in combination with skeletal animation. Muscle weight information is applied to realize muscle-driven body deformation.

Benefits of technology

It achieves more realistic muscle deformation simulation, improving the accuracy and realism of muscle animation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115690271B_ABST
    Figure CN115690271B_ABST
Patent Text Reader

Abstract

The application discloses a Unity implementation method and terminal for muscle skinning animation; a prefabricated character model with a set skeleton is imported, a muscle system object is created, and muscle data is configured in a muscle list of the muscle system object; the muscles are initialized according to the muscle data, and an initial conversion matrix of the muscle system is established; a muscle skinning object is created and initialized, muscle weight information is configured for vertices contained in the muscle skinning object; a skeleton animation is played, a muscle list is synchronously refreshed, a muscle matrix is calculated and synchronously updated, a position conversion matrix and a vector conversion matrix are calculated according to the muscle matrix and the initial conversion matrix; the muscle skinning object is refreshed according to the position conversion matrix and the vector conversion matrix and is applied according to the muscle weight information; the application realizes muscle driving by a skeleton, muscle driving body model deformation, muscle skinning animation, and more realistic and more accurate simulation of muscle deformation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a Unity implementation muscle skinning animation method and terminal. BACKGROUND

[0002] In the past, when we want to make a character animation in Unity, we generally adopt the scheme of skeletal animation, but the scheme of skeletal animation can only approximately simulate body deformation, and in some application scenarios that need to show accurate muscle deformation, muscle deformation cannot be accurately simulated, so a new solution is needed. SUMMARY

[0003] The technical problem solved by the present application is to provide a Unity implementation muscle skinning animation method and terminal, which can more accurately and realistically simulate muscle deformation.

[0004] In order to solve the above technical problems, the technical scheme adopted by the present application is:

[0005] A Unity implementation muscle skinning animation method, comprising:

[0006] S1, import a pre-made character model with a set skeleton, create a muscle system object, and configure muscle data in the muscle list of the muscle system object;

[0007] S2, initialize the muscle according to the muscle data, and establish a muscle system initial conversion matrix;

[0008] S3, create and initialize a muscle skinning object, and configure muscle weight information for the vertices contained in the muscle skinning object;

[0009] S4, play the skeletal animation, synchronize the muscle list, calculate and synchronize the muscle matrix, calculate the position conversion matrix and vector conversion matrix according to the muscle matrix and the initial conversion matrix;

[0010] S5, refresh the muscle skinning object according to the position conversion matrix and the vector conversion matrix, and apply it according to the muscle weight information.

[0011] In order to solve the above technical problems, another technical scheme adopted by the present application is:

[0012] A Unity implementation muscle skinning animation terminal, comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0013] S1, import the prefabricated character model with the skeleton set, create a muscle system object, and configure muscle data in a muscle list of the muscle system object;

[0014] S2, initialize the muscles according to the muscle data, and establish an initial conversion matrix of the muscle system;

[0015] S3, create and initialize a muscle skinning object, and configure muscle weight information for vertices contained in the muscle skinning object;

[0016] S4, play the skeletal animation, synchronously refresh the muscle list, calculate and synchronously update the muscle matrix, calculate a position conversion matrix and a vector conversion matrix according to the muscle matrix and the initial conversion matrix;

[0017] S5, refresh the muscle skinning object according to the position conversion matrix and the vector conversion matrix, and apply the muscle skinning object according to the muscle weight information.

[0018] The application has the beneficial effects that the application realizes muscle driving by the skeleton, muscle driving the body model deformation, realizes the muscle skinning animation, and can more realistically and accurately simulate the muscle deformation by the newly added muscle system object, muscle data, muscle skinning object, and matrix calculation of weight information. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 A flowchart of a Unity implementation muscle skinning animation method of an embodiment of the application;

[0020] Figure 2 A structural diagram of a Unity implementation muscle skinning animation terminal of an embodiment of the application;

[0021] Figure 3 A UML class diagram of a Unity implementation muscle skinning animation method of an embodiment of the application;

[0022] Figure 4 A partial flowchart of a Unity implementation muscle skinning animation method of an embodiment of the application;

[0023] Label explanation:

[0024] 1, a Unity implementation muscle skinning animation terminal; 2, a processor; 3, a memory. DETAILED DESCRIPTION

[0025] To explain the technical content, the achieved purposes and effects of the application in detail, the following will be explained in combination with the embodiments and the drawings.

[0026] Please refer to Figure 1 , Figure 3 andFigure 4 The application discloses a Unity implementation method of muscle skinning animation, and belongs to the technical field of computer animation.

[0027] S1, importing a prefabricated character model with a set skeleton, creating a muscle system object, and configuring muscle data in a muscle list of the muscle system object;

[0028] S2, initializing the muscle according to the muscle data, and establishing an initial conversion matrix of the muscle system;

[0029] S3, creating and initializing a muscle skinning object, and configuring muscle weight information for a vertex contained in the muscle skinning object;

[0030] S4, playing a skeletal animation, synchronously refreshing a muscle list, calculating and synchronously updating a muscle matrix, calculating a position conversion matrix and a vector conversion matrix according to the muscle matrix and the initial conversion matrix;

[0031] S5, refreshing the muscle skinning object according to the position conversion matrix and the vector conversion matrix, and applying the muscle skinning object according to muscle weight information.

[0032] From the above description, the application has the beneficial effects that the application realizes muscle driving and body model deformation by a skeletal drive muscle through a matrix calculation of weight information, realizes muscle skinning animation, and can more realistically and accurately simulate a muscle deformation scene through a newly added muscle system object, muscle data, muscle skinning object and the like.

[0033] Further, the muscle system object is created by a muscle system class inherited from a MonoBehaviour class, contains a muscle list and a muscle skinning object, the muscle list includes a plurality of muscle data, each muscle data includes two muscle endpoints, each muscle endpoint includes a relative offset, an endpoint position and a bound skeletal object;

[0034] The skeleton includes a plurality of skeletal objects cascaded in a tree structure;

[0035] The muscle skinning object includes all vertex data in a skin mesh of the character model, the vertex data includes a position, a normal, a tangent and muscle weight information of a vertex, and the muscle weight information is associated with a weight information list;

[0036] The relative offset is a position of the muscle endpoint relative to the skeletal object, and the endpoint position is a world space position obtained by using a Transform.TransformPoint method on the skeletal object and the relative offset.

[0037] From the above description, the application defines a muscle system class inherited from the MonoBehavior class, which includes a muscle list and a muscle skin object, and muscle endpoints are bound to bone objects, thereby associating various data.

[0038] Further, the calculation formula of the initial conversion matrix and the muscle matrix is:

[0039] matrix=Matrix4x4.TRS(centerPoint,RQ,Zoom);

[0040] Wherein:

[0041] centerPoint=(attach1+attach2) / 2;

[0042] RQ=Quaternion.FromToRotation(Vector3.forward,attach2-attach1);

[0043] Wherein, centerPoint represents the center point, RQ represents the rotation quaternion, Zoom represents the zoom amount, attach1 and attach2 represent the positions of the two muscle endpoints, Matrix4x4.TRS, Quaternion.FromToRotation and Vector3.forward are all unity APIs.

[0044] From the above description, the above formula can be used to calculate the initial conversion matrix and the muscle matrix.

[0045] Further, in the step S4, the calculation of the position conversion matrix and the vector conversion matrix is as follows:

[0046] PTMatrix=muscleMutrix*bindingMutrix;

[0047] FTMatrix=PTMatrix.inverse.transpose;

[0048] Wherein, PTMatrix represents the position conversion matrix, FTMatrix represents the vector conversion matrix, muscleMutrix represents the muscle matrix, bindingMutrix represents the initial conversion matrix, and Matrix.inverse.transpose is an interface API of unity.

[0049] From the above description, the position conversion matrix and the vector conversion matrix are calculated by the initial conversion matrix and the muscle matrix.

[0050] Further, the step S5 is specifically:

[0051] The muscle skin object is refreshed, and the position, normal and tangent of each vertex in the skin mesh are calculated and updated, and the calculation formula is as follows:

[0052] PointPosition=PTMatrix*PointPosition0;

[0053] PointNormal=FTMatrix*PointNormal0;

[0054] PointTangent=FTMatrix*PointTangent0;

[0055] And the muscle weight information is applied;

[0056] Wherein, PointPosition represents the new vertex position, PointNormal represents the new vertex normal, PointTangent represents the new vertex tangent, PointPosition0 represents the old vertex position, PointNormal0 represents the old vertex normal, and PointTangent0 represents the old vertex tangent.

[0057] From the above description, it can be seen that through the position conversion matrix and the vector conversion matrix, the position, normal and tangent of the new vertex can be calculated in combination with the position, normal and tangent of the old vertex, so as to reflect the muscle movement change.

[0058] Please refer to Figure 2 A terminal for implementing muscle skin animation in Unity, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0059] S1, importing a prefabricated character model with a set skeleton, creating a muscle system object, and configuring muscle data in a muscle list of the muscle system object;

[0060] S2, initializing the muscle according to the muscle data, and establishing an initial conversion matrix of the muscle system;

[0061] S3, creating and initializing a muscle skin object, and configuring muscle weight information for the vertices contained in the muscle skin object;

[0062] S4, playing a skeletal animation, synchronously refreshing the muscle list, calculating and synchronously updating the muscle matrix, calculating the position conversion matrix and the vector conversion matrix according to the muscle matrix and the initial conversion matrix;

[0063] S5, refreshing the muscle-skinned object according to the position conversion matrix and the vector conversion matrix and applying according to muscle weight information.

[0064] From the above description, the beneficial effects of the present application are that the present application adds muscle system objects, muscle data, muscle-skinned objects, etc., calculates weight information through matrix, realizes muscle driving by skeleton, muscle driving body model deformation, realizes muscle-skinned animation, and can more realistically and accurately simulate muscle deformation scenarios.

[0065] Further, the muscle system object is created by a muscle system class inherited from the MonoBehaviour class, and includes a muscle list and a muscle-skinned object, the muscle list includes a plurality of muscle data, each muscle data includes two muscle endpoints, each muscle endpoint includes a relative offset, an endpoint position and a bound skeleton object.

[0066] The skeleton includes a plurality of skeleton objects cascaded in a tree structure.

[0067] The muscle-skinned object includes all vertex data in the skin mesh of the character model, the vertex data includes the position, normal, tangent and muscle weight information of the vertex, and the muscle weight information is associated with a weight information list.

[0068] The relative offset is the position of the muscle endpoint relative to the skeleton object, and the endpoint position is the world space position obtained by using the Transform.TransformPoint() method of the skeleton object and the relative offset.

[0069] From the above description, the present application defines a muscle system class inherited from the MonoBehaviour class, which includes a muscle list and a muscle-skinned object, and the muscle endpoint is bound to the skeleton object, thereby associating each data.

[0070] Further, the calculation formula of the initial conversion matrix and the muscle matrix is:

[0071] matrix=Matrix4x4.TRS(centerPoint,RQ,Zoom);

[0072] Wherein:

[0073] centerPoint=(attach1+attach2) / 2;

[0074] RQ=Quaternion.FromToRotation(Vector3.forward,attach2-attach1);

[0075] wherein centerPoint represents the center point, RQ represents the rotation quaternion, Zoom represents the zoom amount, attach1 and attach2 represent the positions of two muscle end points, Matrix4x4.TRS, Quaternion.FromToRotation and Vector3.forward are all APIs of unity.

[0076] From the above description, it can be seen that the above formula can be used to calculate the initial conversion matrix and the muscle matrix.

[0077] Further, in the step S4, the calculation of the position conversion matrix and the vector conversion matrix is as follows:

[0078] PTMatrix = muscleMutrix * bindingMutrix;

[0079] FTMatrix = PTMatrix.inverse.transpose;

[0080] wherein PTMatrix represents the position conversion matrix, FTMatrix represents the vector conversion matrix, muscleMutrix represents the muscle matrix, bindingMutrix represents the initial conversion matrix, and Matrix.inverse.transpose is an interface API of unity.

[0081] From the above description, it can be seen that the position conversion matrix and the vector conversion matrix are calculated by the initial conversion matrix and the muscle matrix.

[0082] Further, the step S5 is specifically:

[0083] refreshing the muscle skin object, calculating the position, normal and tangent of each vertex in the skin mesh, and the calculation formula is as follows:

[0084] PointPosition = PTMatrix * PointPosition0;

[0085] PointNormal = FTMatrix * PointNormal0;

[0086] PointTangent = FTMatrix * PointTangent0;

[0087] and applying according to the muscle weight information;

[0088] Wherein, PointPosition represents a new vertex position, PointNormal represents a new vertex normal, PointTangent represents a new vertex tangent, PointPosition0 represents an old vertex position, PointNormal0 represents an old vertex normal, and PointTangent0 represents an old vertex tangent.

[0089] As can be seen from the above description, the position, normal and tangent of the new vertex can be calculated by the position conversion matrix and the vector conversion matrix in combination with the position, normal and tangent of the old vertex, so as to reflect the muscle movement change.

[0090] Please refer to Figure 1 , Figure 3 and Figure 4 , the embodiment one of the present application is:

[0091] A Unity implementation muscle skinning animation method, comprising:

[0092] S1, import a pre-made character model with a set skeleton, create a muscle system object, and configure muscle data in the muscle list of the muscle system object;

[0093] The muscle system object is created by inheriting the muscle system class from the MonoBehaviour class, and includes a muscle list and a muscle skinning object, the muscle list includes a plurality of muscle data, each muscle data includes two muscle endpoints, each muscle endpoint includes a relative offset, an endpoint position and a bound bone object;

[0094] The skeleton includes a plurality of bone objects cascaded in a tree structure;

[0095] The muscle skinning object includes all vertex data in the skin mesh of the character model, the vertex data includes the position, normal, tangent and muscle weight information of the vertex, and the muscle weight information is associated with a weight information list;

[0096] The relative offset is the position of the muscle endpoint relative to the bone object, and the endpoint position is the world space position obtained by using the Transform.TransformPoint() method of the bone object and the relative offset.

[0097] In this embodiment, as shown in Figure 3 , the following function classes need to be established for creating corresponding objects:

[0098] MuscleSystem, which inherits the MonoBehaviour class of UnityEngine, is used to manage the whole muscle system. The class contains a muscle list to store all the muscle data of the whole body, and a muscle object.

[0099] Muscle, which records the information of two muscle endpoints (attachl, attach2), is used to calculate the binding matrix and muscle matrix, and to calculate the vertex, normal and tangent.

[0100] MuscleSkin, which records the position, normal and tangent of all the vertices of the original skin mesh model, and configures muscle weights for all the vertices, is used to implement the transformation of the vertex, normal and tangent, and to apply the results to the skin mesh model.

[0101] Attach, which records the bone object to which it is bound, the relative offset and the endpoint position, is used to bind the muscle to the skeleton.

[0102] MuscleSkinWeights, which associates a weight data list to describe which muscles affect a vertex of the skin mesh model and the degree of the influence, is used to describe the muscle weights.

[0103] WeightData, which records the index number of the muscle in the muscle list of the muscle system and the weight value of the muscle, is used to describe the muscle weights.

[0104] In this embodiment, a character model is created and a skeleton is set in a DCC software (Maya, 3dmax, etc.), and then the skeleton is imported into Unity. The skeleton is cascaded by multiple bones in a tree structure.

[0105] A muscle system object is created in Unity, and all the muscle data is configured and stored in the muscle list. Each muscle data contains two endpoints, which can move with the skeleton. The bone attribute of the endpoint can bind a bone object, and the offset is the position of the muscle endpoint relative to the bone. The position attribute is the world space position of the endpoint obtained by the bone and offset using the Transform.TransformPoint() method of Unity.

[0106] S2, initializing the muscles according to the muscle data and establishing an initial conversion matrix of the muscle system;

[0107] In this embodiment, after all the muscle data is configured, the muscles are initialized to establish an initial conversion matrix of the muscle system, and the calculation formula is as follows.

[0108] S3, creating and initializing a muscle skin object and configuring muscle weight information for vertices contained in the muscle skin object;

[0109] In this embodiment, a muscle skin (MuscleSkin) object is created to store all vertex data of the model, and each vertex data contains displacement, normal, tangent and weight. The weight information of each vertex is stored in muscle weight (MuscleSkinWeights), which is associated with a weight information list (WeightData). In the data of each muscle weight, the index number of the muscle in the muscle list and the weight value of the muscle affecting the muscle are included.

[0110] The muscle skin object is initialized, and the position, normal, tangent and data of all vertices of the model are stored in the muscle skin object, and the weight information (muscleWeights) is initialized, which is an array of muscle weight type and has the same length as the number of model vertices.

[0111] The weight value of each vertex corresponding to the muscle weight is set, and the muscle weight has an array of weight information lists (weights), indicating which muscles affect the vertex. weights is an array of weight information lists, which includes index indicating the index number of muscle data and weight indicating the weight value. The weight values of the muscle weights associated with a vertex should add up to 1.

[0112] S4, playing the bone animation, synchronously refreshing the muscle list, calculating and synchronously updating the muscle matrix, calculating the position conversion matrix and vector conversion matrix according to the muscle matrix and the initial conversion matrix;

[0113] The calculation formula of the initial conversion matrix and the muscle matrix is as follows:

[0114] matrix=Matrix4x4.TRS(centerPoint,RQ,Zoom);

[0115] Wherein:

[0116] centerPoint=(attach1+attach2) / 2;

[0117] RQ = Quaternion.FromToRotation(Vector3.forward, attach2 - attach1);

[0118] Where matrix is the initial transform matrix or the muscle matrix, centerPoint represents the center point, RQ represents the rotation quaternion, Zoom represents the zoom amount, attach1 and attach2 represent the positions of two muscle endpoints, Matrix4x4.TRS, Quaternion.FromToRotation, and Vector3.forward are all APIs of unity.

[0119] The position conversion matrix and the vector conversion matrix are calculated as follows:

[0120] PTMatrix = muscleMutrix * bindingMutrix;

[0121] FTMatrix = PTMatrix.inverse.transpose;

[0122] Where PTMatrix represents the position conversion matrix, FTMatrix represents the vector conversion matrix, muscleMutrix represents the muscle matrix, bindingMutrix represents the initial conversion matrix, and Matrix.inverse.transpose is an interface API of unity.

[0123] The initial conversion matrix bindingMatrix is calculated when the muscle system is initialized, and the original transformation space of the muscle is stored. The muscle matrix muscleMatrix is calculated when the skeletal animation is played every frame, and the transformation space of the muscle when the skeletal changes every frame is stored. The calculation formulas of the two are the same, that is, the matrix in the above represents both the initial conversion matrix bindingMatrix and the muscle matrix muscleMatrix.

[0124] S5, refreshing the muscle skinned object according to the position conversion matrix and the vector conversion matrix and applying according to the muscle weight information;

[0125] The step S5 is specifically:

[0126] The muscle skinned object is refreshed, and the position, normal, and tangent of each vertex in the skin mesh are calculated and updated, and the calculation formula is as follows:

[0127] PointPosition = PTMatrix * PointPosition0;

[0128] PointNormal = FTMatrix * PointNormal0;

[0129] PointTangent = FTMatrix * PointTangent0;

[0130] and apply according to the muscle weight information;

[0131] Wherein, PointPosition represents a new vertex position, PointNormal represents a new vertex normal, PointTangent represents a new vertex tangent, PointPosition0 represents an old vertex position, PointNormal0 represents an old vertex normal, and PointTangent0 represents an old vertex tangent.

[0132] Please refer to Figure 2 Embodiment two of the present application is:

[0133] A terminal for implementing muscle skin animation in Unity, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above embodiment one when executing the computer program.

[0134] In summary, the present application provides a method and terminal for implementing muscle skin animation in Unity, which adds muscle system objects, muscle data, muscle skin objects, etc., calculates weight information through matrix, drives muscles through bones, drives body model deformation through muscles, implements muscle skin animation, and can more realistically and accurately simulate muscle deformation scenarios.

[0135] The above description is only an embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent transformation or direct or indirect application in related technical fields based on the content of the present application specification and drawings is also included in the patent protection scope of the present application.

Claims

1. A method for implementing muscle-skinned animation in Unity, the method comprising: The method comprises the following steps: S1, importing a prefabricated character model with a set skeleton, creating a muscle system object, and configuring muscle data in a muscle list of the muscle system object; S2, initializing the muscles according to the muscle data, and establishing an initial conversion matrix of the muscle system; S3, creating and initializing a muscle skin object, and configuring muscle weight information for vertices contained in the muscle skin object; S4, playing a skeletal animation, synchronously refreshing a muscle list, calculating and synchronously updating a muscle matrix, calculating a position conversion matrix and a vector conversion matrix according to the muscle matrix and the initial conversion matrix; S5, refreshing and applying the muscle skin object according to the position conversion matrix and the vector conversion matrix and the muscle weight information; The muscle system object is created by a muscle system class inherited from a MonoBehaviour class, and contains a muscle list and a muscle skin object, the muscle list includes a plurality of muscle data, each muscle data includes two muscle endpoints, and each muscle endpoint includes a relative offset, an endpoint position and a bound skeletal object; The skeleton includes a plurality of skeletal objects cascaded in a tree structure; The muscle skin object includes all vertex data in a skin mesh of the character model, the vertex data includes a position, a normal, a tangent and muscle weight information of a vertex, and the muscle weight information is associated with a weight information list; The relative offset is a position of the muscle endpoint relative to the skeletal object, and the endpoint position is a world space position obtained by using a Transform.TransformPoint() method on the skeletal object and the relative offset; The step S5 specifically comprises: refreshing the muscle skin object, calculating and updating the position, the normal and the tangent of each vertex in the skin mesh, and the calculation formula is as follows: PointPosition=PTMatrix*PointPosition0; PointNormal=FTMatrix*PointNormal0; PointTangent=FTMatrix*PointTangent0; and applying according to the muscle weight information; wherein PTMatrix represents the position conversion matrix, FTMatrix represents the vector conversion matrix, PointPosition represents a new vertex position, PointNormal represents a new vertex normal, PointTangent represents a new vertex tangent, PointPosition0 represents an old vertex position, PointNormal0 represents an old vertex normal, and PointTangent0 represents an old vertex tangent.

2. The method for implementing muscle-skinned animation of Unity according to claim 1, wherein, The calculation formula of the initial conversion matrix and the muscle matrix is as follows: matrix=Matrix4x4.TRS(centerPoint,RQ,Zoom); wherein: centerPoint=(attach1+attach2) / 2; RQ = Quaternion.FromToRotation(Vector3.forward, attach2 - attach1); Where matrix is the initial transform matrix or the muscle matrix, centerPoint represents the center point, RQ represents the rotation quaternion, Zoom represents the zoom amount, attach1 and attach2 represent the positions of the two muscle endpoints, Matrix4x4.TRS, Quaternion.FromToRotation, and Vector3.forward are all unity APIs.

3. The method for implementing muscle-skinned animation of Unity according to claim 1, wherein, In the step S4, the position conversion matrix and the vector conversion matrix are calculated as follows: PTMatrix = muscleMutrix * bindingMutrix; FTMatrix = PTMatrix.inverse.transpose; Where muscleMutrix represents the muscle matrix, bindingMutrix represents the initial conversion matrix, and Matrix.inverse.transpose is an interface API of unity.

4. A terminal for implementing muscle-skinned animation of Unity, comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the following steps when executing the computer program: S1, import a prefabricated character model with a set skeleton, create a muscle system object, and configure muscle data in the muscle list of the muscle system object; S2, initialize the muscles according to the muscle data and establish the initial conversion matrix of the muscle system; S3, create and initialize a muscle skinning object, and configure muscle weight information for the vertices included in the muscle skinning object; S4, play the skeletal animation, synchronize the muscle list, calculate and synchronize the muscle matrix, calculate the position conversion matrix and the vector conversion matrix according to the muscle matrix and the initial conversion matrix; S5, refresh the muscle skinning object according to the position conversion matrix and the vector conversion matrix and apply it according to the muscle weight information; The muscle system class inherits from the MonoBehaviour class and includes a muscle list and a muscle skinning object. The muscle list includes multiple muscle data, each muscle data including two muscle endpoints, each muscle endpoint including a relative offset, an endpoint position, and a bound skeletal object; The skeleton includes multiple skeletal objects cascaded in a tree structure; The muscle skinning object includes all vertex data in the skin mesh of the character model, and the vertex data includes the position, normal, tangent, and muscle weight information of the vertex, and the muscle weight information is associated with a weight information list; The relative offset is the position of the muscle endpoint relative to the skeletal object, and the endpoint position is the world space position obtained by using the Transform.TransformPoint() method on the skeletal object and the relative offset; The step S5 is specifically: Refresh the muscle skinning object, calculate the updated position, normal, and tangent of each vertex in the skin mesh, and the calculation formula is as follows: PointPosition = PTMatrix * PointPosition0; PointNormal = FTMatrix * PointNormal0; PointTangent = FTMatrix * PointTangent0; and apply according to the muscle weight information; Wherein, PTMatrix represents a position conversion matrix, FTMatrix represents a vector conversion matrix, PointPosition represents a new vertex position, PointNormal represents a new vertex normal, PointTangent represents a new vertex tangent, PointPosition0 represents an old vertex position, PointNormal0 represents an old vertex normal, and PointTangent0 represents an old vertex tangent.

5. The terminal of implementing muscle skinning animation of Unity according to claim 4, wherein, The calculation formula of the initial conversion matrix and the muscle matrix is as follows: matrix = Matrix4x4.TRS (centerPoint, RQ, Zoom); Wherein: centerPoint = (attach1 + attach2) / 2; RQ = Quaternion.FromToRotation (Vector3.forward, attach2-attach1); Wherein, matrix is the initial conversion matrix or the muscle matrix, centerPoint represents a center point, RQ represents a rotation quaternion, Zoom represents a zoom amount, attach1 and attach2 represent the positions of two muscle end points, Matrix4x4.TRS, Quaternion.FromToRotation and Vector3.forward are all APIs of unity.

6. The terminal of unity implementation of muscle skin animation according to claim 4, wherein, In the step S4, the position conversion matrix and the vector conversion matrix are calculated as follows: PTMatrix = muscleMutrix * bindingMutrix; FTMatrix = PTMatrix.inverse.transpose; Wherein, muscleMutrix represents a muscle matrix, bindingMutrix represents an initial conversion matrix, and Matrix.inverse.transpose is an interface API of unity.

Citation Information

Patent Citations

  • Skeletal skin animation realization method and device

    CN112598773A