Motion control method, device and equipment of virtual character in game and storage medium
By controlling the muscle skin linkage of virtual characters through inter-skeletal motion constraints and skin weights, the problem of long cycle and high cost of dynamic muscle simulation in games is solved, and fast and low-cost muscle simulation in game engines is realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2023-12-06
- Publication Date
- 2026-07-31
AI Technical Summary
Current technology for muscle simulation based on dynamics has a long production cycle and high cost in games, and it is only suitable for film and television rendering works, and cannot be efficiently applied to game engines.
By controlling the muscle skin linkage effect of virtual characters through inter-skeletal motion constraints and skin weights, dynamic rendering is reduced, making it suitable for game engines.
It enables fast and low-cost muscle simulation in game engines, reducing performance pressure and improving the efficiency of creating animated muscle details.
Smart Images

Figure CN117732055B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game technology, and more specifically, to a method, apparatus, device, and storage medium for controlling the motion of virtual characters in a game. Background Technology
[0002] With the continuous development of computer graphics (CG) animation technology, more and more animated works are using muscle simulation technology to enhance the realism of characters. Muscle simulation refers to simulating the changes of muscles during human movement through computer algorithms. The first step in muscle simulation is to establish a muscle structure model.
[0003] Currently, when muscle contraction occurs in an animation sequence, the character's muscles automatically bend and compress, using automatic collision detection and organic matter volume conservation response to simulate the changes in collision objects, thereby mimicking the effects of human muscle changes.
[0004] However, the aforementioned dynamics-based muscle simulations are time-consuming and costly to produce, and are only suitable for film and television rendering works. Summary of the Invention
[0005] In view of this, embodiments of this application provide a method, apparatus, device, and storage medium for controlling the motion of virtual characters in games, in order to solve the problems that dynamics-based muscle simulation has a long production cycle, high cost, and is only applicable to film and television rendering works.
[0006] In a first aspect, embodiments of this application provide a method for controlling the motion of a virtual character in a game, including:
[0007] Obtain the target character model of the virtual character in the game;
[0008] In response to a motion trigger event of the first part of the virtual character, the motion constraints between bones of the first part and the skinning weights of the first part in the target character model are obtained.
[0009] Based on the motion constraints between the bones of the first part, the bones of the first part in the target character model are controlled to move, and based on the skin weight of the first part, the skin of the first part in the target character model is driven to move.
[0010] Secondly, embodiments of this application also provide a motion control device for virtual characters in games, comprising:
[0011] The acquisition module is used to acquire the target character model of the virtual character in the game;
[0012] The acquisition module is further configured to, in response to the motion triggering event of the first part of the virtual character, acquire the inter-bone motion constraints and the skinning weights of the first part in the target character model.
[0013] The control module is used to control the movement of the bones of the first part in the target character model according to the motion constraints between the bones of the first part, and to drive the skin of the first part in the target character model to move according to the skin weight of the first part.
[0014] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the motion control method for virtual characters in a game as described in any of the first aspects.
[0015] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, performs the motion control method for virtual characters in a game as described in any of the first aspects.
[0016] This application provides a method, device, equipment, and storage medium for controlling the motion of a virtual character in a game. The method includes: acquiring a target character model of the virtual character in the game; responding to a motion trigger event of a first part of the virtual character; acquiring the inter-bone motion constraints and skin weights of the first part of the target character model; controlling the bones of the first part of the target character model to move according to the inter-bone motion constraints; and driving the skin of the first part of the target character model to move according to the skin weights. This application controls the movement of the skin of the first part through inter-bone motion constraints and skin weights, achieving muscle twisting and deformation, forming a muscle-skin linkage effect. It is suitable for game engines, eliminates the need for complex dynamic rendering, reduces performance pressure, and has a short production cycle and low cost. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 1 ;
[0019] Figure 2 A schematic diagram of the first part of the target character model provided in the embodiments of this application. Figure 1 ;
[0020] Figure 3 A schematic diagram of the first part of the target character model provided in the embodiments of this application. Figure 2 ;
[0021] Figure 4 A schematic diagram of a specific target role model provided in this application embodiment. Figure 1 ;
[0022] Figure 5 A schematic diagram of a specific target role model provided in this application embodiment. Figure 2 ;
[0023] Figure 6 A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 2 ;
[0024] Figure 7 A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 3 ;
[0025] Figure 8 A schematic diagram of the second part in the target character model provided in the embodiments of this application. Figure 1 ;
[0026] Figure 9 A schematic diagram of the second part in the target character model provided in the embodiments of this application. Figure 2 ;
[0027] Figure 10 A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 4 ;
[0028] Figure 11 A schematic diagram of a specific target role model provided in this application embodiment. Figure 3 ;
[0029] Figure 12 A schematic diagram of a specific target role model provided in this application embodiment. Figure 4 ;
[0030] Figure 13 A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 5 ;
[0031] Figure 14A schematic diagram of the modeling interface provided in the embodiments of this application. Figure 1 ;
[0032] Figure 15 A schematic diagram of the modeling interface provided in the embodiments of this application. Figure 2 ;
[0033] Figure 16 Comparison of the effects of the upper arm and pectoralis major muscle provided in the embodiments of this application;
[0034] Figure 17 A comparison diagram of the effects on the upper arm and latissimus dorsi muscles provided in the embodiments of this application;
[0035] Figure 18 A schematic diagram of the structure of the motion control device for virtual characters in a game provided in this application embodiment;
[0036] Figure 19 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0038] Before introducing the technical solution of this application, the technical terms involved in this application will be explained first:
[0039] Dynamics: Dynamics refers to the process of creating animations by simulating the physical properties of objects and their interactions. Interactions can be fully parameterized, similar to the case of a physical object falling side by side, and can include objects with keyframe animation (such as a thrown ball) and objects with dynamic animation (such as a bowling ball pivot).
[0040] Bone: In game engines, bones usually refer to the layered structure that makes up the skeleton of a character or object, which is made up of multiple joints and bones.
[0041] Frame rate: Similar to the concept in movies, it is the number of images (frames) displayed per second.
[0042] Virtual Object: A virtual auxiliary object is a wireframe cube with its pivot point located at the center of its geometry. It has a name but no parameters and cannot be modified or rendered. Its only real function is its pivot point, which serves as the center of transformations. The wireframe acts as a reference for transformation effects.
[0043] MAYA: MAYA is one of the most important 3D character animation software in the industry.
[0044] Animation baking refers to the process of converting the motion trajectory and deformation results of an animation into keyframes or texture maps.
[0045] Skinning Tool: Provides a method for copying skinning data (envelopes and vertex weights) from one module to another. The Skinning Tool works by embedding a copy of the skinning data source mesh and then using the object copy to draw the data texture onto the target mesh.
[0046] Coordinate space: A coordinate system consisting of three mutually perpendicular vectors (X, Y, Z).
[0047] Model: Overall 3D model.
[0048] MESH: Model mesh.
[0049] In the current stage of muscle modeling, based on human anatomy, the human body is broken down into components such as bones, muscles, and skin. Then, the muscles are built into a series of "ropes" to describe the movement and deformation of the muscles. This process requires the help of 3D modeling software. However, conventional muscle dynamics systems are based on the control of model mesh surfaces, which cannot be imported into game engines using conventional bone data. Furthermore, the production cycle is long and the cost is high, making it only suitable for film and television CG rendering works.
[0050] Existing muscle simulation solutions include the following:
[0051] The first type is a plugin that generates a native muscle dynamics solver from a 3D software (MAYA) physics plugin, along with real-time physics simulation plugins and physics plugin tools. It can simulate anything with translation and rotation channels, generating secondary motion for cloth, hair, and muscles within the MAYA viewport in real time. This is used to simulate hair, cloth, and even muscle dynamics. Control options include thrust, pull, and turbulent forces, as well as point, direction, and parent-child constraints. Based on model mesh surface control, it controls skeletal constraints and mesh point deformation. When muscle contraction occurs in an animation sequence, it automatically bends and compresses the character's muscles. It uses automatic collision detection and organic volume conservation response to simulate changes in collision objects, thus simulating the effects of human muscle changes. However, its drawback is high resource consumption, and it is generally used for film and television rendering. Traditional muscle dynamics simulation requires multiple sets of model topologies and relies on software scripts for processing, resulting in complex procedures and long development times.
[0052] The second method involves muscle simulation based on curve deformation using 3D software. This method has a complex development process, a long development time, and requires complex scripts for assistance.
[0053] The third method involves manually creating animation sequences, which requires complex skeletal rigging. Muscle transitions are achieved by manually twisting bones one by one, resulting in stiff effects and high costs.
[0054] Based on this, this application provides a motion control method for virtual characters in games. By controlling the movement of the skin of the first part through motion constraints between bones and skin weights, a muscle-skin linkage effect is formed. This method is suitable for game engines, does not require complex dynamic rendering, reduces performance pressure, and has a short production cycle and low cost.
[0055] In one embodiment of this application, the motion control method for virtual characters in a game can run on a local terminal device or a server. When the motion control method for virtual characters in a game runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0056] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program's execution and the game screen presentation are separated. The storage and execution of the motion control methods for virtual characters in the game are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, or PDA; however, the information processing is performed by the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.
[0057] In an optional implementation, taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the player through a graphical user interface (GUI), i.e., conventionally by downloading, installing, and running the game program via an electronic device. The local terminal device can provide the GUI to the player in various ways, such as rendering it on the terminal's display screen or providing it to the player via holographic projection. For example, the local terminal device can include a display screen for displaying the GUI, which includes game screens, and a processor for running the game, generating the GUI, and controlling the display of the GUI on the display screen.
[0058] In one possible implementation, this invention provides a motion control method for virtual characters in a game, which provides a graphical user interface through a terminal device. The terminal device can be either the aforementioned local terminal device or a client device in the aforementioned cloud interaction system.
[0059] Figure 1 A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 1 In this embodiment, the executing entity can be an electronic device.
[0060] like Figure 1 As shown, the method may include:
[0061] S101. Obtain the target character model of the virtual character in the game.
[0062] In this game, the virtual character can be, for example, a virtual animal or a virtual person. The target character model is the character model of the virtual character. The target character model can be a mesh model of a skeletal system with the game character. The bones of the corresponding parts on the skeletal system are bound one-to-one with the corresponding parts on the mesh model. For example, the bones of the parts on the skeletal system can include the upper arm bones, and the parts on the mesh model can include the upper arm.
[0063] In some embodiments, a target character model for a virtual character in a game is obtained by running a game engine on an electronic device and loading a game package using the game engine.
[0064] S102, In response to the motion trigger event of the first part of the virtual character, obtain the motion constraints between bones of the first part of the target character model and the skinning weight of the first part.
[0065] The motion trigger event for the first part of the virtual character is used to trigger the movement of the first part of the virtual character. The first part can be, for example, the upper arm, i.e., the biceps brachii. This motion trigger event can be implemented through the corresponding software code in the game software package.
[0066] In response to the motion triggering event, obtain the inter-bone motion constraints and the skin weight of the first part in the target character model. The inter-bone motion constraints are the motion constraints between multiple bones in the first part. Motion constraints refer to a property used to connect the relationship between bones. Through motion constraints, the constraints and associations between different bones can be realized to achieve specific animation effects.
[0067] Among them, the motion constraints between bones can be rotational constraints, which are used to indicate the rotational relationship between multiple bones in the first part. For example, when bone A1 rotates by an angle A, it causes bone A2 to rotate by an angle B.
[0068] The skin weight of the first part is used to indicate the degree of influence of the skeleton of the first part on the skin of the first part. In other words, it indicates the responsiveness of the skin of the first part to the skeleton of the first part. When the skeleton of the first part moves, it can cause the skin of the first part to change its position and shape, thereby simulating the effect of muscle twisting and deformation. Here, the skin of the first part can be understood as the model mesh of the first part.
[0069] In some embodiments, the skin weight can range from 0 to 1. A larger value indicates a greater influence of the skeleton on the skin, while a smaller value indicates a smaller influence of the skeleton on the skin. It is worth noting that model meshes closer to the skeleton are more affected by the skeleton and have a larger skin weight, while model meshes farther from the skeleton are less affected by the skeleton and have a smaller skin weight.
[0070] S103. Based on the motion constraints between the bones of the first part, control the bones of the first part in the target character model to move, and based on the skin weight of the first part, drive the skin of the first part in the target character model to move.
[0071] Based on the motion constraints between the bones of the first part, the bones of the first part in the target character model are controlled to move. Based on the skin weight of the first part, the bones of the first part are controlled to drive the skin of the first part in the target character model to move. Taking the motion constraints between bones as rotation constraints as an example, based on the rotation constraints of the first part, multiple bones of the first part in the target character model are controlled to rotate. While multiple bones of the first part are rotating, the skin of the first part is driven to move based on the skin weight of the first part.
[0072] The motion constraints between multiple bones in the first part can be set based on the decay motion information between bones. This decay motion information can be understood as the decay motion information set to simulate the attenuation or gradual change in the motion amplitude of multiple bones in the first part. This makes the motion more consistent with the physical laws of the real world, increasing the realism and visual effect of the scene. Specifically, the decay motion of the bones can be linear decay. Linear decay describes how an attribute or effect gradually weakens or disappears as distance increases. Linear decay makes the animation more realistic and natural in animations where the intensity of the effect changes.
[0073] Taking the three bones A1, A2, and A3 in the first part as an example, through the mutual constraints of A1, A2, and A3, when A1 rotates, A2 automatically obtains 50% of the rotation value of A1, and A3 automatically obtains 50% of the rotation value of A2 (i.e., 25% of A1). For example, through the inter-bone motion constraints between A1 and A2, when A1 rotates 180 degrees, it drives A2 to rotate 90 degrees, and through the inter-bone motion constraints between A2 and A3, it drives A3 to rotate 45 degrees, thereby achieving a linear decay of the rotation value.
[0074] In some embodiments, the motion constraints between bones in the first part are achieved by connecting multiple bones in the first part through constraint tools and controlling the motion relationships and restrictions of multiple bones. This relationship can form a bone hierarchy structure in the first part, realize the parent-child relationship of bones and animation control, and achieve the muscle twisting and deformation effect of the target character model through the motion constraints between bones.
[0075] Figure 2 A schematic diagram of the first part of the target character model provided in the embodiments of this application. Figure 1 ,like Figure 2As shown, the mesh of the first part of the target character model is bound to the bones of the first part (A1, A2, A3 in the figure).
[0076] Figure 3 A schematic diagram of the first part of the target character model provided in the embodiments of this application. Figure 2 ,like Figure 3 As shown, by setting motion constraints between bones and skin weights for the first part, when the bones of the first part drive the skin movement of the first part, the muscle distortion and deformation effect of the first part in the target character model can be seen.
[0077] It is worth noting that the above steps S101-S103 can be performed by running a game engine on an electronic device. The electronic device can be equipped with a game engine, and it can be either the developer's electronic device or the game player's electronic device. For game developers, by creating and saving the target character model of the virtual character, integrating game art resources to generate a game package, and loading the game package, the target character model can be presented on the electronic device to achieve a visual experience of controlling the movement of the target character model.
[0078] In the motion control method for virtual characters in the game in this embodiment, when the bones of the first part of the target character model are controlled to move according to the motion constraints between the bones of the first part, the skin of the first part is driven to move based on the skin weight of the first part, thereby realizing the effect of the bones of the first part driving the muscles of the first part of the target character model to twist and deform, forming a muscle skin linkage effect. It is suitable for game engines, does not require complex dynamic rendering, reduces performance pressure, has a short production cycle and low cost, and improves the efficiency of animation muscle detail production.
[0079] Taking the upper arm as the first part and rotational constraints as the inter-bone motion constraints in the first part as an example. Figure 4 A schematic diagram of a specific target role model provided in this application embodiment. Figure 1 ,like Figure 4 As shown, under normal default conditions, the mesh topology of the upper arm of the target character model is uniform.
[0080] Figure 5 A schematic diagram of a specific target role model provided in this application embodiment. Figure 2 ,like Figure 5 As shown, when the upper arm is raised, the upper arm in the target character model rotates under the action of the upper arm bones. It can be seen that, relative to... Figure 4 The upper arm mesh is twisted to simulate the natural twisting effect of a muscular arm.
[0081] Figure 6A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 2 ,like Figure 6 As shown, in an optional implementation, the method may further include:
[0082] S201. Control the skeleton of the first part to drive the reference virtual body of the second part in the target character model that is associated with the skeleton of the first part to move.
[0083] The second part can be the pectoralis major and / or latissimus dorsi, the reference virtual body is a virtual part on the second part, and the reference virtual body is associated with the skeleton of the first part, for example, associated with the skeleton A1 of the first part.
[0084] While the bones in the first part are moving, control the bones in the first part to drive the virtual body in the second part to move.
[0085] S202. Obtain the reference virtual body of the second part and the skeletal motion constraints of the second part in the target character model, as well as the skinning weights of the second part.
[0086] The motion constraint between the reference virtual body and the skeleton of the second part is the motion constraint between the reference virtual body and the skeleton of the second part. Through this motion constraint, the skeleton of the second part can be moved while the reference virtual body moves.
[0087] The skin weight of the second part is used to indicate the degree of influence of the skeleton of the second part on the skin of the second part. In other words, the skin of the second part affects the skeleton of the second part. When the skeleton of the second part moves, the skin of the second part can be driven to stretch and contract based on the skin weight of the second part, thereby simulating the muscle stretching and pulling effect.
[0088] S203. Based on the skeletal motion constraints, control the reference virtual body to move the bones of the second part in the target character model, and based on the skinning weight of the second part, move the skinning of the second part in the target character model.
[0089] Based on the skeletal motion constraints, the reference virtual body is controlled to move the bones of the second part of the target character model. Based on the skin weight of the second part, the bones of the second part are controlled to move the skin of the second part. The skin of the second part can be understood as the model mesh of the second part.
[0090] It is worth noting that the explanation of the skin weight of the second part can be found in the relevant description above, and will not be repeated here.
[0091] In the motion control method for virtual characters in the game in this embodiment, the skeleton of the first part is controlled to drive the reference virtual body of the second part to move, and the skeleton of the second part is driven to move based on the skeleton motion constraints. The skin of the second part is driven to move based on the skin weight of the second part, thereby controlling the length change of the model mesh of the second part in the target character model. This achieves the effect of the skeleton of the second part driving the muscles of the second part in the target character model to stretch and pull, forming a muscle skin linkage effect. It is suitable for game engines, does not require complex dynamic rendering, reduces performance pressure, has a short production cycle and low cost, and improves the efficiency of animation muscle detail production.
[0092] The skeletal motion constraints include: the positional constraints of the first bone in the reference virtual body and the second part, and the skinning weights of the second part include: the skinning weights of the second bone in the second part that are associated with the first bone.
[0093] The skeleton of the second part includes the first skeleton and the second skeleton. There is a position constraint between the reference virtual body and the first skeleton in the second part. The position constraint can be understood as the alignment of the position of the first skeleton and the reference virtual body. Position alignment is used to align the selected object or component (such as vertex, edge, face) with other objects or reference objects in the scene. That is, the first skeleton moves with the reference virtual body.
[0094] In the second part, the second bone and the first bone are related, for example, they can be parent and child, the first bone is the child bone and the second bone is the parent bone. One end of the second bone is connected to the first bone and the other end of the second bone is fixed. The second bone moves and stretches as the first bone moves.
[0095] Figure 7 A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 3 ,like Figure 7 As shown, in an optional implementation, step S203, controlling the reference virtual body to move the bones of the second part in the target character model according to the skeletal motion constraints, and moving the skin of the second part in the target character model according to the skinning weight of the second part, may include:
[0096] S301. Based on the position constraints, control the reference virtual body to drive the first bone in the second part to move, and drive the second bone in the second part to perform extension and retraction movements.
[0097] During the movement of the reference virtual body, based on the positional constraints of the first bone in the reference virtual body and the second part, the reference virtual body is controlled to drive the first bone in the second part to move. During the movement of the first bone, based on the relationship between the first bone and the second bone, the first bone is controlled to drive the second bone to perform extension and retraction movements.
[0098] S302. Based on the skinning weight of the second bone, control the second bone to drive the skinning of the second part of the target character model to perform stretching and contraction movements.
[0099] The skin weight of the second bone is used to indicate the degree of influence of the second bone on the skin of the second part. In other words, it indicates the degree of response of the skin of the second part to the second bone. When the second bone moves, the skin weight of the second bone can drive the second part to perform stretching and contraction movements, thereby simulating the stretching and contraction effect of muscles.
[0100] Taking B1 as the reference virtual body for the second part and B2 and B3 as the first and second bones for the second part as examples, Figure 8 A schematic diagram of the second part in the target character model provided in the embodiments of this application. Figure 1 ,like Figure 8 As shown, the mesh of the second part in the target character model is bound to the skeleton of the second part. By setting position constraints and gaze constraints, when the reference virtual body moves, the skeleton of the second part drives the skin movement of the second part, and the muscles of the second part in the target character model contract.
[0101] Figure 9 A schematic diagram of the second part in the target character model provided in the embodiments of this application. Figure 2 ,like Figure 9 As shown, by setting position constraints and gaze constraints, when the reference virtual body moves, the muscles of the second part in the target character model stretch when the skeleton of the second part drives the skin movement of the second part.
[0102] In the motion control method for virtual characters in the game in this embodiment, based on position constraints, the reference virtual body is controlled to drive the first bone in the second part to move, and to drive the second bone in the second part to perform stretching and contraction movements. Based on the skinning weight of the second bone, the skin of the second part is driven to move, thereby controlling the length change of the model mesh of the second part in the target character model. This achieves the effect of the bones of the second part driving the muscles of the second part in the target character model to stretch and contract, forming a muscle skinning linkage effect. This method is suitable for game engines, does not require complex dynamic rendering, reduces performance pressure, has a short production cycle and low cost, and improves the efficiency of animation muscle detail production.
[0103] Among them, skeletal motion constraints also include: gaze constraints of the reference virtual body and the second skeleton.
[0104] There is a look-at constraint between the reference virtual body and the second skeleton in the second part. The look-at constraint ensures that an object automatically follows the orientation change of the target object to maintain its facing position. In other words, when an object (called a "child object" or "dependent object") is associated with another object (called the "target object" or "controlled object"), the child object automatically adjusts its orientation to always face the target object, regardless of how the target object moves. Here, the reference virtual body is the target object, and the second skeleton is the child object; that is, the second skeleton follows the orientation change of the reference virtual body to maintain its facing position.
[0105] Figure 10 A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 4 ,like Figure 10 As shown, in an optional implementation, step S203, which involves controlling the reference virtual body to move the bones of the second part of the target character model according to the skeletal motion constraints, and moving the skin of the second part of the target character model according to the skinning weights of the second part, may further include:
[0106] S401. Based on the gaze constraint, control the reference virtual body to drive the second skeleton to rotate.
[0107] S402. Based on the skinning weight of the second bone, control the second bone to drive the skinning of the second part of the target character model to rotate.
[0108] By establishing a gaze constraint between the reference virtual body and the second skeleton, during the movement of the reference virtual body, the reference virtual body can be controlled to drive the second skeleton to rotate according to the gaze constraint, and the second skeleton can be controlled to drive the skin of the second part of the target virtual character model to rotate according to the skin weight of the second skeleton.
[0109] Taking the pectoralis major muscle as the second part as an example, Figure 11 A schematic diagram of a specific target role model provided in this application embodiment. Figure 3 ,like Figure 11 Under normal default conditions, the pectoralis major muscle mesh is uniformly wired.
[0110] Figure 12 A schematic diagram of a specific target role model provided in this application embodiment. Figure 4 ,like Figure 12As shown, when the upper arm is raised, the reference virtual body B1 of the pectoralis major muscle moves synchronously under the action of the upper arm bones. Based on the positional constraints between the reference virtual body B1 and the first bone B2 of the pectoralis major muscle, the gaze constraints between the reference virtual body and the second bone B3 of the pectoralis major muscle, and the correlation between the first bone B2 and the second bone B3, the second bone B3 is stretched. Figure 11 In comparison, the mesh points of the right pectoralis major model, when the right hand is raised, are higher than the mesh points of the left hand in its default state. This is because the right pectoralis major model mesh has been affected by the added pectoralis major skeleton. Figure 12 The second bone B3 in the pectoralis major muscle is stretched and lengthened, which in turn causes the skin of the pectoralis major muscle to stretch.
[0111] In the motion control method for virtual characters in the game in this embodiment, by referring to the positional constraints between the virtual body and the first bone, and the gaze constraints between the virtual body and the second bone, the second bone is controlled to drive the skin of the second part to perform stretching and rotational movements, which further improves the muscle stretching and pulling effect and makes the muscle effect more realistic.
[0112] Figure 13 A flowchart illustrating the motion control method for virtual characters in a game provided in this application embodiment. Figure 5 ,like Figure 13 As shown, in an optional implementation, before step S101, obtaining the target character model of the virtual character in the game, the method may further include:
[0113] S501, Create the skeletal system and character model for the virtual character.
[0114] In 3D modeling software, you can create a character model of a virtual character and adjust its structure and proportions to meet preset conditions. The 3D modeling software also provides a skeleton creation menu, which can be used to create the skeletal system of the virtual character.
[0115] In an optional implementation, step S501, creating a skeletal system and character model for a virtual character, includes: creating a basic skeletal system and character model for the virtual character; creating bones of a preset type and adding them to the bones of the first part and the bones of the second part of the basic skeletal system to generate the skeletal system.
[0116] The basic skeletal system of the virtual character can be the Biped skeletal system. Since the number of bones in each part of the Biped skeletal system is relatively small, it cannot meet the skinned muscle effect of extreme movements. Therefore, preset types of bones can also be created and added to the bones of the first and second parts of the basic skeletal system to generate the skeletal system of the virtual character. The preset type of bones can be Bone bones. Three Bone bones can be created and added to the bones of the first part, namely bones A1 (B_RUpperArmTwist01), A2 (B_RUpperArmTwist02), and A3 (B_RUpperArmTwist03). Two Bone bones can be created and added to the bones of the second part, namely bones B2 and B3.
[0117] The second part may include the pectoralis major and latissimus dorsi muscles, the skeletal structures B2 (biped Spine2_2) and B3 (biped Spine2_2) of the pectoralis major, the skeletal structures B2 (biped Spine2_4) and B3 (biped Spine2_3) of the latissimus dorsi, the reference virtual body B1 (Dummy001) of the pectoralis major, and the reference virtual body B1 (Dummy002) of the latissimus dorsi.
[0118] In other words, the created bone is added to the upper arm bone, and the created bone is added to the pectoralis major bone and latissimus dorsi bone respectively to generate the skeletal system of the virtual character.
[0119] In this embodiment, since the number of bones in each part of the basic skeletal system is small, it cannot meet the skinned muscle effect of extreme movements. Furthermore, since the human body has a complex linkage structure, the basic skeletal system cannot meet the muscle simulation effect. Therefore, the skeletal system of the virtual character is generated by creating Bone skeletons to the basic skeletal system.
[0120] Figure 14 A schematic diagram of the modeling interface provided in the embodiments of this application. Figure 1 ,like Figure 14 As shown, create and import the virtual character model in the modeling software, select system in the skeleton creation menu, then select Biped, and click on the modeling interface in the 3D modeling software to place the Biped skeleton system.
[0121] S502. Bind the bones of each part of the skeletal system to the corresponding parts in the character model to generate the target character model.
[0122] The size and position of the skeletal system are determined to match the size and pose of the character model. Then, the bones in the skeletal system are bound to the corresponding parts in the character model. For example, the upper arm bones in the skeletal system are bound to the upper arm in the character model to generate the target character model.
[0123] In some embodiments, the skin modifier in 3D modeling software or other skinning tools can be used to bind the skeletal system and the character model. For example, select the point to surface constraint tool in the Constraint menu, click on the bones of each part of the skeletal system, constrain them to the corresponding parts of the character model, and use the Biped controller to adjust the size and position of the skeletal system so that the skeletal system matches the size and pose of the character model.
[0124] Figure 15 A schematic diagram of the modeling interface provided in the embodiments of this application. Figure 2 ,like Figure 15 As shown, the skeletal system and the character model are overlapped to match their size and pose, thus achieving the binding between the skeletal system and the character model.
[0125] S503, Set skeletal motion constraints for the first and second parts of the target character model.
[0126] Setting skeletal motion constraints for the first part can be understood as setting skeletal motion constraints for the bone skeleton of the first part. These skeletal motion constraints include inter-bone motion constraints, such as rotational constraints between bones. Setting skeletal motion constraints for the second part can be understood as setting skeletal motion constraints for the reference virtual body of the second part and the bone skeleton of the second part. These skeletal motion constraints include position constraints and gaze constraints.
[0127] In an optional implementation, step S503, setting skeletal motion constraints for the first part and the second part in the target character model, may include: setting inter-bone motion constraints for the first part based on the inter-bone attenuation motion information of the first part; and setting skeletal motion constraints for the bones of the reference virtual body and the second part.
[0128] Among them, the inter-bone attenuation motion information of the first part includes the inter-bone attenuation motion information between bones A1 and A2 in the first part, and the inter-bone attenuation motion information between bones A2 and A3.
[0129] In some embodiments, three independent, unlinked bones A1, A2, and A3 are created for the first part, and floating-point expressions (i.e., attenuation motion information between bones) are set so that bones A2 and A3 acquire constraint attributes. In some embodiments, after selecting bone A2, a variable B_Twist1 is added through the script editor (ScriptControlle) panel, and a constant 360 (representing the maximum rotation value as 360°) is added. The attenuation motion information between bones is expressed as (B_Twist1 / 2)*3.14159 / 180, where B_Twist1 is the rotation value of bone A1, and the rotation value of bone A2 is (B_Twist1 / 2)*3.14159 / 180. That is, the constraint relationship of the specified trajectory is given to A1, and the parent object of the rotation rule set for A2 is assigned to A1, so that A2 can obtain 50% of the rotation value of A1 under any rotation value. That is, A1 constrains the rotation value of A2, and A2 is constrained by 50% of the rotation value of A3.
[0130] Similarly, after selecting bone A3, add a creation variable B_Twist2 through the Script Editor panel, and add a constant 360 (representing the maximum rotation value as 360°). The decay motion information between bones is represented as (B_Twist2 / 2)*3.14159 / 360, where B_Twist2 is the rotation value of bone A2, and the rotation value of bone A3 is (B_Twist2 / 2)*3.14159 / 360. In other words, the constraint relationship of the specified trajectory is given to A2, and the parent object of the rotation rule set for A3 is assigned to A2, so that A3 can obtain 50% of the rotation value of A2 under any rotation value of A2. That is, A2 constrains the rotation value of A3, and A3 is constrained by 50% of the rotation value of A2.
[0131] In this embodiment, bones A2 and A3 perform rotation difference attenuation based on the previous rotation angle (a rotation value of any positive or negative amplitude based on the parent object of the constraint relationship). Through the mutual constraints of bones A1, A2, and A3, when bone A1 rotates, bone A2 automatically obtains 50% of the rotation value of A1, and A3 automatically obtains 50% of the rotation value of bone A2 (i.e., 25% of A1). By adding a variable expression to A2 and A3 in the script editor panel, bones A2 and A3 rotate according to the range of the expression, which is the attribute of rotation difference attenuation.
[0132] The second part of the skeleton includes the first and second bones, see [link to relevant documentation]. Figure 11 Create two bones, B2 and B3, with a parent-child relationship for the second part, and set a reference virtual body B1 on the second part. One end of the first bone B3 is connected to the second bone B3, and the other end of the second bone B1 is fixed.
[0133] A gaze constraint is set for reference virtual body B1 and second bone B3 to align the second bone B3 constraint with reference virtual body B1. A position constraint is set for reference virtual body B1 and first bone B2 to align the first bone B2 constraint with reference virtual body B1. Since the first bone B2 is the parent bone of the second bone B3, a basic muscle controller that relies on the positional changes of reference virtual body B1 to form deformation constraint changes can be obtained. The second bone B3 is used to participate in the skinning weight of the second part mesh. Reference virtual body B1 is associated with bone A1 of the first part. Reference virtual body B1 is the intermediate medium between bone A1 of the first part and the second bone B3. The target constraint of the second bone B3 is aligned with the reference virtual body B1, that is, the second bone B3 obtains the same as the reference virtual body B1. The point coordinate channel attribute (i.e., the displacement of the second bone B3 is consistent with the displacement of the reference virtual body B1) is used. The reference virtual body B1 acts as an intermediary between the bones of the first part and the second bone B3. When the bone A1 of the first part moves, it will drive the reference virtual body B1 to move, affecting the position coordinates of the reference virtual body B1 and causing the position of the reference virtual body B1 to change. The reference virtual body B1 also affects the second bone B3, thus ultimately forming the first bone A1 constraining the reference virtual body B1, and the reference virtual body B1 affecting the second bone B3. The second bone B3 is a bone that participates in the mesh of the second part, that is, the first bone A1 can affect the mesh of the second part, and the length of the second bone B3 changes, thereby simulating the effect of muscle contraction and stretching.
[0134] S504, Set skinning weights for the first and second parts.
[0135] The skin weight of the first part indicates the degree of influence of the bones of the first part on the skin of the first part, and the skin weight of the second part is used to indicate the degree of influence of the bones of the second part on the skin of the second part. The skin can be understood as the model mesh.
[0136] In some embodiments, the skin modifier can be used in edit mode, specifically in the mesh vertex edit mode, to select individual mesh vertices and use the Weight Tool or other tools to set skin weights for each mesh vertex.
[0137] In some embodiments, skin weights are set for the first part and the second part respectively according to a preset skin weight attenuation attribute.
[0138] The skin weight decay attribute indicates that the closer a model mesh is to the skeleton, the greater the influence of the skeleton, and the greater the skin weight. Conversely, the farther a model mesh is from the skeleton, the less the influence of the skeleton, and the smaller the skin weight. In other words, the skin weight of the mesh decays according to distance; the farther the distance, the smaller the skin weight, thus achieving a linear reduction effect. This results in a natural deformation effect of the model in animation. Specifically, the decay rate and range of the skin weight can be adjusted according to the position of the skeleton, the size of the character model, and the requirements of the deformation effect.
[0139] The closer a mesh is to the skeleton, the greater its skin weight; the farther away a mesh is from the skeleton, the smaller its skin weight. When setting skin weights, color intensity can be used to help developers understand the set skin weights. For example, meshes closer to the skeleton are red, while meshes farther away from the skeleton transition from orange to gray.
[0140] It's worth noting that the skeleton system for the first part includes: the base skeleton (biped LUpperArm) and the created preset type skeleton (Bone skeleton). Skinning weights can be set on the base skeleton and the preset type skeleton. By setting the skinning weights, the base skeleton can control the color portion of the mesh in the first part; red represents a skinning weight of 1, and yellow represents a skinning weight of 0.5. Similarly, the skeleton system for the second part includes: the base skeleton (one bipedSpine2) and the created preset type skeleton (Bone skeleton). Skinning weights can also be set on the base skeleton and the preset type skeleton. For the model mesh surrounding the base skeleton area of the second part, the skinning weight ranges from 1-0.5-0.1-0, spreading outwards from the center. Here, 1 (red) indicates the skeleton completely controls the model mesh, 0.5 (yellow) indicates the skeleton controls half the model mesh, 0.1 (blue) indicates the skeleton controls a small portion of the model mesh, and 0 (no color) indicates the model mesh is not controlled by the skeleton. By setting the skinning weights for the basic bones of the first and second parts, a regular skinning file can be obtained.
[0141] Then, skinning weights are set for the preset type of bone (B_RUpperArmTwist01) created for the first part. Starting from the center of the bone, orange indicates a skinning weight of 0.75, and the weight spreads outwards, gradually decreasing to blue (0.01) and colorless (0). Skinning weights are set for B_RUpperArmTwist02. Starting from the center of the bone, orange indicates a skinning weight of 0.6, and the weight spreads outwards, gradually decreasing to blue (0.01) and colorless (0). Skinning weights are set for B_RUpperArmTwist03. Starting from the center of the bone, orange indicates a skinning weight of 0.8, and the weight spreads outwards, gradually decreasing to blue (0.01) and colorless (0). Blue indicates a skinning weight of 0.01, and colorless indicates a skinning weight of 0.
[0142] The purpose of linking reference virtual bodies Dummy001 and Dummy002 to the bones of the first part is to enable the reference virtual bodies Dummy001 and Dummy002 to move when the bones of the first part move. The movement of reference virtual bodies Dummy001 and Dummy002 will affect the stretching and deformation of biped Spine2_2 and biped Spine2_3, thereby achieving the stretching and deformation effect of the second part.
[0143] Set skinning weights for the pre-defined bones (biped Spine2_2, biped Spine2_3) created for the second part. Starting from the center of the bone, orange indicates a skinning weight of 0.25, and the weight spreads outwards, gradually decreasing to blue (0.01) and then to no weight (0). The second part includes the pectoralis major and latissimus dorsi muscles.
[0144] Taking B_RUpperArmTwist01 as an example, starting from the center of the B_RUpperArmTwist01 bone, the color transitions from orange to blue to colorless. Orange indicates a skinning weight of 0.75, blue indicates a skinning weight of 0.01, and colorless indicates a skinning weight of 0.
[0145] In some embodiments, in response to a motion trigger event of the first part of the virtual character, the base bones of the first part and the base bones of the second part can be controlled to move, so as to drive the skin of the first part to move according to the skin weight of the base bone of the first part, and drive the skin of the second part to move according to the skin weight of the base bone of the second part, thereby realizing that the skin moves under the joint action of the base bones and the bone, making the muscle simulation effect more realistic.
[0146] It is worth noting that by running 3D modeling software on the developer's electronic device, the above steps S501-S504 can be performed to obtain the target character model, and skeletal motion constraints and skinning weights can be set for the first and second parts of the target character model, and game art resources can be integrated to generate a game software package.
[0147] In an alternative implementation, the method may further include:
[0148] Animation tests are performed on the first and second parts of the target character model to obtain test results. If the test results indicate that at least one of the first and second parts does not meet the preset requirements, the skeletal motion constraints of at least one part and / or the skinning weights of at least one part are adjusted.
[0149] After setting the skinning weights of the first and second parts, animation tests can be performed on the first and second parts of the target character model. For example, the animation test can include controlling the first part to rise and obtaining test results. If the test results indicate that at least one of the first and second parts does not meet the preset requirements, that is, when the first part is raised, it is determined whether the animation effect of the first part and the animation effect of the second part achieve the expected effect.
[0150] If at least one of the first and second parts does not meet the preset requirements, the skeletal motion constraints and / or skinning weights of at least one part are adjusted, and the animation test is repeated until both the first and second parts meet the preset requirements. The target character model that meets the preset requirements is then saved, and the game art resources are integrated to generate a game software package.
[0151] It is worth noting that achieving the expected results indicates that the character model and the skeletal system are correctly bound together, while failing to achieve the expected results indicates that the character model and the skeletal system may not be correctly bound together. In such cases, the skeletal system and the character model can be rebound.
[0152] If both the first and second parts meet the preset requirements, the target character model is saved directly, and game art resources are integrated to produce a game software package.
[0153] In the motion control method for virtual characters in the game in this embodiment, the muscle linkage effect automatically matches the value according to the amplitude of the movement, without the need to manually add skeletal animation, saving a lot of time in setting up the action. The binding of bones and skinning effects can be output to the game engine, reducing performance pressure, and there are no special requirements for the data sampling of resource output.
[0154] Figure 16 This is a comparison image of the upper arm and pectoralis major muscles provided in the embodiments of this application. Figure 17 The comparison diagram of the upper arm and latissimus dorsi muscles provided in the embodiments of this application is as follows: Figure 16 , 17 As shown, under large-amplitude movements (such as raising the character's arms to an angle greater than 200 degrees horizontally), conventional skinning weights will result in an unnatural skinning effect on the arms, with the model appearing stiff, jagged, and distorted, manifested as irregular wirework patterns in the model's mesh. However, by applying the skinning weights of this solution, a natural skinning effect on the arms will be observed. When the arms are raised, muscle binding based on skeletal motion constraints to achieve muscle linkage results in regular wirework patterns in the model's mesh.
[0155] In other words, muscle skinning without this solution is stiff and the muscle effect is poor under extreme movements, while muscle skinning with the constraints of this solution is reasonable and the muscle effect is better under extreme movements. When creating animation sequences, the skeletal movement of the arm affects the muscle movement models of the pectoralis major and latissimus dorsi muscles, as well as the natural twisting model of the arm. This improves animation production efficiency while significantly enhancing the natural and realistic binding quality and animation quality of the character skinning effect. It avoids the high cost, long cycle, and high difficulty of creating human muscle effects in traditional CG animation production processes, saving development costs for muscle simulation of character model meshes in game development, and is more convenient and efficient.
[0156] Based on the same inventive concept, this application also provides a motion control device for virtual characters in a game, corresponding to the motion control method for virtual characters in the game. Since the principle of the device in this application is similar to the motion control method for virtual characters in the game described above in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0157] Figure 18 This is a schematic diagram of the structure of a motion control device for virtual characters in a game, provided in an embodiment of this application. This device can be integrated into an electronic device. Figure 18 As shown, the device may include:
[0158] Module 601 is used to acquire the target character model of the virtual character in the game.
[0159] The acquisition module 601 is also used to acquire the inter-bone motion constraints and skinning weights of the first part in response to the motion triggering event of the first part of the virtual character model.
[0160] The control module 602 is used to control the movement of the bones of the first part in the target character model according to the motion constraints between the bones of the first part, and to drive the skin of the first part in the target character model to move according to the skin weight of the first part.
[0161] In an optional implementation, the control module 602 is further configured to:
[0162] Control the bones of the first part to drive the movement of the reference virtual body of the second part in the target character model that is associated with the bones of the first part;
[0163] The acquisition module 601 is also used to acquire the reference virtual body of the second part and the skeletal motion constraints of the second part in the target character model, as well as the skinning weights of the second part.
[0164] The control module 602 is also used to control the reference virtual body to move the bones of the second part of the target character model according to the skeletal motion constraints, and to move the skin of the second part of the target character model according to the skin weight of the second part.
[0165] In an optional implementation, the skeletal motion constraints include: positional constraints of the first bone in the reference virtual body and the second part; the skinning weights of the second part include: skinning weights of the second bone in the second part associated with the first bone; the control module 602 is specifically used for:
[0166] Based on positional constraints, the control reference virtual body drives the first bone in the second part to move, and drives the second bone in the second part to extend and retract.
[0167] Based on the skinning weights of the second bone, control the second bone to cause the skinning of the second part of the target character model to stretch and contract.
[0168] In an optional implementation, the skeletal motion constraints further include: gaze constraints for a reference virtual body and a second skeleton; the control module 602 is specifically used for:
[0169] Based on the gaze constraint, control the reference virtual body to drive the second skeleton to rotate.
[0170] Based on the skinning weights of the second bone, control the second bone to drive the skinning of the second part of the target character model to rotate.
[0171] In an optional embodiment, the device further includes:
[0172] Processing module 603 is used to create the skeletal system and character model of the virtual character;
[0173] The processing module 603 is also used to bind the bones of each part of the skeletal system to the corresponding parts in the character model to generate the target character model;
[0174] Processing module 603 is also used to set skeletal motion constraints for the first and second parts of the target character model;
[0175] The processing module 603 is also used to set skin weights for the first part and the second part.
[0176] In an optional implementation, the processing module 603 is specifically used for:
[0177] Create the basic skeletal system and character model for virtual characters;
[0178] Create bones of a preset type and add them to the bones of the first and second parts of the base bone system to generate the bone system.
[0179] In an optional implementation, the processing module 603 is specifically used for:
[0180] Based on the inter-bone attenuation motion information of the first part, set inter-bone motion constraints for the first part;
[0181] Set skeletal motion constraints for the reference virtual body and the second part of the skeleton.
[0182] In an optional implementation, the processing module 603 is specifically used for:
[0183] Based on the preset skin weight attenuation attribute, skin weights are set for the first and second parts respectively.
[0184] In an optional embodiment, the device further includes:
[0185] Test module 604 is used to perform animation tests on the first and second parts of the target character model and obtain test results.
[0186] The processing module 603 is further configured to adjust the skeletal motion constraints of at least one part and / or the skin weight of at least one part if the test result indicates that at least one part of the first part and the second part does not meet the preset requirements.
[0187] In the motion control device for virtual characters in this embodiment, the acquisition module is used to acquire the target character model of the virtual character in the game. The acquisition module is also used to acquire the inter-bone motion constraints and skin weights of the first part of the target character model in response to a motion trigger event of the first part of the virtual character. The control module is used to control the movement of the bones of the first part of the target character model according to the inter-bone motion constraints, and to drive the skin of the first part of the target character model to move according to the skin weights. By controlling the movement of the skin of the first part through inter-bone motion constraints and skin weights, muscle twisting and deformation are achieved, forming a muscle-skin linkage effect. This is suitable for game engines, eliminates the need for complex dynamic rendering, reduces performance pressure, and has a short production cycle and low cost.
[0188] Figure 19 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 19As shown, the device may include a processor 701, a memory 702, and a bus 703. The memory 702 stores machine-readable instructions executable by the processor 701. When the electronic device is running, the processor 701 communicates with the memory 702 via the bus 703. The processor 701 executes the machine-readable instructions to perform the following steps:
[0189] Obtain the target character model of the virtual character in the game;
[0190] In response to the motion trigger event of the first part of the virtual character, obtain the inter-bone motion constraints and skinning weights of the first part in the target character model;
[0191] Based on the motion constraints between the bones of the first part, the movement of the bones of the first part in the target character model is controlled, and based on the skin weight of the first part, the skin of the first part in the target character model is driven to move.
[0192] In an optional implementation, the method further includes:
[0193] Control the bones of the first part to drive the movement of the reference virtual body of the second part in the target character model that is associated with the bones of the first part;
[0194] Obtain the reference virtual body for the second part and the skeletal motion constraints of the second part in the target character model, as well as the skinning weights of the second part;
[0195] Based on skeletal motion constraints, the reference virtual body is controlled to move the bones of the second part of the target character model, and based on the skinning weight of the second part, the skinning of the second part of the target character model is moved.
[0196] In an optional implementation, the skeletal motion constraints include: positional constraints of the first bone in the reference virtual body and the second part; the skinning weights of the second part include: skinning weights of the second bone associated with the first bone in the second part; according to the skeletal motion constraints, controlling the reference virtual body to move the bones of the second part in the target character model, and according to the skinning weights of the second part, moving the skin of the second part in the target character model, including:
[0197] Based on positional constraints, the control reference virtual body drives the first bone in the second part to move, and drives the second bone in the second part to extend and retract.
[0198] Based on the skinning weights of the second bone, control the second bone to cause the skinning of the second part of the target character model to stretch and contract.
[0199] In an optional implementation, the skeletal motion constraints further include: gaze constraints of a reference virtual body and a second bone; controlling the reference virtual body to move the bones of the second part in the target character model according to the skeletal motion constraints, and moving the skin of the second part in the target character model according to the skinning weight of the second part, further including:
[0200] Based on the gaze constraint, control the reference virtual body to drive the second skeleton to rotate.
[0201] Based on the skinning weights of the second bone, control the second bone to drive the skinning of the second part of the target character model to rotate.
[0202] In an optional implementation, before obtaining the target character model of the virtual character in the game, the method further includes:
[0203] Create the skeletal system and character model for the virtual character;
[0204] Bind the bones of each part of the skeletal system to the corresponding parts in the character model to generate the target character model;
[0205] Set skeletal motion constraints for the first and second parts of the target character model;
[0206] Set skinning weights for the first and second parts.
[0207] In one alternative implementation, creating the skeletal system and character model of the virtual character includes:
[0208] Create the basic skeletal system and character model for virtual characters;
[0209] Create bones of a preset type and add them to the bones of the first and second parts of the base bone system to generate the bone system.
[0210] In an optional implementation, skeletal motion constraints are set for a first part and a second part of the target character model, including:
[0211] Based on the inter-bone attenuation motion information of the first part, set inter-bone motion constraints for the first part;
[0212] Set skeletal motion constraints for the reference virtual body and the second part of the skeleton.
[0213] In an optional implementation, skinning weights are set for the first and second parts, including:
[0214] Based on the preset skin weight attenuation attribute, skin weights are set for the first and second parts respectively.
[0215] In an optional implementation, the method further includes:
[0216] Animation tests were performed on the first and second parts of the target character model to obtain the test results.
[0217] If the test results indicate that at least one of the first and second parts does not meet the preset requirements, then adjust the skeletal motion constraints of at least one part and / or the skin weight of at least one part.
[0218] In the electronic device of this embodiment, the processor executes machine-readable instructions to acquire a target character model of a virtual character in a game. In response to a motion trigger event of a first part of the virtual character, it acquires the inter-bone motion constraints and skin weights of the first part of the target character model. Based on the inter-bone motion constraints, it controls the movement of the bones in the first part of the target character model, and based on the skin weights, it drives the movement of the skin of the first part of the target character model. This application controls the movement of the skin of the first part through inter-bone motion constraints and skin weights, achieving muscle twisting and deformation, forming a muscle-skin linkage effect. This is suitable for game engines, eliminates the need for complex dynamic rendering, reduces performance pressure, and has a short production cycle and low cost.
[0219] This application embodiment also provides a computer-readable storage medium storing a computer program, which is executed by a processor, and the processor performs the following steps:
[0220] Obtain the target character model of the virtual character in the game;
[0221] In response to the motion trigger event of the first part of the virtual character, obtain the inter-bone motion constraints and skinning weights of the first part in the target character model;
[0222] Based on the motion constraints between the bones of the first part, the movement of the bones of the first part in the target character model is controlled, and based on the skin weight of the first part, the skin of the first part in the target character model is driven to move.
[0223] In an optional implementation, the method further includes:
[0224] Control the bones of the first part to drive the movement of the reference virtual body of the second part in the target character model that is associated with the bones of the first part;
[0225] Obtain the reference virtual body for the second part and the skeletal motion constraints of the second part in the target character model, as well as the skinning weights of the second part;
[0226] Based on skeletal motion constraints, the reference virtual body is controlled to move the bones of the second part of the target character model, and based on the skinning weight of the second part, the skinning of the second part of the target character model is moved.
[0227] In an optional implementation, the skeletal motion constraints include: positional constraints of the first bone in the reference virtual body and the second part; the skinning weights of the second part include: skinning weights of the second bone associated with the first bone in the second part; according to the skeletal motion constraints, controlling the reference virtual body to move the bones of the second part in the target character model, and according to the skinning weights of the second part, moving the skin of the second part in the target character model, including:
[0228] Based on positional constraints, the control reference virtual body drives the first bone in the second part to move, and drives the second bone in the second part to extend and retract.
[0229] Based on the skinning weights of the second bone, control the second bone to cause the skinning of the second part of the target character model to stretch and contract.
[0230] In an optional implementation, the skeletal motion constraints further include: gaze constraints of a reference virtual body and a second bone; controlling the reference virtual body to move the bones of the second part in the target character model according to the skeletal motion constraints, and moving the skin of the second part in the target character model according to the skinning weight of the second part, further including:
[0231] Based on the gaze constraint, control the reference virtual body to drive the second skeleton to rotate.
[0232] Based on the skinning weights of the second bone, control the second bone to drive the skinning of the second part of the target character model to rotate.
[0233] In an optional implementation, before obtaining the target character model of the virtual character in the game, the method further includes:
[0234] Create the skeletal system and character model for the virtual character;
[0235] Bind the bones of each part of the skeletal system to the corresponding parts in the character model to generate the target character model;
[0236] Set skeletal motion constraints for the first and second parts of the target character model;
[0237] Set skinning weights for the first and second parts.
[0238] In one alternative implementation, creating the skeletal system and character model of the virtual character includes:
[0239] Create the basic skeletal system and character model for virtual characters;
[0240] Create bones of a preset type and add them to the bones of the first and second parts of the base bone system to generate the bone system.
[0241] In an optional implementation, skeletal motion constraints are set for a first part and a second part of the target character model, including:
[0242] Based on the inter-bone attenuation motion information of the first part, set inter-bone motion constraints for the first part;
[0243] Set skeletal motion constraints for the reference virtual body and the second part of the skeleton.
[0244] In an optional implementation, skinning weights are set for the first and second parts, including:
[0245] Based on the preset skin weight attenuation attribute, skin weights are set for the first and second parts respectively.
[0246] In an optional implementation, the method further includes:
[0247] Animation tests were performed on the first and second parts of the target character model to obtain the test results.
[0248] If the test results indicate that at least one of the first and second parts does not meet the preset requirements, then adjust the skeletal motion constraints of at least one part and / or the skin weight of at least one part.
[0249] In the computer-readable storage medium of this embodiment, the processor executes machine-readable instructions to acquire a target character model of a virtual character in a game. In response to a motion trigger event of a first part of the virtual character, it acquires the inter-bone motion constraints and skin weights of the first part of the target character model. Based on the inter-bone motion constraints, it controls the movement of the bones in the first part of the target character model, and based on the skin weights, it drives the movement of the skin of the first part of the target character model. This application controls the movement of the skin of the first part through inter-bone motion constraints and skin weights, achieving muscle twisting and deformation, forming a muscle-skin linkage effect. It is suitable for game engines, eliminates the need for complex dynamic rendering, reduces performance pressure, and has a short production cycle and low cost.
[0250] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.
[0251] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0252] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0253] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0254] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0255] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0256] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A method for controlling the motion of a virtual character in a game, characterized in that, include: Obtain the target character model of the virtual character in the game; In response to a motion trigger event of the first part of the virtual character, the motion constraints between bones of the first part and the skinning weights of the first part in the target character model are obtained. Based on the motion constraints between the bones of the first part, the bones of the first part in the target character model are controlled to move, and based on the skin weight of the first part, the skin of the first part in the target character model is driven to move.
2. The method according to claim 1, characterized in that, The method further includes: Controlling the bones of the first part to drive the movement of the reference virtual body of the second part in the target character model that is associated with the bones of the first part; Obtain the reference virtual body of the second part and the skeletal motion constraints of the second part in the target character model, as well as the skinning weights of the second part; Based on the skeletal motion constraints, the reference virtual body is controlled to move the bones of the second part in the target character model, and based on the skinning weight of the second part, the skinning of the second part in the target character model is moved.
3. The method according to claim 2, characterized in that, The skeletal motion constraints include: positional constraints of the reference virtual body and the first bone in the second part; the skinning weights of the second part include: the skinning weights of the second bone in the second part associated with the first bone; the step of controlling the reference virtual body to move the bones of the second part in the target character model according to the skeletal motion constraints, and moving the skin of the second part in the target character model according to the skinning weights of the second part, includes: Based on the position constraints, the reference virtual body is controlled to move the first bone in the second part and to extend and retract the second bone in the second part. Based on the skinning weight of the second bone, the second bone is controlled to cause the skinning of the second part of the target character model to stretch and contract.
4. The method according to claim 3, characterized in that, The skeletal motion constraints further include: gaze constraints between the reference virtual body and the second bone; the step of controlling the reference virtual body to move the bones of the second part in the target character model according to the skeletal motion constraints, and moving the skin of the second part in the target character model according to the skinning weight of the second part, further includes: Based on the gaze constraint, the reference virtual body is controlled to drive the second skeleton to rotate. Based on the skinning weight of the second bone, the second bone is controlled to rotate the skinning of the second part of the target character model.
5. The method according to claim 2, characterized in that, Before obtaining the target character model of the virtual character in the game, the method further includes: Create the skeletal system and character model of the virtual character; The bones of each part of the skeletal system are bound to the corresponding parts of the character model to generate the target character model; Set skeletal motion constraints for the first and second parts of the target character model; Set skin weights for the first and second parts.
6. The method according to claim 5, characterized in that, The skeletal system and character model used to create the virtual character include: Create the basic skeletal system and character model of the virtual character; Create bones of a preset type and add them to the bones of the first part and the bones of the second part in the basic bone system to generate the bone system.
7. The method according to claim 5, characterized in that, The step of setting skeletal motion constraints for the first and second parts of the target character model includes: Based on the inter-bone attenuation motion information of the first part, inter-bone motion constraints are set for the first part; Set skeletal motion constraints for the reference virtual body and the skeleton of the second part.
8. The method according to claim 5, characterized in that, The step of setting skin weights for the first and second parts includes: Based on the preset skin weight attenuation attribute, skin weights are set for the first part and the second part respectively.
9. The method according to any one of claims 5-8, characterized in that, The method further includes: Animation tests were performed on the first and second parts of the target character model to obtain test results. If the test results indicate that at least one of the first and second parts does not meet the preset requirements, then the skeletal motion constraints and / or the skin weights of the at least one part are adjusted.
10. A motion control device for a virtual character in a game, characterized in that, include: The acquisition module is used to acquire the target character model of the virtual character in the game; The acquisition module is further configured to, in response to the motion triggering event of the first part of the virtual character, acquire the inter-bone motion constraints and the skinning weights of the first part in the target character model. The control module is used to control the movement of the bones of the first part in the target character model according to the motion constraints between the bones of the first part, and to drive the skin of the first part in the target character model to move according to the skin weight of the first part.
11. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the motion control method for a virtual character in a game as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the motion control method for virtual characters in a game as described in any one of claims 1 to 9.