Method and device for realizing animation effect

By obtaining the particle velocity vector and random rotation angle, the rotation of particles is programmed, which solves the problem of low animation production efficiency in the existing technology, and realizes the differentiated rotation effect of particles in the process of free falling in the air, improving the realistic animation.

CN115382204BActive Publication Date: 2025-08-08NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210864216.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-20
Publication Date
2025-08-08
Estimated Expiration
2042-07-20

AI Technical Summary

Technical Problem

In the prior art, the animation production of ten thousand arrow shooting effects requires manual creation of a large number of bow and arrow rotation animation models with different rotation effects, resulting in large workload and inefficiency.

Method used

By obtaining the velocity vector of the target particle flying in the air, determining the initial rotation information based on the preset unit vector rotation about the velocity vector, and combining the random rotation angle of the target particle, the rotation effect of the particle is programmed to achieve differentiated rotation of the particle.

Benefits of technology

It improves the efficiency of animation production, realizes the differentiated rotation effect of thousands of particles in the process of free falling in the air, and enhances the realistic nature of the animation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115382204B_ABST
    Figure CN115382204B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for achieving an animation effect, the method comprising: obtaining a velocity vector of a target particle in a current image frame in response to the target particle flying in the air; determining initial rotation information based on the rotation of a preset unit vector around the velocity vector; determining first rotation information based on the initial rotation information, the velocity vector, and a first random rotation angle of the target particle in the current image frame; and controlling the target particle to rotate in the current image frame based on the first rotation information. The efficiency of animation production is greatly improved through programmed control; and, during the process of the target particle free-falling in the air, after determining the rotation information of the target particle in each image frame based on the first random rotation angle of the target particle in each image frame, during the continuous playback of the image frames, controlling the target particle to synchronously rotate during the free-falling motion in the air to produce an animation effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, and computer-readable storage medium for realizing animation effects. Background Art

[0002] In order to increase the visual effects of the game and make the game more interesting, various game effects are usually added to the game scenes. Among them, the arrow shooting effect is widely used in many game scenes.

[0003] In existing solutions for achieving the "Ten Thousand Arrows Shooting" effect, a large number of bow and arrow rotation animation models that achieve different rotation effects are usually manually created first; during the free fall of each bow and arrow after being launched from a launch source, each bow and arrow model is switched to any one of the above-mentioned bow and arrow rotation animation models that achieve different rotation effects, thereby achieving differentiated rotation effects of the bows and arrows during the "Ten Thousand Arrows Shooting" process.

[0004] However, in order to achieve differentiated rotation effects for each bow and arrow during the shooting process, it is necessary to manually create a large number of bow and arrow rotation animation models with different rotation effects, which leads to a sharp increase in workload and low efficiency in animation effect production. Summary of the Invention

[0005] The present application provides a method and device for realizing animation effects, as well as an electronic device and a computer-readable storage medium capable of implementing the method for realizing animation effects, so as to solve the problems in the prior art of large workload and low efficiency in producing animation effects.

[0006] In a first aspect, an embodiment of the present application provides a method for implementing an animation effect, the method comprising:

[0007] In response to the target particle flying in the air, obtaining a velocity vector of the target particle in a current image frame;

[0008] Determine initial rotation information by rotating a preset unit vector around the velocity vector;

[0009] determining first rotation information according to the initial rotation information, the velocity vector, and a first random rotation angle of the target particle in a current image frame;

[0010] The target particle is controlled to rotate in the current image frame according to the first rotation information.

[0011] Optionally, the first random rotation angle of the target particle in the current image frame is obtained by the following steps:

[0012] determining a random value for the target particle within a first value range;

[0013] determining a mapping relationship between the first numerical range and the second numerical range, and determining the mapping rotation angle corresponding to the random value as the relative rotation angle of the target particle according to the mapping relationship;

[0014] A first random rotation angle of the target particle in the current image frame is determined according to the relative rotation angle and a first preset rotation angle, wherein the first preset rotation angle is greater than the rotation angle within the second numerical range.

[0015] Optionally, the initial rotation information includes an initial rotation matrix;

[0016] The determining of the first rotation information according to the initial rotation information, the velocity vector, and the first random rotation angle of the target particle in the current image frame includes:

[0017] The initial rotation matrix uses the velocity vector as the rotation axis and rotates the first random rotation angle to obtain a first rotation matrix of the target particle in the current image frame.

[0018] Optionally, controlling the target particle to rotate in the current image frame according to the first rotation information includes:

[0019] Converting the first rotation matrix into a quaternion expression to obtain a first quaternion;

[0020] The target particle is controlled to rotate in the current image frame according to the first quaternion.

[0021] Optionally, the method further includes:

[0022] In response to the target particle colliding with the target obstacle, if the target obstacle is a static object, a target collision state corresponding to the target particle is acquired and a motion state of the target particle is controlled to conform to the target collision state.

[0023] Optionally, the collision state includes any one of the following: inserting the target obstacle from the collision point and rotating for a preset number of frames before stopping and falling onto the target collision object;

[0024] When the target collision state corresponding to the target particle is that the target obstacle is inserted from the collision point and the target obstacle is stopped after rotating for a preset number of frames, controlling the motion state of the target particle to conform to the target collision state includes:

[0025] Acquiring first rotation information of the target particle in an image frame before the collision occurs;

[0026] determining second rotation information according to first rotation information of the target particle in an image frame before the collision occurs and a second random rotation angle of the target particle in a current image frame;

[0027] The target particle is controlled to rotate in the current image frame according to the second rotation information.

[0028] Optionally, the distribution state of the second random rotation angle within the preset number of frames includes at least any one of the following: linear distribution, nonlinear distribution and exponential distribution;

[0029] The determining the second rotation information according to the first rotation information of the target particle in the image frame before the collision occurs and the second random rotation angle of the target particle in the current image frame includes:

[0030] determining a target rotation axis according to first rotation information of the target particle in an image frame before the collision occurs;

[0031] The second rotation information of the target particle in the current image frame is determined according to the first rotation information of the target particle in the image frame before the collision occurs, the target rotation axis, and the second random rotation angle.

[0032] Optionally, the rotation information includes a quaternion;

[0033] The determining, based on the first rotation information of the target particle in the image frame before the collision occurs, the target rotation axis, and the second random rotation angle, the second rotation information of the target particle in the current image frame includes:

[0034] Converting the quaternion of the target particle in the image frame before the collision into a rotation matrix expression to obtain a second rotation matrix and determining the target rotation axis according to the second rotation matrix;

[0035] A second quaternion of the target particle in the current image frame is determined according to the second rotation matrix, the target rotation axis, and the second random rotation angle.

[0036] Optionally, the method further includes:

[0037] In response to a collision between the target particle and the target obstacle, if the target obstacle is a dynamic object, obtaining first rotation information of the target particle in an image frame before the collision occurs;

[0038] Determining a target key point from among the multiple key points according to a positional relationship between a location where the target obstacle collides and a plurality of key points distributed at different locations in the target obstacle;

[0039] Obtaining third rotation information of the target particle in the current image frame according to the first rotation information of the target key point in the current image frame and the rotation information of the target particle in the image frame before the collision occurs;

[0040] The target particle is controlled to rotate in the current image frame according to the third rotation information.

[0041] Optionally, the rotation information includes a quaternion;

[0042] The obtaining, based on the rotation information of the target key point in the current image frame and the first rotation information of the target particle in the image frame before the collision occurs, third rotation information of the target particle in the current image frame includes:

[0043] The third quaternion of the target particle in the current image frame is determined by cross-multiplying the quaternion of the target key point in the current image frame by the quaternion of the target particle in the image frame before the collision occurs.

[0044] Optionally, determining a target key point from the multiple key points according to a positional relationship between a position where the target obstacle collides and multiple key points distributed at different positions in the target obstacle includes:

[0045] Among the multiple key points distributed at different positions in the target obstacle, the key point closest to the position where the collision occurs with the target obstacle is determined as the target key point.

[0046] In a second aspect, an embodiment of the present application provides a device for achieving an animation effect, the device comprising:

[0047] an acquisition module, configured to acquire a velocity vector of the target particle in a current image frame in response to the target particle flying in the air;

[0048] A first processing module, configured to determine initial rotation information by rotating a preset unit vector around the velocity vector;

[0049] a determination module, configured to determine first rotation information according to the initial rotation information, the velocity vector, and a first random rotation angle of the target particle in a current image frame;

[0050] A control module is configured to control the target particle to rotate in the current image frame according to the first rotation information.

[0051] Optionally, the determining module is specifically configured to:

[0052] determining a random value for the target particle within a first value range;

[0053] determining a mapping relationship between the first numerical range and the second numerical range, and determining the mapping rotation angle corresponding to the random value as the relative rotation angle of the target particle according to the mapping relationship;

[0054] A first random rotation angle of the target particle in the current image frame is determined according to the relative rotation angle and a first preset rotation angle, wherein the first preset rotation angle is greater than the rotation angle within the second numerical range.

[0055] Optionally, the initial rotation information includes an initial rotation matrix;

[0056] The determining module is specifically configured to:

[0057] The initial rotation matrix uses the velocity vector as the rotation axis and rotates the first random rotation angle to obtain a first rotation matrix of the target particle in the current image frame.

[0058] Optionally, the control module is specifically configured to:

[0059] Converting the first rotation matrix into a quaternion expression to obtain a first quaternion;

[0060] The target particle is controlled to rotate in the current image frame according to the first quaternion.

[0061] Optionally, the device further includes a second processing module, wherein the second processing module is specifically configured to:

[0062] In response to the target particle colliding with the target obstacle, if the target obstacle is a static object, a target collision state corresponding to the target particle is acquired and a motion state of the target particle is controlled to conform to the target collision state.

[0063] Optionally, the collision state includes any one of the following: inserting the target obstacle from the collision point and rotating for a preset number of frames before stopping and falling onto the target collision object;

[0064] When the target collision state corresponding to the target particle is that the target particle is inserted into the target obstacle from the collision point and stops rotating after rotating for a preset number of frames, the second processing module is specifically configured to:

[0065] Acquiring first rotation information of the target particle in an image frame before the collision occurs;

[0066] determining second rotation information according to first rotation information of the target particle in an image frame before the collision occurs and a second random rotation angle of the target particle in a current image frame;

[0067] The target particle is controlled to rotate in the current image frame according to the second rotation information.

[0068] Optionally, the distribution state of the second random rotation angle within the preset number of frames includes at least any one of the following: linear distribution, nonlinear distribution and exponential distribution;

[0069] The second processing module is specifically configured to:

[0070] determining a target rotation axis according to first rotation information of the target particle in an image frame before the collision occurs;

[0071] The second rotation information of the target particle in the current image frame is determined according to the first rotation information of the target particle in the image frame before the collision occurs, the target rotation axis, and the second random rotation angle.

[0072] Optionally, the rotation information includes a quaternion;

[0073] The second processing module is specifically configured to:

[0074] Converting the quaternion of the target particle in the image frame before the collision into a rotation matrix expression to obtain a second rotation matrix and determining the target rotation axis according to the second rotation matrix;

[0075] A second quaternion of the target particle in the current image frame is determined according to the second rotation matrix, the target rotation axis, and the second random rotation angle.

[0076] Optionally, the method further includes a third processing module, wherein the third processing module is specifically configured to:

[0077] In response to a collision between the target particle and the target obstacle, if the target obstacle is a dynamic object, obtaining first rotation information of the target particle in an image frame before the collision occurs;

[0078] Determining a target key point from among the multiple key points according to a positional relationship between a location where the target obstacle collides and a plurality of key points distributed at different locations in the target obstacle;

[0079] Obtaining third rotation information of the target particle in the current image frame according to the first rotation information of the target key point in the current image frame and the first rotation information of the target particle in the image frame before the collision occurs;

[0080] The target particle is controlled to rotate in the current image frame according to the third rotation information.

[0081] Optionally, the rotation information includes a quaternion;

[0082] The third processing module is specifically configured to:

[0083] The third quaternion of the target particle in the current image frame is determined by cross-multiplying the quaternion of the target key point in the current image frame by the quaternion of the target particle in the image frame before the collision occurs.

[0084] Optionally, the third processing module is specifically configured to:

[0085] Among the multiple key points distributed at different positions in the target obstacle, the key point closest to the position where the collision occurs with the target obstacle is determined as the target key point.

[0086] In a third aspect, an embodiment of the present application provides an electronic device, comprising:

[0087] A memory and a processor, wherein the memory and the processor are coupled;

[0088] The memory is used to store one or more computer instructions;

[0089] The processor is used to execute the one or more computer instructions to implement the animation effect realization method described in any one of the first aspects above.

[0090] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having one or more computer instructions stored thereon, characterized in that the instruction is executed by a processor to implement the animation effect implementation method described in any one of the above-mentioned first aspects.

[0091] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the animation effect implementation method described in any one of the first aspects above.

[0092] Compared with the prior art, this application has the following advantages:

[0093] The present application discloses a method and apparatus for achieving an animation effect. The method comprises: obtaining a velocity vector of a target particle in a current image frame in response to the target particle flying in the air; determining initial rotation information by rotating a preset unit vector around the velocity vector; determining first rotation information based on the initial rotation information, the velocity vector, and a first random rotation angle of the target particle in the current image frame; and controlling the target particle to rotate in the current image frame based on the first rotation information. On the one hand, programmatic control greatly improves the efficiency of animation production. On the other hand, after determining the rotation information of each frame of the target particle image based on the first random rotation angle corresponding to each frame, an animation effect in which the target particle rotates synchronously during the free-falling motion in the air can be achieved during the continuous playback of the image frames. Furthermore, by providing each first random rotation angle corresponding to each of the thousands of target particles emitted by the particle system, the thousands of particles have different first random rotation angles. Therefore, based on the first random rotation angle corresponding to each target particle, the thousands of target particles can achieve differentiated rotation during the free-falling motion in the air. BRIEF DESCRIPTION OF THE DRAWINGS

[0094] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0095] Figure 1 This is a flowchart of a method for implementing an animation effect according to the first embodiment of the present application;

[0096] Figure 2 This is a second flow chart of the method for realizing the animation effect provided in the first embodiment of the present application;

[0097] Figure 3 This is one of the schematic diagrams of the animation effect of shooting arrows provided in the first embodiment of the present application;

[0098] Figure 4 This is a third flow chart of the method for realizing the animation effect provided in the first embodiment of the present application;

[0099] Figure 5 A schematic diagram of a target obstacle including multiple key points provided in the first embodiment of the present application;

[0100] Figure 6 This is the second schematic diagram of the animation effect of shooting arrows provided in the first embodiment of the present application;

[0101] Figure 7 This is a flowchart of the operation of particles performing parabolic motion in the air provided in the first embodiment of the present application;

[0102] Figure 8 This is a flowchart of the operation of the first embodiment of the present application for particles to rotate at variable speeds after being inserted into the ground;

[0103] Figure 9 This is a flowchart of the operation of a particle hitting and following a target obstacle provided by the first embodiment of the present application;

[0104] Figure 10 This is a flowchart of the operation of particles falling to the ground after hitting the ground provided in the first embodiment of the present application;

[0105] Figure 11 This is the third schematic diagram of the animation effect of shooting arrows provided in the first embodiment of the present application;

[0106] Figure 12 A schematic diagram of the structure of the device for achieving animation effects provided in the second embodiment of the present application;

[0107] Figure 13 A schematic diagram of the hardware structure of an electronic device provided in the third embodiment of the present application.

[0108] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0109] To make the objects, advantages, and features of the present invention more clearly apparent, the present invention is described clearly and completely below with reference to the accompanying drawings and specific embodiments. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the embodiments described are only some of the embodiments of the present invention, not all of them. All other embodiments obtained by persons of ordinary skill in the art without inventive effort are intended to fall within the scope of protection of the present invention.

[0110] It should be noted that, in the description of this application, the terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance, or a specific order or precedence. For those skilled in the art, the specific meanings of the above terms in this application can be understood in specific circumstances. In addition, in the description of this application, unless otherwise specified, the term "plurality" refers to two or more. The term "and / or" describes the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. The terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products or devices.

[0111] In order to facilitate understanding of the technical solution of this application, the relevant concepts involved in this application are first introduced.

[0112] Quaternions (or quaternions) are hypercomplex numbers consisting of a real number and three complex numbers that can be used to describe the direction of an object's rotational motion. The real number represents the magnitude of the object's rotation, while the three complex numbers represent its direction in three-dimensional space. Common expressions for quaternions can be found in Formula 1:

[0113] q=q0+q1i+q2j+q3k Formula 1

[0114] Among them, q is a quaternion (i.e., the rotation information of the target particle in the current image frame), q0 is the real part of the quaternion, i, j, k are the imaginary units of the quaternion, and q1, q2, q3 are the imaginary parts of the imaginary singulars i, j, k in the quaternion.

[0115] Animation effects are the effects of continuously playing image frames to create a moving image. For example, when the application is a game, the animation effects required may be plot animation effects or cutscene effects.

[0116] 3D animation software is used to create 3D animation special effects. Examples include Houdini, Maya, and 3DsMax. As the leading 3D animation software, Houdini is designed entirely based on a node-based model, significantly different from other 3D animation software in terms of structure and operation.

[0117] Particle systems are a key feature in 3D animation software, offering unique advantages in simulating natural phenomena, physical phenomena, and spatial distortions. For example, particle systems can simulate rain, snow, flowing water, and dust. As their functionality improves, particle systems can simulate virtually any evocative 3D effect: smoke, sparks, explosions, blizzards, or waterfalls. To enhance the realism of physical phenomena, particle systems control particle behavior through spatial distortions. Combined with spatial distortions, these can simulate gravity, obstruction, wind, and other effects on particle flow. Typically, the position and movement of a particle system in 3D space are controlled by an emitter. An emitter is primarily represented by a set of particle behavior parameters and its position in 3D space. These parameters can include the particle generation rate (the number of particles generated per unit time), the particle's initial velocity vector (e.g., when and in what direction the particle moves), the particle lifetime (how long it takes for the particle to annihilate), the particle color, the particle shape, changes during the particle's lifetime, and other parameters.

[0118] A typical particle system update loop can be divided into two distinct phases: the parameter update / simulation phase and the rendering phase. Each loop executes for each frame of animation. In the simulation phase, the number of new particles is calculated based on the generation rate and update interval. Each particle is generated at a specific three-dimensional spatial position based on the emitter's position and the given generation area. The speed, color, lifespan, and other parameters of each particle are initialized based on the emitter's parameters. Each particle is then checked to see if it has exceeded its lifespan. If so, it is removed from the simulation process. Otherwise, the particle's position and characteristics are modified based on the physical simulation. The physical simulation can be as simple as adding velocity to the current position or adjusting velocity to offset friction, or as complex as taking external forces into account to calculate the correct physical projectile trajectory.

[0119] Below, the prior art involved in this application and the problems existing in the prior art are described:

[0120] In existing solutions for achieving the "Ten Thousand Arrows Shooting" effect, a large number of bow and arrow rotation animation models that achieve different rotation effects are usually manually created first; during the free fall of each bow and arrow after being launched from a launch source, each bow and arrow model is switched to any one of the above-mentioned bow and arrow rotation animation models that achieve different rotation effects, thereby achieving differentiated rotation effects of the bows and arrows during the "Ten Thousand Arrows Shooting" process.

[0121] However, in order to achieve differentiated rotation effects for each bow and arrow during the shooting process, it is necessary to manually create a large number of bow and arrow rotation animation models with different rotation effects, which leads to a sharp increase in workload and low efficiency in animation effect production.

[0122] To address the above-mentioned issues and to reduce the workload and improve the efficiency of animation effect production, this application provides a method for implementing animation effects, a corresponding device for implementing animation effects, an electronic device capable of implementing the method, and a computer-readable storage medium. The following examples provide detailed explanations of the above-mentioned method, device, electronic device, and computer-readable storage medium.

[0123] In order to make the purpose and technical solution of this application clearer and more intuitive, the method provided by the embodiment of this application will be described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit this application.

[0124] The embodiments of the present application provide a method, device, electronic device and storage medium for realizing animation effects. Specifically, the animation effects realization of the embodiments of the present application can be performed by an electronic device. Among them, the electronic device can be a terminal or a server or other device. The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), etc. The terminal can also include a client, which can be a game application client, a browser client with a game program, or an instant messaging client, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0125] It should be noted that in the following description of the technical solution provided by this application, the terminal is used as the execution subject for example. In other possible implementations, the technical solution provided by this application can also be executed by a server as the execution subject. The embodiments of this application do not limit the type of execution subject.

[0126] Next, combine Figure 1 , the method for realizing the animation effect provided in the embodiment of the present application is described, Figure 1 This is one of the flow charts of the method for realizing the animation effect provided in the first embodiment of the present application.

[0127] like Figure 1 As shown, the method for realizing the animation effect includes:

[0128] S101 . In response to a target particle flying in the air, obtaining a velocity vector of the target particle in a current image frame.

[0129] In this embodiment, the three-dimensional animation production software used to achieve the animation effect can be any one of the following: Houdini, Maya, 3Ds Max, etc., without any limitation.

[0130] 3D animation software includes a particle system, which uses emitters to emit thousands of particles to represent irregular, fuzzy objects and various effects, such as rain, snow, running water, and dust. For another example, if the particles are in the shape of arrows, the particle system can be used to launch arrows from the emitter at a preset particle generation speed in a preset direction and control their free fall, creating an animation effect where thousands of arrows are launched in a certain direction, and these arrows undergo differential rotation while performing parabolic motion in the air. For another example, if the particles are in the shape of raindrops, the particle system can be used to generate a preset number of raindrops from a predetermined direction at a preset speed, creating an animation effect where a continuous stream of raindrops is generated in a certain direction, and these raindrops perform parabolic motion in the air.

[0131] It should be noted that particle systems emit particles based on multiple parameters, such as the source direction, particle generation rate, individual particle emission speed, collision properties, and individual particle shape, mass, and size. These parameters are not subject to any restrictions. Furthermore, to simulate the flight of particles in the real world, a gravity field is set for all particles in the animation scene or for individual particles. At each time step, particles within this gravity field move downward to simulate the effects of gravity. The specific value of the gravitational acceleration g in the gravity field can be determined based on actual needs. For example, g = 9.8 N / kg can be used as an example. It is understood that a bow and arrow of a preset mass, launched at a preset speed, will follow a parabolic trajectory through the air. By setting different masses and launch speeds for different bows and arrows, each will achieve a different parabolic trajectory through the air.

[0132] The collision attribute is whether a collision occurs. For example, if the collision attribute of a particle is set to be collidable, the particle can be regarded as a collision body.

[0133] In this embodiment, the particle system is configured to set the emission source direction, the amount of particles emitted per second, the emission speed and mass of each particle, collision properties, and the shape and size of each particle. A gravity field is also set for each particle. That is, after the particle system emits thousands of particles, each particle is ejected from a preset direction and then performs parabolic motion in the air. The coordinate information of each particle and the corresponding velocity vector of each particle are recorded in each frame. The velocity vector of a particle in the current image frame is the coordinate information of the particle in the current image frame minus the coordinate information of the particle in the previous frame. The target particle is any one of the thousands of particles emitted by the particle system. That is, the motion setting method of each particle in the thousands of particles is consistent, while the specific parameter settings can be the same or different, which can be determined according to actual needs.

[0134] In response to the target particle flying in the air and performing a parabola, the velocity vector of the target particle in the current image frame is obtained. For example, in the t-th image frame, the motion state of the target particle is flying in the air and performing a parabola motion, then the velocity vector of the target particle in the t-1-th image frame is obtained. Among them, a feasible way to determine the velocity vector of the target particle in the current image frame can be: in the t-th image frame, the coordinates of the target particle in the three-dimensional space are A(x t ,y t ,z t ); and, at the t-1th image frame, the coordinates of the target particle in three-dimensional space are B(x t-1 ,y t-1 ,z t-1 ). Therefore, the velocity vector of the target particle in the tth image frame is:

[0135] Optionally, the velocity vector of the target particle in the current image frame is normalized to obtain a unit velocity vector of the target particle in the current image frame. Normalizing the velocity vector can scale the velocity vector to a unit velocity vector. In subsequent calculations of the velocity vector, the influence of the specific modulus of the velocity vector need not be considered, and only the direction of the velocity vector is considered.

[0136] Taking into account that in actual sports, the bows and arrows make parabolic movements in the air, the effect of the arrow shooting is further enhanced by rotating with the speed direction as the rotation axis. By setting different rotation angles for different bows and arrows, the rotation amplitudes of each bow and arrow in space are different, which improves the realism of the arrows making parabolas in the air. The efficiency of realizing the rotation of each bow and arrow is also improved through programmed control, avoiding the huge workload brought by manually keying a large number of different bow and arrow rotation models to achieve different rotations for each bow and arrow, which greatly saves manpower.

[0137] S102: Determine initial rotation information according to the rotation of a preset unit vector around a velocity vector.

[0138] The preset unit vector is a unit vector in three-dimensional space. For example, the preset unit vector can be selected from the following three-dimensional unit vectors: (1,0,0), (0,1,0), (0,0,1), and there is no limitation on this, as long as it is a three-dimensional unit vector.

[0139] When the target particle is flying in the air and performing parabolic motion, in order to simulate the particle's rotation around itself while performing parabolic motion in the real world, the initial rotation information is determined by rotating around the velocity vector according to the preset unit vector, that is, the velocity vector is used as the axis vector.

[0140] Optionally, initial rotation information is determined by rotating a preset unit vector around the velocity vector.

[0141] Optionally, the initial rotation information includes an initial rotation matrix.

[0142] A possible implementation of determining an initial rotation matrix by rotating a preset unit vector around a velocity vector of a target particle in a current image frame is described below by way of example.

[0143] For example, the unit velocity vector of the target particle in the current image frame is The default unit vector is First, use the preset unit vector The cross product of the unit velocity vector is Get vector Right now Among them, the vector With the preset unit vector Unit velocity vector vertical.

[0144] Second, using the unit velocity vector Cross product vector Get vector Right now

[0145] From this we can see that the unit velocity vector is vector and vectors The two vectors are perpendicular. vector All are normalized to obtain unit vectors and Then the unit velocity vector Unit vector and the unit vector The initial rotation matrix is formed, that is

[0146] S103 : Determine first rotation information according to the initial rotation information, the velocity vector, and a first random rotation angle of the target particle in the current image frame.

[0147] The first random rotation angle refers to the rotation angle of the target particle around the (unit) velocity vector in the current image frame. It should be noted that the first random rotation angles for the same target particle are different in different image frames, which allows the target particle to exhibit a continuous rotation effect during the playback of consecutive image frames. Furthermore, the first random rotation angles for different target particles in the same image frame are different, effectively simulating the differential rotation of thousands of particles in free fall, enhancing the realism of the animation effect.

[0148] Optionally, the first random rotation angle of the target particle in the current image frame is obtained by the following three steps:

[0149] Step 1: Determine a random value for the target particle within a first value range.

[0150] For example, in Houdini, a 3D animation software, particles emitted from an emission source are each assigned a unique ID. In Houdini, particle IDs are often used to provide differentiated control over each particle. The rand() function is used to assign a random value between 0 and 1 to the target particle ID. For example, the random number assigned to the target particle ID by the rand() function is 0.45.

[0151] Step 2: Determine a mapping relationship between the first numerical range and the second numerical range, and determine the mapping rotation angle corresponding to the random value as the relative rotation angle of the target particle according to the mapping relationship.

[0152] The explanation is based on the first data range being [0,1] in step one. Assuming the second data range is [n1,n2], the mapping relationship between the first numerical range and the second numerical range is: take a random number R from the first data range, then the mapping rotation angle obtained by mapping R to the second data range is: R*(n2-n1)+n1. For another example, if the first data range is [n3,n4] and the second data range is [n1,n2], then take a random number R from the first data range, then the mapping rotation angle obtained by mapping R to the second data range is: (R-n3)*d+n1. Wherein, d=(n2-n1)÷(n4-n3). The above two examples are both uniform mapping methods, and non-uniform mapping such as exponential mapping can also be used, and there is no limitation on this.

[0153] The mapped rotation angle corresponding to the random value is determined as the relative rotation angle corresponding to the target particle.

[0154] Step 3: Determine a first random rotation angle of the target particle in the current image frame according to the relative rotation angle and the first preset rotation angle, wherein the first preset rotation angle is greater than the rotation angle within the second numerical range.

[0155] Thousands of particles emitted by the particle system share the same first preset rotation angle, but each particle has a different relative rotation angle. The determination of the relative rotation angle is highly random. Therefore, based on the relative rotation angle corresponding to each particle, thousands of particles can achieve differentiated rotation.

[0156] Optionally, the sum of the relative rotation angle and the first preset rotation angle is determined as the first random rotation angle of the target particle in the current image frame.

[0157] Optionally, the initial rotation matrix is rotated by a first random rotation angle with the (unit) velocity vector as the rotation axis to obtain first rotation information of the target particle in the current image frame, where the first rotation information includes a first rotation matrix.

[0158] Optionally, the first preset rotation angle is greater than the rotation angles within the second numerical range. Since the relative rotation angle depends on the second numerical range, the first preset rotation angle for each target particle takes the same value, and the first random rotation angle corresponding to the target particle is equal to the sum of the relative rotation angle and the first preset rotation angle. Therefore, when there are multiple target particles, the minimum difference between the multiple target particles is 0, and the maximum difference between the multiple target particles is the difference between the maximum and minimum values in the second numerical range. Therefore, the setting of the first preset rotation angle being greater than the rotation angle within the second numerical range can make the overall distribution of the rotation angles of the multiple target particles more concentrated, while controlling the differentiation between the multiple target particles and keeping the difference in rotation angles within a reasonable range. For example, when the second numerical range is [1-10] and the first preset angle is 60, the maximum relative rotation angle corresponding to the target particle is 10 and the minimum is 1. The relative rotation angle plus the first preset angle yields the random rotation angle of the target particle. That is, the maximum value of the first random rotation angle of the target particle is 60+10=70, and the minimum value of the first random rotation angle of the target particle is 60+1=61. It should be noted that the second numerical range and the value of the first preset rotation angle can be set according to actual conditions and are not subject to any restrictions.

[0159] S104 : Control the target particle to rotate in the current image frame according to the first rotation information.

[0160] The first rotation information represents the rotation information of the target particle in the current image frame. Specifically, the rotation information of the target particle in each image frame can be represented by a quaternion.

[0161] Optionally, the first rotation matrix is converted into a quaternion expression to obtain a first quaternion; and the target particle is controlled to rotate in the current image frame according to the first quaternion.

[0162] It should be noted that the prerequisite for converting a matrix to a quaternion is that the matrix is an orthogonal matrix. Therefore, all rotation matrices are orthogonal matrices. The specific implementation method for converting the first rotation matrix to a quaternion expression to obtain the first quaternion can refer to the existing methods for converting matrices to quaternions.

[0163] In this embodiment, while a target particle is in free fall, the rotation information of the current image frame is determined through steps S101-S104. Once the rotation information for each frame of the target particle image is determined, the continuous playback of the image frames creates an animation effect in which the target particle rotates synchronously during its free fall. Furthermore, it should be emphasized that when thousands of target particles are simultaneously in free fall, each of these thousands of target particles can exhibit different rotation effects. This differentiated rotation animation effect is more realistic.

[0164] Taking the target particles shaped like bows and arrows as an example, when thousands of arrows rotate during free fall in mid-air, the differentiated rotations of these thousands of target particles create a realistic animation effect, resembling a shooting array of arrows. Furthermore, to enhance the realism of the shooting array, different bows are assigned different masses and launch velocities. Considering that arrows perform parabolic movements in the air in real-world situations, the effect of the shooting array is further enhanced by rotating them about their velocity. By setting different rotation angles for different arrows, the resulting rotation amplitudes vary, enhancing the realism of the parabolic arcs. This programmatic control also improves the efficiency of achieving the rotation of each arrow, avoiding the enormous workload of manually creating numerous different arrow rotation animation models to achieve differentiated rotation for each arrow. This significantly saves manpower and improves animation production efficiency.

[0165] The method for achieving an animation effect provided by the present application comprises: in response to a target particle flying in the air, obtaining a velocity vector of the target particle in the current image frame; determining initial rotation information based on a rotation of a preset unit vector around the velocity vector; determining first rotation information based on the initial rotation information, the velocity vector, and a first random rotation angle of the target particle in the current image frame; and controlling the target particle to rotate in the current image frame based on the first rotation information. On the one hand, the efficiency of animation production is greatly improved through programmed control; on the other hand, during the process of the target particle free falling in the air, after the rotation information of each frame of the target particle image is determined based on the first random rotation angle corresponding to the target particle in each image frame, an animation effect of the target particle rotating synchronously during the process of free falling in the air can be achieved during the continuous playback of the image frames. Furthermore, by giving each of the thousands of target particles emitted by the particle system a corresponding first random rotation angle, the first random rotation angles of the thousands of particles are different. Therefore, based on the first random rotation angle corresponding to each target particle, the thousands of target particles can achieve differentiated rotation during the process of free falling in the air.

[0166] Next, combine Figure 2 , the method for realizing the animation effect provided by the first embodiment of the present application is described, Figure 2 This is the second flow chart of the method for realizing the animation effect provided in the first embodiment of the present application.

[0167] like Figure 2 As shown, the animation effect implementation method also includes:

[0168] S201 : In response to a target particle colliding with a target obstacle, when the target obstacle is a static object, obtaining a target collision state corresponding to the target particle.

[0169] The target obstacle is the virtual object that collides with the target particle. Obstacles include static and dynamic objects. For example, when the target obstacle is a static object such as a virtual wall, the target obstacle's motion state attributes are set to static attribute parameters. For another example, when the target obstacle is a dynamic object such as a virtual character, the target obstacle's motion state attributes are set to dynamic attribute parameters.

[0170] The target obstacle has collision properties. This means that upon collision, the target particle's collision state can be any of the following: inserting into the target obstacle from the collision point, rotating for a preset number of frames, then stopping, or falling onto the target collision object. The collision properties of the target particle and the target obstacle can be configured based on the desired collision state. These collision properties include elasticity, friction, and more.

[0171] Optionally, when the target collision state of the target particle is falling over the target collision object, when the bow and arrow collides with the ground, the bow and arrow are displayed to perform rigid body solution with the ground, and the bow and arrow fall to the ground effect is sufficient.

[0172] Optionally, the target collision state of the target particle may be determined before the target particle collides with the target obstacle.

[0173] A possible implementation of determining the target collision state of a target particle is exemplarily described below.

[0174] Assume that the collision states include the following: inserting a target obstacle from the collision point and stopping after rotating for a preset number of frames, and tipping over onto the target collision object. A random number (referred to as a random number) is randomly selected for the target particle within the third numerical range, and the third numerical range is divided into a fourth numerical range and a fifth numerical range. If the random number is within the fourth numerical range, the target collision state of the target particle is determined to be inserting a target obstacle from the collision point and stopping after rotating for a preset number of frames; if the random number is within the fifth numerical range, the target collision state of the target particle is determined to be tipping over onto the target collision object. For example, the third numerical range is [0, 1], the fourth numerical range is [0, 0.45], and the fifth numerical range is (0.45, 1). If the random number corresponding to the target particle is 0.23, then since 0.23 is within the fourth numerical range and the collision state corresponding to the fourth numerical range is inserting a target obstacle from the collision point and stopping after rotating for a preset number of frames, the target collision state of the target particle is determined to be inserting a target obstacle from the collision point and stopping after rotating for a preset number of frames.

[0175] S202 , when the target collision state corresponding to the target particle is that the target obstacle is inserted from the collision point and the rotation stops after a preset number of frames, executing steps S203 - S206 .

[0176] S203: Acquire first rotation information of the target particle in an image frame before the collision occurs.

[0177] Optionally, the first rotation information may be expressed in any form: a rotation matrix or a quaternion.

[0178] It should be emphasized that during the process of rotating the target particle for a preset frame after the target particle is inserted from the collision point into the target obstacle, the target rotation axis of the target particle is determined based on the rotation information of the target particle in the image frame before the collision. That is, during the process of rotating the target particle for a preset frame after the target particle is inserted from the collision point into the target obstacle, the target rotation axis of the target particle can be the velocity direction of the target particle in the image frame before the collision. It is understandable that when the target particle performs parabolic motion in the air, each frame has a velocity vector of the target particle; however, when the target particle collides with the target obstacle, the instantaneous velocity of the target particle becomes 0 and has no velocity direction. When the target particle collides with the target obstacle and is inserted into the target obstacle, in order to ensure that the target particle maintains its velocity direction before the insertion, the target rotation axis of the target particle is determined based on the velocity vector of the target particle in the image frame before the collision. That is, the velocity vector is the rotation axis of the target particle after the target particle inserts into the target obstacle.

[0179] S204 : Determine the target rotation axis according to the first rotation information of the target particle in the image frame before the collision occurs.

[0180] Based on the first rotation information of the target particle in the image frame before the collision is obtained in step 203, the following exemplifies possible implementation methods of determining the target rotation axis based on the first rotation information with respect to different expressions of the first rotation information.

[0181] In one possible implementation, when the first rotation information of the target particle in the image frame before the collision is expressed as a rotation matrix, since the target particle animation control is in three-dimensional space, the rotation matrix of the target particle in the image frame before the collision is a three-dimensional rotation matrix. The three-dimensional rotation matrix has three rotation axes. Any rotation axis in the three-dimensional rotation matrix of the target particle in the image frame before the collision, or the velocity direction (rotation axis) of the target particle in the image frame before the collision, can be randomly determined as the target rotation axis about which the target particle rotates in the current image frame.

[0182] In one possible implementation, when the first rotation information of the target particle in the image frame before the collision is expressed in the form of a quaternion, the quaternion of the target particle in the image frame before the collision is first converted into the form of a rotation matrix. Subsequently, the target rotation axis around which the target particle rotates in the current image frame can be determined by randomly changing any rotation axis in the three-dimensional rotation matrix of the target particle in the image frame before the collision or the velocity direction (rotation axis) of the target particle in the image frame before the collision.

[0183] S205 , determining second rotation information of the target particle in the current image frame according to the first rotation information of the target particle in the image frame before the collision, the target rotation axis, and the second random rotation angle.

[0184] Optionally, the distribution state of the second random rotation angle within the preset number of frames includes at least any one of the following: linear distribution, nonlinear distribution and exponential distribution.

[0185] Optionally, when the initial rotation information is expressed in the form of a rotation matrix (i.e., the initial rotation information is an initial rotation matrix), or when the initial rotation information is expressed in the form of a quaternion, the rotation matrix obtained by converting the quaternion into the form of a rotation matrix is used as the initial rotation matrix; the initial rotation matrix is rotated by a second random rotation angle about the target rotation axis to obtain second rotation information of the target particle in the current image frame. The second rotation information is expressed in forms including a rotation matrix and a quaternion.

[0186] It's important to note that the distribution of the second random rotation angle for each target particle within a preset number of frames can be identical, partially identical, or completely different. This can be set based on actual needs and is not subject to any restrictions. Furthermore, the second random rotation angle of a target particle in each image frame takes a random value. Therefore, when tens of thousands of target particles are present simultaneously, each target particle will have a different second random rotation angle.

[0187] Optionally, when the first rotation information is expressed in a quaternion, a possible implementation of “determining the second rotation information of the target particle in the current image frame based on the first rotation information of the target particle in the image frame before the collision, the target rotation axis, and the second random rotation angle” includes the following steps:

[0188] S2051, converting the quaternion of the target particle in the image frame before the collision into an expression of a rotation matrix, obtaining a second rotation matrix and determining the target rotation axis according to the second rotation matrix;

[0189] Optionally, the implementation of the step “determining the target rotation axis according to the second rotation matrix” may refer to the specific implementation of “determining the target rotation axis according to the first rotation information of the target particle in the image frame before the collision occurs” in step S204.

[0190] S2052: Determine a second quaternion of the target particle in the current image frame according to the second rotation matrix, the target rotation axis, and the second random rotation angle.

[0191] Optionally, the second rotation matrix uses the target rotation axis as the rotation axis and rotates by a second random rotation angle to obtain a second quaternion of the target particle in the current image frame.

[0192] S206 : Control the target particle to rotate in the current image frame according to the second rotation information.

[0193] Optionally, based on the above step S205 , second rotation information of the target particle in the current image frame is determined, and the target particle is controlled to rotate in the current image frame according to the second rotation information.

[0194] Optionally, when the second rotation information is expressed in a quaternion, the second quaternion of the target particle in the current image frame is obtained in step S2052 , and the target particle is controlled to rotate in the current image frame according to the second quaternion.

[0195] When the target particle collides with the target obstacle, its free fall in mid-air ends. If the target obstacle is a static object and the target particle's target collision state is to insert into the target obstacle from the collision point and rotate for a preset number of frames before stopping, the manner in which the target particle rotates within the preset number of frames after colliding with the target obstacle is determined and controlled through steps S204-S206. Once the rotation information for each frame of the target particle image is determined, an animation effect can be achieved during the continuous playback of image frames, where the target particle inserts into the target obstacle from the collision point and rotates for a preset number of frames before stopping. Furthermore, it should be emphasized that when thousands of target particles insert into the target obstacle from the collision point at the same time or at different times, an animation effect can be achieved where thousands of target particles insert into the target obstacle from the collision point and rotate for a preset number of frames before stopping. Furthermore, a differentiated rotation effect can be achieved for each target particle in each image frame due to differences in the rotation axis and the second random rotation angle. This animation effect of thousands of target particles performing differentiated rotations is more realistic.

[0196] Taking the target particles as bows and arrows as an example, when thousands of bows and arrows penetrate the target obstacle from the collision point (that is, end their free fall in the air), rotate for a preset number of frames and then stop rotating, the differentiated rotation effects between the thousands of target particles create an animation effect of thousands of arrows shooting at the target obstacle and rotating differently, which is consistent with the actual situation, making such animation effects more realistic.

[0197] The method for realizing the animation effect provided in the present application is to obtain the target collision state corresponding to the target particle in response to a collision between the target particle and the target obstacle when the target obstacle is a static object. When the target collision state corresponding to the target particle is to insert the target obstacle from the collision point and stop rotating after rotating for a preset number of frames, the following steps are performed: obtaining the first rotation information of the target particle in the image frame before the collision occurs. Determine the target rotation axis based on the first rotation information of the target particle in the image frame before the collision occurs. Determine the second rotation information of the target particle in the current image frame based on the first rotation information, the target rotation axis, and the second random rotation angle of the target particle in the image frame before the collision occurs. Control the target particle to rotate in the current image frame based on the second rotation information.

[0198] Next, combine Figure 3 , when the target particle is the target bow and arrow and the target obstacle is the ground (the ground's motion state is static), the effect of the bow and arrow colliding with the ground, the bow and arrow inserting into the ground, and the bow and arrow falling to the ground are schematically explained. Figure 3 This is one of the schematic diagrams of the animation effect of shooting thousands of arrows provided in the first embodiment of the present application.

[0199] like Figure 3 As shown, including a large number of bows and arrows as well as the ground. Figure 3 In the game, some of the arrows are shown as being inserted into the ground, while others are shown as being falling. It should be noted that after the arrows are inserted into the ground, the dynamic images of them rotating at different amplitudes within the preset time are not reflected in the game. Figure 3 middle.

[0200] Next, combine Figure 4 , the method for realizing the animation effect provided by the first embodiment of the present application is described, Figure 4 This is the third flow chart of the method for realizing the animation effect provided in the first embodiment of the present application.

[0201] like Figure 4 As shown, the animation effect implementation method also includes:

[0202] S401 : In response to a target particle colliding with a target obstacle, if the target obstacle is a dynamic object, obtaining first rotation information of the target particle in an image frame before the collision occurs.

[0203] Optionally, the dynamic target obstacle may be a virtual cartoon character, a virtual plant, or a virtual animal, etc., without any limitation, as long as it is in a moving state.

[0204] Optionally, the description and explanation of the step “obtaining the first rotation information of the target particle in the image frame before the collision occurs” can refer to the above description and explanation of step S203, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0205] S402: Determine a target key point from the multiple key points according to a position where the target obstacle collides and a positional relationship between multiple key points distributed at different positions in the target obstacle.

[0206] It should be noted that a dynamic object has multiple key points distributed on it, and the rotation information corresponding to each key point will change as the dynamic object moves.

[0207] Next, combine Figure 5 , taking the target obstacle as a virtual character as an example, the virtual character includes multiple key points for exemplary explanation, Figure 5 A schematic diagram showing that a target obstacle provided in the first embodiment of the present application includes multiple key points.

[0208] Taking the dynamic object as an example, in order to further simulate the dynamic changes of the virtual character's body parts during movement, multiple key points are set on the virtual character's body. These key points are distributed at the key parts that determine the body's changes. Figure 5 As shown, the avatar includes a large number of key points, each of which has rotation information. For example, when the avatar moves, the rotation information of each key point will change (for example, the rotation information is expressed in the form of quaternions). The rotation information of a key point can represent the direction of movement of the key point, that is, it can reflect the rotational orientation state information of the key point when the avatar moves.

[0209] In this embodiment, when the motion state of the target obstacle colliding with the target particle is dynamic, the orientation information for the target particle is determined based on the dynamic target obstacle, that is, the purpose is to make the target particle inserted into the target obstacle follow the motion of the target obstacle.

[0210] Optionally, among a plurality of key points distributed at different positions in the target obstacle, the key point closest to the position where the collision occurs with the target obstacle is determined as the target key point.

[0211] S403 , obtaining third rotation information of the target particle in the current image frame according to the rotation information of the target key point in the current image frame and the first rotation information of the target particle in the image frame before the collision occurs.

[0212] Optionally, the expression form of the rotation information includes quaternion and rotation matrix.

[0213] Optionally, when the rotation information is expressed in quaternion, the quaternion of the target key point in the current image frame is obtained, and the quaternion of the target particle in the image frame before the collision occurs is obtained.

[0214] Optionally, when the rotation information is expressed in a quaternion, the third quaternion of the target particle in the current image frame is determined based on the cross product of the quaternion of the target key point in the current image frame and the quaternion of the target particle in the image frame before the collision occurs, that is, the third quaternion is the third rotation information.

[0215] S404: Control the target particle to rotate in the current image frame according to the third rotation information.

[0216] After the third rotation information is determined based on the above step S403, when the rotation information is expressed in a quaternion (the third quaternion is the third rotation information), the target particle is controlled to rotate in the current image frame according to the third quaternion.

[0217] When the target particle collides with the target obstacle, its free fall in mid-air ends. If the target obstacle is a dynamic object, the rotation information of the target particle in the current image frame is determined through steps S402-S404. Once the rotation information of the target particle is determined for each frame, an animation effect can be achieved during the continuous playback of the image frames, where the target particle follows the movement of the target obstacle. Furthermore, it should be emphasized that when thousands of target particles collide with the same target obstacle, and when these thousands of target particles collide at different locations on the target obstacle, an animation effect can be displayed where these thousands of target particles rotate differently as they insert into the target obstacle. This animation effect of thousands of target particles rotating differently is more realistic.

[0218] The animation effect realization method provided by the present application is as follows: in response to a collision between a target particle and a target obstacle, if the target obstacle is a dynamic object, the first rotation information of the target particle in the image frame before the collision occurs is obtained; based on the positional relationship between the location where the target obstacle collided and multiple key points distributed at different positions in the target obstacle, the target key point is determined from the multiple key points; based on the rotation information of the target key point in the current image frame and the first rotation information of the target particle in the image frame before the collision occurs, the third rotation information of the target particle in the current image frame is obtained; and based on the third rotation information, the target particle is controlled to rotate in the current image frame. When the target particle collides with a dynamic target obstacle and the target particle is inserted into the target obstacle, a dynamic effect of the target particle following the dynamic target obstacle is achieved, further improving the realism of the animation effect; by controlling the target particle to follow the target obstacle in this programmatic manner, the huge workload caused by the need to manually create the required animation model is avoided, greatly improving the efficiency of animation production. In addition, this programmatic approach makes it easier to realize the complex animation effect of the target particle inserting into the dynamic target obstacle and following the target obstacle.

[0219] Next, combine Figure 6 When the target particle is in the shape of a bow and arrow and the target obstacle is a virtual character (the motion state is dynamic), the rotation effect of the bow and arrow inserted into the virtual character's body within a preset number of image frames after colliding with the ground is schematically illustrated. Figure 6 This is the second schematic diagram of the animation effect of shooting thousands of arrows provided in the first embodiment of the present application.

[0220] like Figure 6 As shown, it includes a large number of bows and arrows, ground and virtual characters. Figure 6 In the video, a part of the arrow is inserted into the body of the virtual character. It should be noted that after the arrow is inserted into the body of the virtual character, the dynamic picture of the arrow following the virtual character is not reflected in the video. Figure 6 middle.

[0221] Next, combine Figure 7-10 The method for implementing the animation effect provided by this application is further explained with specific examples. Figure 7 This is a flowchart of the operation of particles performing parabolic motion in the air provided in the first embodiment of the present application. Figure 8 This is a flowchart of the operation of the particles provided in the first embodiment of the present application after being inserted into the ground and rotating at a variable speed. Figure 9 This is a flowchart of the operation of the particle hitting and following the target obstacle provided by the first embodiment of the present application. Figure 10 This is a flowchart of the operation of particles falling to the ground after hitting the ground, provided in the first embodiment of the present application.

[0222] In order to better understand the technical solution of this application, Figure 7-10 Before proceeding, let's briefly introduce the particle system. Before emitting particles, multiple parameters are set within the particle system. A particle system is a collection of particles. By setting an emission source, various animation effects can be created while emitting a stream of particles. Alternatively, the particle system is an object, and the emitted particles are sub-objects. The particle system can be animated as a whole, and its properties can be adjusted over time to control the behavior of each particle. Specifically, the properties controlling particle behavior include at least one of the following: emission source direction, particle emission rate per second, emission speed and mass of each particle, collision properties, and parameters such as particle shape and size. These properties are not limited. Furthermore, to simulate the flight effects of particles in the real world, directional forces, such as gravity or wind, need to be added to all or individual particles in the animation scene. For example, adding gravity to particles can create free-fall animation effects, while adding wind to particles can create effects such as fluttering and dancing under the influence of wind. The gravitational acceleration g and wind force can be set based on actual needs. For example, the gravitational acceleration g can be set to g = 9.8 N / kg. The collision attribute is whether a collision can occur. The collision attribute includes three parameters: elasticity, friction, and offset. By setting different values for the three parameters, different particles can show different collision and bounce-off animation effects after colliding with each other. For example, setting a particle to be collidable means that the particle can be regarded as a collision body, which can achieve the animation effect of bouncing off after colliding with other particles. It should be noted that the collision body is also divided into active collision objects and passive collision objects. After the active collision object and the passive collision object collide, the position of the passive collision object does not change, while the active collision object is bounced off.

[0223] In this embodiment, the particle system sets the emission source direction, the number of particles emitted per second, the emission speed and mass of each particle, collision properties, and the shape and size of each particle. Furthermore, gravity is set for each particle. This means that after the particle system emits thousands of particles, each particle will be ejected from a preset direction and perform parabolic motion in the air. Each image frame records the coordinate information of each particle and its corresponding velocity vector. The velocity vector of a particle in the current image frame is the particle coordinate information in the current image frame minus the particle coordinate information in the previous frame. A particle is any one of the thousands of particles emitted by the particle system.

[0224] like Figure 7As shown, when a particle is flying in the air and performing parabolic motion, the velocity vector of the particle in the historical frame image is recorded or saved. For example, the software records and saves the velocity vector of the particle in the previous image frame (step 701, for the sake of simplicity, the word "step" is omitted in the following description). The velocity vector of the particle recorded in 701 is normalized to obtain a unit velocity vector (702). The unit velocity vector is used as the rotation axis, and the other two axes are in a free state to determine the initial rotation matrix (703). For the particle corresponding to the particle number (707), the random function rand() is used to obtain a random number from 0-1 (708). For example, the random number obtained is 0.45. A random number is used as a parameter in the mapping function (fit() function. It should be noted that due to the limitation of the return value range of the random function rand(), the range of the return value is expanded by introducing the fit() function. The fit() function includes one parameter called n, and the value range of the parameter n is [0,1]. There is a maximum value num_max and a minimum value num_min written inside the fit() function. For example, if the value range of n in the fit(n) function is [0,1], then the fit(n) function is used to uniformly map n from the data interval [0,1] to the data interval [num_min,num_max]. The fit() function determines a number from the data interval [num_min,num_max] as the return value of the fit(n) function based on the size of the parameter n.

[0225] The random number determined in step 708 is used as the parameter n of the fit() function. According to the maximum value, minimum value and parameter n in the mapping function (fit function), a number (709) is determined and used as the relative rotation angle corresponding to the particle. For example, when the random number is 0.45, the maximum value in the fit() function is 70, and the minimum value is 40, then the relative rotation angle corresponding to the particle can be taken as: 40+(70-40)*0.45=53.5. It should be understood that in order to make the rotation angle of each particle different, the first preset rotation angle (711) set uniformly is added to the relative rotation angle corresponding to each particle to obtain the rotation angle (710) of each particle in the current image frame. Afterwards, the unit velocity vector obtained in 702 is used as the rotation axis in 704, the initial rotation matrix obtained in 703 is used as the initial rotation matrix in 704, and the rotation angle obtained in step 710 is used as the rotation angle in 704. The rotation matrix (704) of the particle during flight in the air is determined based on the rotation axis, the initial rotation matrix and the rotation angle. The rotation matrix is converted into a quaternion (705), and the quaternion of the particle is stored as orientation information (706). The particle is controlled to rotate in the process of flying in the air according to the orientation information, so as to achieve an animation effect of the particle rotating in the process of flying in the air.

[0226] like Figure 8 As shown, when the particle's motion state is detected to be stationary (718), it is confirmed that the particle hits the target obstacle (e.g., the ground), and Input==1 is determined in 719. When Input==1, it is determined that the particle hits the target obstacle and the target obstacle is a static object; when Input==0, it is determined that the particle does not hit the target obstacle and is still in a free fall state; the value of Input in (719) is input into the state parameter corresponding to the selection module. When the value of Input in (719) is 1, input 1 is used as the selection result of the selection module; when the value of Input in (719) is 0, input 2 is used as the selection result of the selection module. Specifically, when the value of Input in 719 is 0, input 2 is used as the selection result of the selection module. Then, the quaternion of the particle in 717 is used as the value of input 2 of the selection module (720), and the particle is controlled to rotate according to the quaternion (706). When the value of input in 719 is 1, input 1 is used as the selection result of the selection module. Then, the quaternion of the particle in 705 is used as the value of input 1 of the selection module (720), and the particle is controlled to rotate according to the quaternion (706).

[0227] Next, the steps for determining the quaternion (705) corresponding to input 1 are described.

[0228] First, the current quaternion of the particle in 717 is converted into a rotation matrix, and the axis (722) is extracted from the rotation matrix to determine the three axes, namely axis 1, axis 2, and axis 3. Any one of the three axes is selected as the rotation axis. For example, axis 2 is determined as the rotation axis. When the particle hits the target obstacle, the frame count is started (for example, starting from 1, such as 1, 2, 3, etc.). (It should be noted that when there are thousands of particles, each particle is counted individually.) Use the mapping fit() function and the corresponding parameters to make each particle start to rotate a certain angle after the frame count, and the rotation angle of the particle for the fixed frame count changes nonlinearly, and the particle stops rotating after reaching the fixed frame count. For example, the parameters of the fit function are set to (0, 30, 0, 1). Then, when the particle's frame count (step 712) is between 1 and 30, the frame count is mapped to a value between 0 and 1 (step 713). Furthermore, in order to make the rotation angle of the particle change nonlinearly within the 30 frames (714), the rotation angle is mapped through the nonlinear data distribution in the ramp function to obtain the mapped rotation angle, which is used as input 1 in 723. The relative rotation angle obtained in (709) is used as input 1 of (723), and the rotation angle obtained in step (714) is used as input 2 of (723). Input 1 and input 2 in 723 are multiplied (723) to obtain the rotation angle information of the particle in the current image frame. The rotation angle information is used as the rotation angle in 704, the rotation matrix in 721 is used as the initial rotation matrix in 704, and any one of the axes in 722 is used as the rotation axis in 704. Based on the initial rotation matrix, the rotation axis, and the rotation angle, a rotation matrix is determined and converted into a quaternion (705).

[0229] like Figure 9 As shown, when it is determined that the particle is stuck in the target obstacle and the target obstacle is a dynamic object (728), the input value in the comparison module (729) is determined to be 1, and the output Boolean value is 1. When the Boolean value is 1, when the Boolean value = 1 is used as the state parameter of the selection module, the input 1 is selected as the result of the selection module in 726, and the result is used as the target quaternion orientation information (727) to control the rotation of the particle; or, when it is determined that the particle is not stuck in the target obstacle (728), the input value in the comparison module (729) is determined to be 0, and the output Boolean value is 0. When the Boolean value is 0, when the Boolean value = 0 is used as the state parameter of the selection module, the input 2 is selected as the result of the selection module in 726, and the input result is used as the target quaternion orientation information (727) to control the rotation of the particle.

[0230] Next, the implementation methods of determining the quaternion corresponding to input 1 and determining the quaternion corresponding to input 2 in (726) are described respectively.

[0231] First, the implementation method of determining the quaternion corresponding to input 2 is described. Specifically, the quaternion orientation information in 724 is used as the value of input 2.

[0232] Next, the implementation method of determining the quaternion corresponding to input 1 is described. Specifically, first obtain the collision position of the particle and the target obstacle when the particle collides with the target obstacle and inserts the target obstacle (730). The target obstacle that collides with the particle is used as the file source of 731. Among the multiple key points corresponding to the target obstacle, the key point closest to the collision position is found (i.e., point cloud search), and the parameter information of the key point is filtered out (732). The parameter information can be, for example, quaternion orientation information, velocity direction information, etc. In the technical solution of the present application, the quaternion information corresponding to the key point is filtered out to obtain the filtered result, i.e., the quaternion information corresponding to the key point (732). The quaternion of the key point is used as the quaternion 1 in 725, and the quaternion in 724 is used as the quaternion 1 in 725. In (725), quaternion 1 is cross-multiplied by quaternion 2 to obtain the target quaternion, i.e., the cross-multiplication result in 725.

[0233] Next, combine Figure 10 , which describes how to achieve the animation effect of the target obstacle remaining stationary and the particle falling onto the target obstacle after the particle collides with the target obstacle.

[0234] In the introduction Figure 10Before we begin, let's explain the following: In 3D animation software, collision dynamics simulation typically consists of collision objects, solvers, and forces. The collision object contains essential parameters describing the object being simulated, such as geometry (e.g., sphere, cube), density, temperature, mass, friction, initial position, rotation, and velocity. The solver is responsible for calculating the behavioral parameters of the simulated collision object as it moves in the real world. These parameters include physical dynamic parameters such as the velocity vector and rotation information. The solver monitors the motion state of the collision object and uses its internal calculation logic to calculate its motion parameters at each time interval. Forces are information that can be applied to objects (of any attributes, not just collision objects). Forces can be applied to all objects in the animation scene or to individual objects. This means that the object receiving the force will change its motion behavior due to the force. For example, gravity can be applied to a collision object. When the solver learns that the force acting on the collider includes the force of gravity, the solver will pull the collider downward in each time step to simulate the movement of the collider under gravity.

[0235] like Figure 10 As shown, a collision relationship is established between the particle and the target obstacle through the merging node 735. The collision relationship means that when the particle collides with the target obstacle, its shape and / or motion behavior and / or motion direction will change. The two collision bodies of the collision relationship established by the rigid body solver 736 and the merging node 735 are bound through the merging node 737, so that after the particle collides with the target obstacle, the rigid body solver 736 calculates the motion state parameters of the particle and the target obstacle. Gravity is applied to both the particle and the target obstacle so that the rigid body solver 736 considers the effect of gravity in the process of calculating the motion state parameters of the particle and the target obstacle, thereby realizing the motion effect of each collision body under gravity; according to the above settings, the motion effect (739) after the particle collides with the target obstacle is output, that is, the particle collides with the target obstacle, and then the particle falls on the target obstacle.

[0236] Next, combine Figure 11 Taking the target particles as bows and arrows, and the target obstacles as the ground (i.e., static objects) and virtual characters (i.e., dynamic objects), this paper illustrates the animation effects of thousands of bows and arrows being launched from a launcher, rotating during free fall in the air, and rotating after colliding with the ground or virtual characters. Figure 11 This is the third schematic diagram of the animation effect of shooting thousands of arrows provided in the first embodiment of the present application.

[0237] like Figure 11 As shown, it includes a large number of bows and arrows, ground and virtual characters. Figure 11In the animation, some of the arrows are inserted into the ground, some are turned over on the ground, and some are inserted into the body of the virtual character. It should be noted that the dynamic images of the arrows rotating in the process of free fall in the air are not reflected in the animation. Figure 11 In the animation, the arrow is inserted into the ground and the dynamic images of different rotations within the preset image frames are not reflected in the Figure 11 In the animation, the arrow follows the avatar and rotates with it after it is inserted into the avatar's body. Figure 11 middle.

[0238] The following describes the animation effect realization device provided by the present invention. The animation effect realization device described below and the animation effect realization method described above can be referenced to each other.

[0239] Figure 12 This is a schematic diagram of the structure of the animation effect realization device provided in the second embodiment of this application. Figure 12 As shown, the animation effect realization device includes: an acquisition module 1201 , a first processing module 1202 , a determination module 1203 and a control module 1204 .

[0240] An acquisition module 1201 is configured to acquire a velocity vector of a target particle in a current image frame in response to the target particle flying in the air;

[0241] A first processing module 1202 is configured to determine initial rotation information by rotating a preset unit vector around the velocity vector;

[0242] a determination module 1203, configured to determine first rotation information according to the initial rotation information, the velocity vector, and a first random rotation angle of the target particle in a current image frame;

[0243] The control module 1204 is configured to control the target particle to rotate in the current image frame according to the first rotation information.

[0244] Optionally, the determining module 1203 is specifically configured to:

[0245] determining a random value for the target particle within a first value range;

[0246] determining a mapping relationship between the first numerical range and the second numerical range, and determining the mapping rotation angle corresponding to the random value as the relative rotation angle of the target particle according to the mapping relationship;

[0247] A first random rotation angle of the target particle in the current image frame is determined according to the relative rotation angle and a first preset rotation angle, wherein the first preset rotation angle is greater than the rotation angle within the second numerical range.

[0248] Optionally, the initial rotation information includes an initial rotation matrix;

[0249] The determining module 1203 is specifically configured to:

[0250] The initial rotation matrix uses the velocity vector as the rotation axis and rotates the first random rotation angle to obtain a first rotation matrix of the target particle in the current image frame.

[0251] Optionally, the control module 1204 is specifically configured to:

[0252] Converting the first rotation matrix into a quaternion expression to obtain a first quaternion;

[0253] The target particle is controlled to rotate in the current image frame according to the first quaternion.

[0254] Optionally, the device further includes a second processing module, wherein the second processing module is specifically configured to:

[0255] In response to the target particle colliding with the target obstacle, if the target obstacle is a static object, a target collision state corresponding to the target particle is acquired and a motion state of the target particle is controlled to conform to the target collision state.

[0256] Optionally, the collision state includes any one of the following: inserting the target obstacle from the collision point and rotating for a preset number of frames before stopping and falling onto the target collision object;

[0257] When the target collision state corresponding to the target particle is that the target particle is inserted into the target obstacle from the collision point and stops rotating after rotating for a preset number of frames, the second processing module is specifically configured to:

[0258] Acquiring first rotation information of the target particle in an image frame before the collision occurs;

[0259] determining second rotation information according to first rotation information of the target particle in an image frame before the collision occurs and a second random rotation angle of the target particle in a current image frame;

[0260] The target particle is controlled to rotate in the current image frame according to the second rotation information.

[0261] Optionally, the distribution state of the second random rotation angle within the preset number of frames includes at least any one of the following: linear distribution, nonlinear distribution and exponential distribution;

[0262] The second processing module is specifically configured to:

[0263] determining a target rotation axis according to first rotation information of the target particle in an image frame before the collision occurs;

[0264] The second rotation information of the target particle in the current image frame is determined according to the first rotation information of the target particle in the image frame before the collision occurs, the target rotation axis, and the second random rotation angle.

[0265] Optionally, the rotation information includes a quaternion;

[0266] The second processing module is specifically configured to:

[0267] Converting the quaternion of the target particle in the image frame before the collision into a rotation matrix expression to obtain a second rotation matrix and determining the target rotation axis according to the second rotation matrix;

[0268] A second quaternion of the target particle in the current image frame is determined according to the second rotation matrix, the target rotation axis, and the second random rotation angle.

[0269] Optionally, the method further includes a third processing module, wherein the third processing module is specifically configured to:

[0270] In response to a collision between the target particle and the target obstacle, if the target obstacle is a dynamic object, obtaining first rotation information of the target particle in an image frame before the collision occurs;

[0271] Determining a target key point from among the multiple key points according to a positional relationship between a location where the target obstacle collides and a plurality of key points distributed at different locations in the target obstacle;

[0272] Obtaining third rotation information of the target particle in the current image frame according to the rotation information of the target key point in the current image frame and the first rotation information of the target particle in the image frame before the collision occurs;

[0273] The target particle is controlled to rotate in the current image frame according to the third rotation information.

[0274] Optionally, the rotation information includes a quaternion;

[0275] The third processing module is specifically configured to:

[0276] The third quaternion of the target particle in the current image frame is determined by cross-multiplying the quaternion of the target key point in the current image frame by the quaternion of the target particle in the image frame before the collision occurs.

[0277] Optionally, the third processing module is specifically configured to:

[0278] Among the multiple key points distributed at different positions in the target obstacle, the key point closest to the position where the collision occurs with the target obstacle is determined as the target key point.

[0279] The animation effect realization device provided in this embodiment can be used to execute the technical solution of the above-mentioned animation effect realization method embodiment. Its realization principle and technical effects are similar and will not be described in detail in this embodiment.

[0280] Figure 13 A schematic diagram of the hardware structure of an electronic device provided in the third embodiment of the present application is shown in FIG. Figure 13 As shown, the electronic device 1300 of this embodiment includes: a processor 1301 and a memory 1302;

[0281] Memory 1302, for storing computer-executable instructions;

[0282] The processor 1301 is configured to execute computer-executable instructions stored in the memory to implement the various steps of the method for implementing the animation effect in the above embodiment. For details, please refer to the relevant description in the above method embodiment.

[0283] Optionally, the memory 1302 may be independent or integrated with the processor 1301 .

[0284] When the memory 1302 is independently provided, the electronic device further includes a bus 1303 for connecting the memory 1302 and the processor 1301 .

[0285] The fourth embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the solution provided by any embodiment of the animation effect implementation method executed by the above electronic device is implemented.

[0286] The fifth embodiment of the present application also provides a computer program product, which includes: a computer program, which is stored in a readable storage medium, and at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0287] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or module, which can be electrical, mechanical or other forms.

[0288] The above-mentioned integrated module implemented in the form of a software functional module can be stored in a computer-readable storage medium. The above-mentioned software functional module is stored in a storage medium and includes a number of instructions for causing an electronic device (which can be a personal computer, server, or network device, etc.) or a processor to perform some steps of the method described in various embodiments of the present application.

[0289] It should be understood that the processor described above may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), or application-specific integrated circuits (ASICs). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.

[0290] The memory may include a high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk.

[0291] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be classified into address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.

[0292] The storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0293] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0294] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for realizing an animation effect, characterized in that: The method comprises: In response to the target particle flying in the air, obtaining a velocity vector of the target particle in a current image frame; According to the rotation of the preset unit vector around the velocity vector, the initial rotation information is determined; the initial rotation information includes an initial rotation matrix; wherein the step of determining the initial rotation matrix includes: using the preset unit vector to cross-multiply the unit velocity vector to obtain a vector ; Cross-multiply the vector with the unit velocity vector , and get the vector ; The vector and the vector Normalize, according to the unit velocity vector, the normalized vector And the normalized vector , determine the initial rotation matrix; determining first rotation information according to the initial rotation information, the velocity vector, and a first random rotation angle of the target particle in a current image frame; The first random rotation angle of the target particle in the current image frame is obtained by the following steps: determining a random value for the target particle in a first value range; determining a mapping relationship between the first numerical range and the second numerical range, and determining the mapping rotation angle corresponding to the random value as the relative rotation angle of the target particle according to the mapping relationship; Determining a first random rotation angle of the target particle in the current image frame according to the relative rotation angle and a first preset rotation angle; The target particle is controlled to rotate in the current image frame according to the first rotation information.

2. The method according to claim 1, characterized in that The first preset rotation angle is greater than the rotation angle within the second value range.

3. The method according to claim 1, characterized in that The initial rotation information includes an initial rotation matrix; The determining of the first rotation information according to the initial rotation information, the velocity vector, and the first random rotation angle of the target particle in the current image frame includes: The initial rotation matrix uses the velocity vector as the rotation axis and rotates the first random rotation angle to obtain a first rotation matrix of the target particle in the current image frame.

4. The method according to claim 3, characterized in that The controlling the target particle to rotate in the current image frame according to the first rotation information includes: Converting the first rotation matrix into a quaternion expression to obtain a first quaternion; The target particle is controlled to rotate in the current image frame according to the first quaternion.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: In response to the target particle colliding with a target obstacle, if the target obstacle is a static object, a target collision state corresponding to the target particle is acquired and a motion state of the target particle is controlled to conform to the target collision state.

6. The method according to claim 5, characterized in that The collision state includes any one of the following: inserting into the target obstacle from the collision point and rotating for a preset number of frames before stopping and falling onto the target obstacle; When the target collision state corresponding to the target particle is that the target obstacle is inserted from the collision point and the target obstacle is stopped after rotating for a preset number of frames, controlling the motion state of the target particle to conform to the target collision state includes: Acquiring first rotation information of the target particle in an image frame before the collision occurs; determining second rotation information according to first rotation information of the target particle in an image frame before the collision occurs and a second random rotation angle of the target particle in a current image frame; The target particle is controlled to rotate in the current image frame according to the second rotation information.

7. The method according to claim 6, characterized in that The distribution state of the second random rotation angle within the preset number of frames includes at least any one of the following: linear distribution, nonlinear distribution and exponential distribution; The determining the second rotation information according to the first rotation information of the target particle in the image frame before the collision occurs and the second random rotation angle of the target particle in the current image frame includes: determining a target rotation axis according to first rotation information of the target particle in an image frame before the collision occurs; The second rotation information of the target particle in the current image frame is determined according to the first rotation information of the target particle in the image frame before the collision occurs, the target rotation axis, and the second random rotation angle.

8. The method according to claim 7, characterized in that The rotation information includes quaternion; The determining, based on the first rotation information of the target particle in the image frame before the collision occurs, the target rotation axis, and the second random rotation angle, the second rotation information of the target particle in the current image frame includes: Converting the quaternion of the target particle in the image frame before the collision into a rotation matrix expression to obtain a second rotation matrix and determining the target rotation axis according to the second rotation matrix; A second quaternion of the target particle in the current image frame is determined according to the second rotation matrix, the target rotation axis, and the second random rotation angle.

9. The method according to any one of claims 1 to 4, characterized in that The method further comprises: In response to a collision between the target particle and a target obstacle, if the target obstacle is a dynamic object, obtaining first rotation information of the target particle in an image frame before the collision occurs; Determining a target key point from among the multiple key points according to a positional relationship between a location where the target obstacle collides and a plurality of key points distributed at different locations in the target obstacle; Obtaining third rotation information of the target particle in the current image frame according to the rotation information of the target key point in the current image frame and the first rotation information of the target particle in the image frame before the collision occurs; The target particle is controlled to rotate in the current image frame according to the third rotation information.

10. The method according to claim 9, characterized in that The rotation information includes quaternion; The obtaining, based on the rotation information of the target key point in the current image frame and the first rotation information of the target particle in the image frame before the collision occurs, third rotation information of the target particle in the current image frame includes: The third quaternion of the target particle in the current image frame is determined by cross-multiplying the quaternion of the target key point in the current image frame by the quaternion of the target particle in the image frame before the collision occurs.

11. The method according to claim 10, characterized in that The determining of a target key point from among the multiple key points according to a positional relationship between a position where the target obstacle collides and multiple key points distributed at different positions in the target obstacle comprises: Among the multiple key points distributed at different positions in the target obstacle, the key point closest to the position where the collision occurs with the target obstacle is determined as the target key point.

12. An animation effect realization device, characterized in that: The device comprises: an acquisition module, configured to acquire a velocity vector of the target particle in a current image frame in response to the target particle flying in the air; The processing module is configured to determine initial rotation information according to a preset unit vector rotating around the velocity vector; the initial rotation information includes an initial rotation matrix; wherein the step of determining the initial rotation matrix includes: using the preset unit vector to cross-multiply the unit velocity vector to obtain a vector ; Cross-multiply the vector with the unit velocity vector , and get the vector ; The vector and the vector Normalize, according to the unit velocity vector, the normalized vector And the normalized vector , determine the initial rotation matrix; a determination module, configured to determine first rotation information based on the initial rotation information, the velocity vector, and a first random rotation angle of the target particle in the current image frame; the first random rotation angle of the target particle in the current image frame is obtained by: determining a random value for the target particle within a first value range; determining a mapping relationship between the first numerical range and the second numerical range, and determining the mapping rotation angle corresponding to the random value as the relative rotation angle of the target particle according to the mapping relationship; Determining a first random rotation angle of the target particle in the current image frame according to the relative rotation angle and a first preset rotation angle; A control module is configured to control the target particle to rotate in the current image frame according to the first rotation information.

13. An electronic device, characterized in that: The electronic device comprises: processor; and The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the animation effect realization method according to any one of claims 1 to 11 is executed.

14. A computer-readable storage medium, characterized in that A data processing program is stored, and the program is run by a processor to execute the animation effect realization method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Particle swarm rotation video production method and medium

    CN111741332A