Physical animation generation method and device
By introducing object and wind channel identifiers into Unreal Engine, wind calculation was optimized, solving the problem of excessive wind fluctuation in Unreal Engine. This enabled object-level wind specification, improving the realism and aesthetics of physical animations and enhancing the user experience.
Patent Information
- Application Number
- CN202410940418.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-08
AI Technical Summary
The wind calculation module in Unreal Engine has an issue of excessive jitter, which causes physical animation to be distorted, resulting in a poor user experience. It also makes it impossible to specify wind force at the object level, affecting the realism and aesthetics of the animation.
By introducing object channel identifiers and wind channel identifiers, the wind channel associated with the target object is determined, and the target wind force is calculated based on the wind channel attributes. This generates an object-level physical animation, and a dynamic skeletal system is used to optimize the wind force calculation, including handling the different wind force effects on hair and accessories.
It improves the realism and aesthetics of physical animation, enhances the user's viewing experience, allows hair to swing randomly in different directions, and makes accessories move in a regular pendulum motion on the same plane, reduces shaking, and enhances the natural smoothness of the animation.
Smart Images

Figure CN118918226A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a physical animation generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] In Unreal Engine, the object-based dynamic skeleton system can generate physical animations. For example, the character's hair and accessories sway in the wind, and the vegetation is blown by the wind. Whether the physical animation is natural and smooth will directly affect the user's viewing experience.
[0003] However, the wind calculation module of Unreal Engine has the problem of excessive jitter, which causes the generated physical animation to be distorted and the user's viewing experience to be poor.
[0004] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention
[0005] Embodiments of the present application provide a physical animation generation method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.
[0006] One aspect of an embodiment of the present application provides a method for generating a physical animation, the method comprising:
[0007] Acquire an object channel identifier of a target object, where the object channel identifier is used to indicate a wind channel associated with the target object;
[0008] Determining a target wind force corresponding to the wind force channel according to the object channel identifier;
[0009] A physical animation of the target object is generated according to the target wind force.
[0010] Optionally, determining a target wind force corresponding to the wind force channel according to the object channel identifier includes:
[0011] Determining the wind channel according to the object channel identifier;
[0012] In the case where there is only one wind channel: determining the wind force corresponding to the wind channel as the target wind force;
[0013] In the case where there are multiple wind channels: obtain the wind force corresponding to each of the wind channels; determine the wind resultant force according to the properties of the wind force corresponding to each of the wind channels; and determine the wind resultant force as the target wind force.
[0014] Optionally, the attributes include direction and size.
[0015] Optionally, the target object is a decoration, and the target wind force includes a first periodic function wind force, and the first periodic function wind force includes a plurality of wave crests and wave troughs of the same size.
[0016] Optionally, the target object is hair, and the target wind force includes a second periodic function wind force, and the second periodic function wind force includes a plurality of wave crests and wave troughs of different sizes.
[0017] Optionally, the target object is hair, and the hair includes a plurality of bone groups, and the bone groups are used to control bones of a plurality of adjacent hairs.
[0018] Optionally, generating a physical animation of the target object according to the target wind force includes:
[0019] Get the wind direction influence coefficient corresponding to each bone group;
[0020] According to the wind direction influence coefficient corresponding to each bone group and the target wind force, a physical animation corresponding to each bone group is generated.
[0021] Optionally, the wind direction influence coefficient includes one or more of a lateral influence coefficient, a longitudinal influence coefficient and a height influence coefficient; wherein;
[0022] The lateral influence coefficient is used to constrain the component of the target wind force in the horizontal direction of the screen, so as to control the swing amplitude of each skeleton group in the horizontal direction of the screen;
[0023] The longitudinal influence coefficient is used to constrain the component of the target wind force in the vertical direction of the screen, so as to control the swing amplitude of each skeleton group in the vertical direction of the screen;
[0024] The height influence coefficient is used to constrain the component of the target wind force in the screen height direction to control the swing amplitude of each skeleton group in the screen height direction.
[0025] Optionally, the physical animation generation method further includes:
[0026] Match the physical animation of each bone group with the corresponding preset motion range;
[0027] In case of a matching failure, obtaining a wind force influence coefficient of the skeleton group, wherein the wind force influence coefficient is used to adjust the magnitude of the target wind force;
[0028] The physical animation of the skeleton group is updated according to the wind force influence coefficient, the wind direction influence coefficient and the target wind force of the skeleton group.
[0029] Another aspect of an embodiment of the present application provides a physical animation generating device, the device comprising:
[0030] An acquisition module, used for acquiring an object channel identifier of a target object, wherein the object channel identifier is used for indicating a wind channel associated with the target object;
[0031] A determination module, configured to determine a target wind force corresponding to the wind force channel according to the object channel identifier;
[0032] A generating module is used to generate a physical animation of the target object according to the target wind force.
[0033] Another aspect of an embodiment of the present application provides a computer device, including:
[0034] at least one processor; and
[0035] a memory communicatively coupled to the at least one processor;
[0036] Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0037] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.
[0038] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.
[0039] The above technical solution adopted in the embodiment of the present application may have the following advantages:
[0040] Objects are associated with object channel identifiers, which can be used to determine the wind channels related to the object, that is, which wind channels affect the object, and then determine the wind force applied to the object. By adding the wind force to the dynamic skeleton calculation process, the corresponding physical animation can be generated. It can be seen that the embodiment of the present application can specify the wind force at the object level instead of applying the same wind force as a whole. In this way, different objects (such as character hair and accessories) can be affected by wind forces in different states to generate different physical animations, thereby improving the authenticity and aesthetics of the physical animation and effectively enhancing the user's viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same figure identifiers refer to similar but not necessarily identical elements.
[0042] Figure 1 The flowchart of the physical animation generation method according to the first embodiment of the present application is schematically shown;
[0043] Figure 2 Schematically shows Figure 1 Flow chart of sub-steps of step S102;
[0044] Figure 3 The first periodic function wind force according to the first embodiment of the present application is schematically shown;
[0045] Figure 4 The second periodic function wind force according to the first embodiment of the present application is schematically shown;
[0046] Figure 5 The following schematically shows the dynamic skeleton calculation process according to the first embodiment of the present application;
[0047] Figure 6 Schematically shows Figure 1 Flow chart of sub-steps of step S104;
[0048] Figure 7 Schematically showing multiple bone groups of hair according to the first embodiment of the present application;
[0049] Figure 8 A newly added flow chart of the physical animation generation method according to the first embodiment of the present application is schematically shown;
[0050] Fig. 9 A block diagram schematically shows a physical animation generating device according to the second embodiment of the present application; and Fig.10 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0052] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0053] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.
[0054] First, the following terms are explained:
[0055] Unreal Engine: Software used to create real-time 3D graphics content that can be used for video games, virtual reality, etc. Unreal Engine can include rendering engines, physics simulations, animation systems, artificial intelligence, audio systems, etc.
[0056] Skeleton system: A technology and framework for simulating character or object animation. It is based on the concept of skeletal animation. It defines a skeletal structure in the character model and binds the model's mesh or skin to these bones to achieve dynamic transformation and deformation of the model. The skeletal system includes the following components: (1) Skeleton Structure: A hierarchical structure consisting of a series of interconnected bones (or joints). Each bone can be transformed by rotation, translation, and scaling, and can affect the shape and posture of the model associated with it. (2) Animation Data: Used to describe the changes of bones over time, that is, animation frames. Animation data can include transformation information such as rotation and translation of bones, as well as interpolation methods between key frames to achieve smooth animation transition effects. (3) Skin Binding: The process of binding the mesh or skin of a character model to the skeletal structure. Through skin binding, the vertices of the model can be deformed according to the transformation of the bones, thereby achieving the animation effect of the character. (4) Skeleton Animation System: A system responsible for managing and playing skeletal animation. It can include animation playback control, animation state machine, blend animation, crossfade and transition functions to achieve complex character animation effects. It can be seen that the skeletal system can be applied to game development to help developers create vivid and smooth character animations, adding more visual appeal and interactivity to the game.
[0057] Dynamic skeleton: A character animation technology that allows the character's bone structure to be dynamically generated and adjusted at runtime, thereby achieving more natural and flexible character animation effects. This technology can be applied to real-time character animation, such as character movements in games, physical simulations, etc. The key features of dynamic skeleton technology include: (1) Real-time generation and adjustment of bone structure: Unlike pre-defined bone structures, dynamic skeleton technology allows the character's bone structure to be dynamically generated and adjusted at runtime. That is, the number of bones, hierarchy, and connection relationships of the character can be modified in real time as needed, thereby achieving more flexible and diverse animation effects. (2) Physical simulation: Dynamic skeleton technology can be used in conjunction with physical simulation to simulate the natural movements and interactive effects of the character. By integrating the bone structure with the physics engine, the character can produce realistic dynamic effects based on external forces, such as collision, gravity, inertia, etc. (3) Soft body animation: Dynamic skeleton technology can also be used to achieve soft body animation effects, that is, the character's body parts can be deformed and moved freely like soft bodies. This technology can be used to simulate the soft tissues of the character, such as muscles and skin, making the character animation more realistic and vivid. (4) Motion capture: Dynamic skeleton technology can be used in conjunction with motion capture technology to obtain motion data in the real world and apply it to character animation. By using sensors, cameras and other devices to collect the character's motion data and then applying it to the dynamically generated bone structure, a more realistic and accurate character animation effect can be achieved. It can be seen that dynamic skeleton technology has a wide range of applications in game development, virtual reality, film and television production and other fields. It provides richer and more flexible possibilities for the creation and performance of character animation.
[0058] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below:
[0059] In Unreal Engine, the object-based dynamic skeleton system can generate physical animations. For example, the character's hair and accessories sway in the wind, and the vegetation is blown by the wind. Whether the physical animation is natural and smooth will directly affect the user's viewing experience.
[0060] However, the applicant has learned that: (1) the wind force calculation module of the Unreal Engine has a problem of excessive jitter, which causes the generated physical animation to be distorted and the user's viewing experience to be poor. (2) The wind force in the Unreal Engine is applied to the whole object, and it is impossible to specify the wind force separately at the object level, resulting in poor authenticity and aesthetics of the physical animation.
[0061] To this end, an embodiment of the present application provides a technical solution for generating physical animations. In this technical solution: (1) Wind channel identifiers and object channel identifiers are introduced to implement wind force specification at the object level. Different objects (such as character hair and accessories) can be affected by wind forces in different states to generate different physical animations, thereby improving the realism and aesthetics of the physical animations and effectively enhancing the user's viewing experience; (2) Hair can swing randomly in different directions around, and accessories (such as earrings and necklaces) can make relatively regular simple pendulum motions on the same plane, further improving the realism and aesthetics of the physical animations. See below for details.
[0062] The technical solutions of the present application are described below through multiple embodiments. It should be noted that these embodiments can be implemented in a variety of different forms and should not be construed as being limited to the embodiments described here.
[0063] Embodiment 1
[0064] Figure 1 The flowchart of the physical animation generation method according to the first embodiment of the present application is schematically shown.
[0065] like Figure 1 As shown, the physical animation generation method may include steps S100 to S104, wherein:
[0066] Step S100: acquiring an object channel identifier of a target object, wherein the object channel identifier is used to indicate a wind channel associated with the target object.
[0067] Step S102: determining a target wind force corresponding to the wind force channel according to the object channel identifier.
[0068] Step S104: generating a physical animation of the target object according to the target wind force.
[0069] In the physical animation generation method provided by the present embodiment, an object is associated with an object channel identifier, which can be used to determine the wind channel related to the object, that is, which wind channels affect the object, and then determine the wind force applied to the object. By adding the wind force to the dynamic skeleton calculation process, the corresponding physical animation can be generated. It can be seen that the embodiment of the present application can specify the wind force at the object level, rather than applying the same wind force as a whole. In this way, different objects (such as character hair and accessories) can be affected by wind forces in different states to generate different physical animations, thereby improving the authenticity and aesthetics of the physical animation and effectively enhancing the user's viewing experience.
[0070] The following combination Figure 1 , each step in steps S100 to S104 and other optional steps are described in detail.
[0071] Step S100, obtain an object channel identifier of a target object, where the object channel identifier is used to indicate a wind channel associated with the target object.
[0072] Target objects can include hair, accessories (such as earrings, necklaces, headdresses), clothing, liquids (such as water, magma), vegetation (grass, trees), etc. These target objects can be simulated and dynamically processed through the virtual engine to present realistic physical properties and interactive behaviors. Take the hair and accessories of virtual characters as an example. The hair is soft and slender, and is easily affected by external forces to produce complex random movements. For example, under the influence of wind, each hair may swing in different directions. Accessories are relatively hard, and the movement affected by external forces (such as wind) is relatively stable. For example, only a gentle single pendulum motion is required in the same plane. It can be seen that in order to better simulate the behavior of objects in the real world, different states of wind force need to be specified for different objects (such as objects, accessories).
[0073] Exemplarily, an object channel identifier can be specified for each of the various objects, and the object channel identifier of the same object is unique. It is also possible to set multiple wind channels, each corresponding to a specific wind force, and assign a wind channel identifier to each wind channel to distinguish wind forces of different attributes. In an optional embodiment, the attributes include wind direction and wind force size. There can be a mapping relationship between the object channel identifier and the wind channel identifier. By parsing the object channel identifier of the target object, the corresponding wind channel identifier can be found, and then it is determined which wind channels correspond to which wind force influences the target object. For example, the object channel identifier and the wind channel identifier can be represented in binary. Assuming that the object channel identifier of the target object A is 0001, the target object A is only affected by the wind corresponding to the 0001 wind channel. If the object channel identifier of the target object B is 1010, the target object B is simultaneously affected by the wind forces corresponding to the two wind channels 1000 and 0010. For another example, if the object channel identifier of target object C is 1111, then target object C is simultaneously affected by the wind forces corresponding to four wind channels: 1000, 0100, 0010, and 0001. It should be noted that the representation method and number of digits of the object channel identifier and the wind channel identifier can be adjusted according to actual needs.
[0074] In this embodiment, by configuring the object channel identifier and the wind force channel identifier, the wind force can be specified at the object level, and an object can be affected by wind forces of different attributes at the same time.
[0075] Step S102 , according to the object channel identifier, determine the target wind force corresponding to the wind channel.
[0076] As described above, based on the mapping relationship between the object channel identifier and the wind channel identifier, the wind channel associated with the target object can be quickly found and determined according to the object channel identifier of the target object. On this basis, the target wind force of the target object can be accurately determined. The target wind force may include the wind force acting on the target object. An exemplary solution is provided below.
[0077] In an optional embodiment, if Figure 2 As shown, step S102 may include:
[0078] Step S200: determining the wind channel according to the object channel identifier.
[0079] Step S202, when there is only one wind channel: determine the wind force corresponding to the wind channel as the target wind force.
[0080] Step S204, when there are multiple wind channels: obtain the wind force corresponding to each of the wind channels; determine the wind resultant force according to the attributes of the wind force corresponding to each of the wind channels; and determine the wind resultant force as the target wind force.
[0081] For example, the wind channel identifier can be obtained by parsing the object channel identifier of the target object, thereby determining the wind channel. When there is only one wind channel, the wind force corresponding to the wind channel can be directly determined as the target wind force. For example: if the object channel identifier is 0010, the target object is only affected by the wind force of the 0010 wind channel, and the wind force corresponding to the 0010 wind channel can be determined as the target wind force. In the case of multiple wind channels, the wind force of each wind channel is obtained, and the wind resultant force is calculated according to the properties of each wind force, and the wind resultant force is determined as the target wind force. For example: if the object channel identifier is 1010, the target object is affected by the wind forces of both the 1000 and 0010 wind channels. Obtain the 1000 wind force and the 0010 wind force, and calculate a wind resultant force according to the properties of the two wind forces (wind direction and wind force size), and use the wind resultant force as the target wind force, so that only one wind resultant force is finally involved in the dynamic skeleton calculation process.
[0082] In this embodiment, wind forces of different states acting on the same target object can be combined according to the properties of the wind force to simulate the total wind force acting on the target object, simplify the dynamic skeleton calculation process, optimize performance, and improve the generation efficiency of physical animation.
[0083] The above embodiment introduces determining the target wind force by the wind force corresponding to the wind channel. In practical applications, the wind force of each wind channel can be configured according to actual needs. For example, wind force level (0 to n levels, n>0), wind speed (breeze <1.5m / s, strong wind 10~20m / s), wind strength (N), wind pressure (Pa), etc. Some exemplary schemes are provided below.
[0084] In an optional embodiment, the target object may be an ornament, such as a headdress, a necklace, an earring, etc. The target wind force may include a first periodic function wind force, wherein the first periodic function wind force may include a plurality of wave crests and wave troughs of the same size. Figure 3 As shown, the period of the first periodic function wind force can be configured to be 5s, the peak can be configured to be 10N, and the trough is -10N, which is used to simulate the relatively regular pendulum motion wind force on the ornament, and then simulate the ornament doing the pendulum motion in the same plane. It should be noted that the size and period of the peak and trough can be dynamically adjusted according to demand.
[0085] In this embodiment, a periodic function wind force is specified for the ornament, and the periodic function wind force has multiple wave crests and wave troughs of the same size, which can more accurately simulate the movement of the ornament in the real world and optimize the physical animation effect.
[0086] In an optional embodiment, the target object may be hair, for example, hair of a virtual character, animal hair, etc. The target wind force may include a second periodic function wind force, wherein the second periodic function wind force may include a plurality of crests and troughs of different sizes. Figure 4 As shown, the period of the second periodic function wind can be configured to be 2s. Under this cycle, the hair swings with the wind more naturally and beautifully. It should be noted that the period size can be adjusted. In this embodiment, by configuring different values of peaks and troughs, the changing breeze can be simulated, further improving the authenticity and aesthetics of the physical animation.
[0087] As mentioned above, for different target objects, the wind direction and wind magnitude of the target wind force can be dynamically changed over time. In some embodiments, the target wind force can also be a wind force with a fixed wind direction and / or wind magnitude.
[0088] The above embodiment describes how to determine the target wind force acting on the target object. The target wind force can be used in the dynamic skeleton calculation process, that is, to calculate the specific motion position and trajectory (physical animation) of the target object. The application process will be described below as an example.
[0089] Step S104 , generating a physical animation of the target object according to the target wind force.
[0090] The target wind force can participate in the dynamic bone calculation process, and the physical animation of the target object can be generated after the dynamic bone calculation process. Figure 5 As shown, the dynamic skeleton calculation process is as follows:
[0091] S1, restore the local coordinates of all attached nodes to initialize the node link shape.
[0092] The dynamic skeleton system consists of a series of nodes, each of which represents a part of an object, such as a joint, bone, etc. At the beginning of each frame, the local coordinates of all nodes are restored to their positions and directions at the initial state to ensure the consistency of the initial state of each frame.
[0093] S2, wait for the animation and physics process to end.
[0094] Before starting to process the current frame, you need to wait until the previous animation and physics processes are completed, including waiting for the animation effects to finish playing and the physics simulation engine to calculate all physical effects.
[0095] S3, adds a unique key to all nodes.
[0096] Each node is assigned a unique identifier or ID so that each node can be accurately identified and operated in subsequent calculations and processing.
[0097] S4, calculate the update times and determine whether an update is required. If an update is required, execute S5.
[0098] By tracking the current update times and judging whether the node needs to be updated according to a preset update strategy (such as update time interval), that is, updating the physical animation.
[0099] S5, calculating the inertial motion process. According to the parameters such as the mass, velocity and acceleration of the object, the motion state of the object under the action of inertia is calculated, which may include the linear motion and angular momentum change of the object.
[0100] S6, calculate the force motion process. Calculate the influence of various external forces on the object, such as gravity, wind force, friction, etc.
[0101] S7, calculate the elastic motion process. If the object is elastic, such as a spring or rubber material, the deformation and rebound effect under force need to be calculated accordingly.
[0102] S8, calculate the rigid motion process. For an inelastic object, such as a hard bone, the displacement and rotation of the object need to be calculated based on the force conditions.
[0103] S9, calculate collision monitoring and recovery. For collisions between multiple objects, collision monitoring is required and responses are made according to the collision results, such as rebound, slide or stop.
[0104] S10, maintaining the distance length between nodes. In a dynamic skeletal system, there may be certain constraints between nodes, such as the length and position of bones, and it is necessary to ensure that these constraints are satisfied during the movement.
[0105] S11, determine whether frame chasing is required. Determine whether to add frames based on system requirements and performance to maintain the smoothness and continuity of the physical animation. If frame chasing is not required, execute S12.
[0106] S12, correcting the rotation of each node according to the calculation result. According to the motion state and constraint conditions calculated previously, adjust the position and direction of each node to ensure that the state of the object in the current frame is reasonable.
[0107] S13, synchronizing the node transformation to the subsidiary nodes. The calculated node position and direction are synchronously updated to all the subsidiary nodes to ensure the consistency of the entire skeletal system.
[0108] S14, the current frame ends. Generate the physical animation of the current frame and prepare for the calculation and update of the next frame.
[0109] The embodiment of the present application mainly achieves the purpose of optimizing physical animation by changing the wind force algorithm for calculating the force-bearing motion process in S6. A further exemplary introduction will be given below.
[0110] As mentioned above, the target wind force can be the wind force of one wind channel or the wind force of multiple wind channels. That is, the target object is affected by wind forces of the same direction and magnitude at the same time. Taking hair as an example, since all hair is affected by the same wind force, all hair will perform physical animations with the same movement direction and amplitude at the same time. This is inconsistent with the movement law of hair in the real world, and the authenticity and aesthetics of the physical animation are insufficient.
[0111] In order to alleviate the distortion problem of physical animation, the wind algorithm based on the dynamic skeleton system can be optimized. Several exemplary solutions are provided below.
[0112] In an optional embodiment, if Figure 6 As shown, step S104 may include:
[0113] Step S600, obtaining the wind direction influence coefficient corresponding to each skeleton group.
[0114] Step S602: Generate a physical animation corresponding to each skeleton group according to the wind direction influence coefficient corresponding to each skeleton group and the target wind force.
[0115] In the case where the target object is hair, such as Figure 7 As shown, the hair may include multiple bone groups, and each bone group may be used to control the bones of multiple adjacent hairs. A wind direction influence coefficient is configured for each bone group to adjust the direction of the target wind force acting on each bone group so that the hair controlled by different bone groups can swing in different directions, thereby simulating the random swing of the hair under the influence of wind force. In an optional embodiment, the wind direction influence coefficient may include one or more of a lateral influence coefficient, a longitudinal influence coefficient, and a height influence coefficient. Among them, the lateral influence coefficient may be used to constrain the component of the target wind force in the horizontal direction of the screen to control the swing amplitude of each bone group in the horizontal direction of the screen. The longitudinal influence coefficient may be used to constrain the component of the target wind force in the vertical direction of the screen to control the swing amplitude of each bone group in the vertical direction of the screen. The height influence coefficient may be used to constrain the component of the target wind force in the height direction of the screen to control the swing amplitude of each bone group in the height direction of the screen. The wind direction influence coefficient may also be configured according to the location of each bone group, the number of hair bones contained, etc., or may be configured randomly or pseudo-randomly. For example, an initial value (wind direction influence coefficient) is assigned to each bone group in a random number manner, and multiplied by the direction of the target wind force to affect the swing direction of the hair bones in the bone group. Preferably, the lateral influence coefficient can be any value in [-0.4, 1.0]. The longitudinal influence coefficient can be any value in [0, 1.0]. The height influence coefficient can be any value in [0, 1.0]. By using the wind direction influence coefficient within the above value range, the wind direction control of the target wind force is more reasonable, the hair movement is more natural, and the physical animation effect is effectively optimized.
[0116] In this embodiment, a wind direction influence coefficient is configured for each skeleton group, and a dynamic skeleton calculation process is executed, so that the hair can swing randomly in different directions around, further improving the realism and aesthetics of the physical animation.
[0117] In an optional embodiment, if Figure 8 As shown, the physical animation generation method may further include:
[0118] Step S800, matching the physical animation of each skeleton group with the corresponding preset motion range.
[0119] Step S802: in case of matching failure, obtain the wind force influence coefficient of the skeleton group, and the wind force influence coefficient is used to adjust the magnitude of the target wind force.
[0120] Step S804: updating the physical animation of the skeleton group according to the wind force influence coefficient, wind direction influence coefficient and the target wind force of the skeleton group.
[0121] The specific movement position and trajectory of the hair are calculated through the dynamic skeleton calculation process to generate the physical animation of each skeleton group. After the physical animation of each skeleton group is generated, it can also be adjusted according to actual needs. The movement amplitude of some hair (such as hair close to the hair) is too large, resulting in reduced aesthetics and inconsistent with the expected effect. In order to further optimize the physical animation effect and efficiency, the physical animation of each skeleton group can be matched with the corresponding preset motion range. In the case of exceeding the preset motion range, the wind influence coefficient can be configured for the skeleton group that failed to match, which is used to adjust the size of the target wind force. For example, the wind influence coefficient is 0.2, the target wind force is 10N, and the adjusted target wind force is 2N. The wind force acting on the skeleton group is reduced, and the swing amplitude will also be reduced accordingly, and the expected physical animation is obtained.
[0122] In this embodiment, a wind influence coefficient is configured for each bone group, and the dynamic bone calculation process is re-executed in combination with the wind direction influence coefficient and the target wind force, so that the movement amplitude of the bone group whose original movement degree exceeds the expected degree is reasonable, a more realistic physical animation is obtained, the degree of jitter is reduced, and physical distortion is alleviated.
[0123] In order to make the present application easier to understand, an exemplary application is provided below.
[0124] Solution 1: Hair and accessories are affected by different wind forces
[0125] Accessories (earrings, necklaces) only need to make a gentle pendulum motion, which is different from the expected motion of hair, so the wind force needs to be specified separately. Specifically:
[0126] Step (1): Introduce the wind channel identifier and the object channel identifier. Only when the object channel identifier and the wind channel identifier have a corresponding relationship, the corresponding wind force is involved in the calculation.
[0127] Channels can be represented in binary. For example, if the object channel of hair is identified as 0001, the hair is only affected by the wind of wind channel 0001. For example, if the object channel is identified as 1010, it means that the object is affected by wind of both wind channels 1000 and 0010.
[0128] Step (2): Process the wind forces that affect the system at the same time, and calculate a resultant force based on the properties of multiple wind forces. In the end, only one wind resultant force (target wind force) participates in the dynamic skeleton calculation process.
[0129] The wind force (target wind force) for the ornament may include a first periodic function wind force, including a plurality of wave crests and wave troughs of the same size, a cycle time of 5s, and a wave crest of 10N, which is used to simulate the relatively regular single pendulum motion wind force on the ornament.
[0130] The wind force for the hair (target wind force) may include a second periodic function wind force, including a plurality of crests and troughs of different sizes, with a cycle time of 2s, for simulating the continuous change of breeze. Under the target wind force, the swaying of the hair is more natural and beautiful.
[0131] Solution 2: Solve the problems of excessive jitter and physical distortion.
[0132] When the hair is affected by wind of the same direction and magnitude at the same time, it will perform dynamic animation with the same direction and amplitude, which is inconsistent with the expected effect of hair swinging in all directions. Therefore, the wind algorithm needs to be optimized. Specifically:
[0133] Step (3): Use random numbers to assign an initial value (wind direction influence coefficient) to each bone group of the hair, multiply it by the wind direction, and use it to influence the target wind direction. The random range is as follows: horizontal influence coefficient: -0.4 to 1.0, vertical influence coefficient 0 to 1.0, height influence coefficient 0 to 10.
[0134] The hair physical animation obtained by using the wind direction influence coefficient within the aforementioned range to participate in the dynamic bone calculation process is more natural.
[0135] Step (4): Perform standard dynamic bone process calculations to calculate the specific movement position and trajectory of the hair and generate physical animation.
[0136] Step (5): Assign a wind force influence coefficient to each bone group to adjust the target wind force. For bone groups whose movement is larger than expected, re-execute the dynamic bone calculation process and update the physical animation based on the wind force influence coefficient, wind direction influence coefficient and target wind force to keep the hair movement range within a reasonable range.
[0137] In this exemplary application: (1) wind channel identifiers and object channel identifiers are introduced to implement wind force specification at the object level. Different objects (such as character hair and accessories) can be affected by wind forces in different states to generate different physical animations, which improves the realism and aesthetics of physical animations and effectively enhances the user's viewing experience; (2) hair can swing randomly in different directions around, and accessories (such as earrings and necklaces) can make relatively regular single pendulum motions on the same plane, further improving the realism and aesthetics of physical animations.
[0138] Embodiment 2
[0139] Fig. 9The block diagram of the physical animation generation device according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig. 9 As shown, the apparatus 1000 may include: an acquisition module 1100, a determination module 1200 and a generation module 1300, wherein:
[0140] An acquisition module 1100 is used to acquire an object channel identifier of a target object, where the object channel identifier is used to indicate a wind channel associated with the target object;
[0141] A determination module 1200, configured to determine a target wind force corresponding to the wind force channel according to the object channel identifier;
[0142] The generating module 1300 is used to generate the physical animation of the target object according to the target wind force.
[0143] As an optional embodiment, determining the target wind force corresponding to the wind force channel according to the object channel identifier includes:
[0144] Determining the wind channel according to the object channel identifier;
[0145] In the case where there is only one wind channel: determining the wind force corresponding to the wind channel as the target wind force;
[0146] In the case where there are multiple wind channels: obtain the wind force corresponding to each of the wind channels; determine the wind resultant force according to the properties of the wind force corresponding to each of the wind channels; and determine the wind resultant force as the target wind force.
[0147] As an optional embodiment, the attributes include direction and size.
[0148] As an optional embodiment, the target object is a decoration, and the target wind force includes a first periodic function wind force, and the first periodic function wind force includes a plurality of wave crests and wave troughs of the same size.
[0149] As an optional embodiment, the target object is hair, and the target wind force includes a second periodic function wind force, and the second periodic function wind force includes a plurality of wave crests and wave troughs of different sizes.
[0150] As an optional embodiment, the target object is hair, and the hair includes a plurality of bone groups, and the bone groups are used to control the bones of a plurality of adjacent hairs.
[0151] As an optional embodiment, generating a physical animation of the target object according to the target wind force includes:
[0152] Get the wind direction influence coefficient corresponding to each bone group;
[0153] According to the wind direction influence coefficient corresponding to each bone group and the target wind force, a physical animation corresponding to each bone group is generated.
[0154] As an optional embodiment, the wind direction influence coefficient includes one or more of a lateral influence coefficient, a longitudinal influence coefficient and a height influence coefficient; wherein;
[0155] The lateral influence coefficient is used to constrain the component of the target wind force in the horizontal direction of the screen, so as to control the swing amplitude of each skeleton group in the horizontal direction of the screen;
[0156] The longitudinal influence coefficient is used to constrain the component of the target wind force in the vertical direction of the screen, so as to control the swing amplitude of each skeleton group in the vertical direction of the screen;
[0157] The height influence coefficient is used to constrain the component of the target wind force in the screen height direction to control the swing amplitude of each skeleton group in the screen height direction.
[0158] As an optional embodiment, the physical animation generating device 1000 is further used for:
[0159] Match the physical animation of each bone group with the corresponding preset motion range;
[0160] In case of a matching failure, obtaining a wind force influence coefficient of the skeleton group, wherein the wind force influence coefficient is used to adjust the magnitude of the target wind force;
[0161] The physical animation of the skeleton group is updated according to the wind force influence coefficient, the wind direction influence coefficient and the target wind force of the skeleton group.
[0162] Embodiment 3
[0163] Fig.10 The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing the physical animation generation method according to the third embodiment of the present application is schematically shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.10As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:
[0164] The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as a hard disk or a memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 may also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as program code of the physical animation generation method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.
[0165] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.
[0166] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0167] It should be pointed out that Fig.10 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0168] In this embodiment, the physical animation generation method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.
[0169] Embodiment 4
[0170] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the physical animation generation method in the embodiment are implemented.
[0171] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEP ROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store the operating system and various application software installed on the computer device, such as the program code of the physical animation generation method in the embodiment, etc. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.
[0172] Embodiment 5
[0173] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.
[0174] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0175] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A physical animation generation method, characterized in that: The method comprises: Acquire an object channel identifier of a target object, where the object channel identifier is used to indicate a wind channel associated with the target object; Determining a target wind force corresponding to the wind force channel according to the object channel identifier; A physical animation of the target object is generated according to the target wind force.
2. The method according to claim 1, characterized in that Determining a target wind force corresponding to the wind force channel according to the object channel identifier includes: Determining the wind channel according to the object channel identifier; In the case where there is only one wind channel: determining the wind force corresponding to the wind channel as the target wind force; In the case where there are multiple wind channels: obtain the wind force corresponding to each of the wind channels; determine the wind resultant force according to the properties of the wind force corresponding to each of the wind channels; and determine the wind resultant force as the target wind force.
3. The method according to claim 2, characterized in that The properties include direction and size.
4. The method according to claim 2, characterized in that: The target object is a decoration, and the target wind force includes a first periodic function wind force, which includes a plurality of wave crests and wave troughs of the same size.
5. The method according to claim 2, characterized in that: The target object is hair, the target wind force includes a second periodic function wind force, and the second periodic function wind force includes a plurality of wave crests and wave troughs of different sizes.
6. The method according to any one of claims 1, 2, 3 and 5, characterized in that: The target object is hair, and the hair includes a plurality of bone groups, and the bone groups are used to control bones of a plurality of adjacent hairs.
7. The method according to claim 6, characterized in that Generating a physical animation of the target object according to the target wind force, including: Get the wind direction influence coefficient corresponding to each bone group; According to the wind direction influence coefficient corresponding to each bone group and the target wind force, a physical animation corresponding to each bone group is generated.
8. The method according to claim 7, characterized in that The wind direction influence coefficient includes one or more of a lateral influence coefficient, a longitudinal influence coefficient and a height influence coefficient; wherein; The lateral influence coefficient is used to constrain the component of the target wind force in the horizontal direction of the screen, so as to control the swing amplitude of each skeleton group in the horizontal direction of the screen; The longitudinal influence coefficient is used to constrain the component of the target wind force in the vertical direction of the screen, so as to control the swing amplitude of each skeleton group in the vertical direction of the screen; The height influence coefficient is used to constrain the component of the target wind force in the screen height direction to control the swing amplitude of each skeleton group in the screen height direction.
9. The method according to claim 7, characterized in that: The method further comprises: Match the physical animation of each bone group with the corresponding preset motion range; In case of a matching failure, obtaining a wind force influence coefficient of the skeleton group, wherein the wind force influence coefficient is used to adjust the magnitude of the target wind force; The physical animation of the skeleton group is updated according to the wind force influence coefficient, the wind direction influence coefficient and the target wind force of the skeleton group.
10. A physical animation generating device, characterized in that: The device comprises: An acquisition module, used for acquiring an object channel identifier of a target object, wherein the object channel identifier is used for indicating a wind channel associated with the target object; A determination module, configured to determine a target wind force corresponding to the wind force channel according to the object channel identifier; A generating module is used to generate a physical animation of the target object according to the target wind force.
11. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to claims 1 to 9 are implemented.
