Biological cluster animation generation method and device and electronic equipment

By setting the target position of attracting particle objects and introducing a leader particle mechanism, combined with the K-means clustering algorithm and multi-path following strategy, the movement rules of biological groups are optimized, solving the problems of multiple behavioral states and environmental adaptability in the simulation of biological groups in existing technologies, and realizing natural group movement and efficient computation.

CN121170091APending Publication Date: 2025-12-19NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511031570.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-24
Publication Date
2025-12-19

AI Technical Summary

Technical Problem

Existing technologies cannot represent multiple behavioral states when simulating biological swarms with multiple behavioral states. They lack leadership particle mechanisms, directional path guidance, weak following ability, low efficiency of large-scale real-time computing, poor terrain adaptability, and cannot effectively distinguish between aquatic and terrestrial environments, resulting in unrealistic biological behavior.

Method used

By setting the target position for attracting particle objects, increasing the movement behavior state of particle objects towards the attraction point, introducing a leader particle mechanism, rendering the model vertex data of individual organisms in real time, and combining the K-means clustering algorithm and multi-path following strategy, the movement rules and environmental interactions of the particle swarm are optimized to realize the behavior of the biological group moving closer to the target position.

Benefits of technology

It realizes the natural group movement of biological populations, solves the problems of chaotic movement and environmental adaptability in the traditional Boids algorithm under multiple behavioral states, and improves the computational efficiency and the realism of biological behavior.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121170091A_ABST
    Figure CN121170091A_ABST
Patent Text Reader

Abstract

The invention provides a biological cluster animation generation method and apparatus, and an electronic device. The method comprises the steps of generating a particle cluster moving in a virtual scene according to a preset motion rule based on a particle system; the particle swarm comprises a plurality of particle objects; for each particle object, determining a target position for attracting the current particle object, if the distance between the current position of the current particle object and the target position meets a preset condition, determining the target speed of the current particle object according to a preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase the target speed; and rendering the particle object in real time according to the pre-made model vertex data of the biological individual, and generating a biological cluster animation of the biological virtual cluster. In the mode, the target position for attracting the particle object is set, and the behavior state of the particle object moving towards the attraction point is increased, so that the biological population has the behavior of approaching the target position, and population movement close to nature is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of animation processing, and in particular to a biological colony animation generation method and device and electronic equipment. BACKGROUND

[0002] In the field of computer graphics, animation production and game development, simulating group behavior is an important technology to simulate the natural behavior of groups such as bird flocks, fish flocks and animal flocks. In the prior art, based on the bionic particle system simulation technology, a technology for simulating the collective behavior of a large number of particles (such as stars, dust, water droplets, etc.). However, this method is only suitable for biological colonies with a single motion state, such as fish flocks, butterfly flocks and bee flocks, and cannot display multiple behavior states for biological colonies with multiple behavior states. SUMMARY

[0003] Therefore, the purpose of the present disclosure is to provide a biological colony animation generation method, device and electronic equipment, by setting a target position of an attractive particle object, increasing the behavior state of the movement of the particle object to the attractive point, so that the biological group has the behavior of approaching the target position, and realizing the natural group motion.

[0004] In a first aspect, the present disclosure provides a biological colony animation generation method, which comprises: in response to an animation generation instruction, generating a particle colony moving in a virtual scene according to a preset motion rule based on a particle system; wherein the particle colony includes a plurality of particle objects, the particle colony corresponds to a biological virtual colony, and the biological virtual colony includes a plurality of biological individuals; for each particle object, determining a target position attracting the current particle object, if the distance between the current position of the current particle object and the target position satisfies a preset condition, determining the target speed of the current particle object according to the preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase the target speed; rendering the particle object in real time according to the model vertex data of the biological individual prepared in advance, and generating a biological colony animation of the biological virtual colony.

[0005] In a second aspect, the embodiments of the present disclosure provide a device for generating biological group animation, which comprises: a particle group generation module configured to generate, in response to an animation generation instruction, a particle group moving in a virtual scene according to a preset motion rule based on a particle system; wherein the particle group comprises a plurality of particle objects, and the particle group corresponds to a biological virtual group comprising a plurality of biological individuals; a particle object control module configured to determine, for each particle object, a target position attracting the current particle object, and if a distance between a current position of the current particle object and the target position satisfies a preset condition, determine a target speed of the current particle object according to a preset parameter corresponding to the target position, and control a current moving speed of the current particle object to increase the target speed; and a group animation generation module configured to generate a biological group animation of the biological virtual group by rendering the particle objects in real time according to model vertex data of the biological individuals prepared in advance.

[0006] In a third aspect, the embodiments of the present disclosure provide an electronic device comprising a processor and a memory, wherein the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the biological group animation generation method of any one of the first aspect.

[0007] In a fourth aspect, the embodiments of the present disclosure provide a computer readable storage medium storing computer executable instructions, and when the computer executable instructions are invoked and executed by a processor, the computer executable instructions cause the processor to implement the biological group animation generation method of any one of the first aspect.

[0008] The embodiments of the present disclosure have the following beneficial effects:

[0009] The present disclosure provides a biological group animation generation method, device and electronic device, which generates, in response to an animation generation instruction, a particle group moving in a virtual scene according to a preset motion rule based on a particle system; wherein the particle group comprises a plurality of particle objects, and the particle group corresponds to a biological virtual group comprising a plurality of biological individuals; for each particle object, a target position attracting the current particle object is determined, and if a distance between a current position of the current particle object and the target position satisfies a preset condition, a target speed of the current particle object is determined according to a preset parameter corresponding to the target position, and a current moving speed of the current particle object is controlled to increase the target speed; and a biological group animation of the biological virtual group is generated by rendering the particle objects in real time according to model vertex data of the biological individuals prepared in advance. In this way, by setting the target position attracting the particle object, the behavior state of the particle object moving towards the attracting point is increased, so that the biological group has the behavior of approaching the target position, and natural group motion is achieved.

[0010] Additional features and advantages of the present disclosure will be set forth in the description that follows, and in part will be apparent from the description, or can be learned by practice of the present disclosure. The objectives and other advantages of the present disclosure will be realized and attained by the structure particularly pointed out in the description and claims, along with the appended drawings.

[0011] To make the above objectives, features and advantages of the present disclosure more obvious and easy to understand, the following preferred embodiments are specifically described below, and the accompanying drawings are described in detail. BRIEF DESCRIPTION OF DRAWINGS

[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or prior art description. Obviously, the drawings described below are some embodiments of the present disclosure, and other drawings can also be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0013] Figure 1 A flowchart of a biological colony animation generation method provided by an embodiment of the present disclosure;

[0014] Figure 2 A flowchart of group behavior in a biological colony animation generation method provided by an embodiment of the present disclosure;

[0015] Figure 3 A flowchart of path following in a biological colony animation generation method provided by an embodiment of the present disclosure;

[0016] Figure 4 A flowchart of terrain constraint in a biological colony animation generation method provided by an embodiment of the present disclosure;

[0017] Figure 5 A device diagram of terrain constraint in a biological colony animation generation method provided by an embodiment of the present disclosure;

[0018] Figure 6 An interaction diagram of an attractive force system in a biological colony animation generation method provided by an embodiment of the present disclosure;

[0019] Figure 7 A device diagram of an attractive force system in a biological colony animation generation method provided by an embodiment of the present disclosure;

[0020] Figure 8 A flowchart of repulsive force behavior in a biological colony animation generation method provided by an embodiment of the present disclosure;

[0021] Figure 9 A Boids system core device diagram in a biological colony animation generation method provided by an embodiment of the present disclosure;

[0022] Figure 10 A structural schematic diagram of a biological colony animation generation device provided by an embodiment of the present disclosure is shown in FIG. 1.

[0023] Figure 11 A structural schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown in FIG. 2. DETAILED DESCRIPTION

[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions of the present disclosure will be described below in connection with the drawings, obviously, the described embodiments are some but not all of the embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present disclosure.

[0025] In modern computer graphics and animation production, simulating group behavior is an important technology. Boids model is a bionic particle system simulation technology proposed by Craig Reynolds in 1987, mainly used to simulate the natural behavior of groups such as bird flocks, fish schools, and animal herds. This technology has been widely used in game development, film production, and virtual reality fields. However, with the increasing demand for animation realism and complexity, the traditional Boids algorithm has problems such as lack of leader particle mechanism, directional guidance path, weak following ability, low efficiency of large-scale real-time calculation, poor terrain adaptability, and limited application requirements.

[0026] Specifically, the existing Boids clustering technology has many defects. First, it is deficient in precise motion and cannot achieve the effect of the abdomen of a crab sticking to the ground when it is crawling. The current model cannot achieve this.

[0027] The current technology also lacks hierarchical group behavior, and the group has no leader individual, resulting in chaotic motion and ineffective simulation of interactions between organisms, especially the lack of a mechanism for leader particles. When simulating terrestrial organisms, the traditional model cannot effectively handle ground collisions, resulting in "floating" or model penetration phenomena for organisms such as ants and crabs.

[0028] In addition, the existing technology cannot effectively distinguish between aquatic and terrestrial environments, resulting in marine organisms crossing land and coastlines in the simulation, which obviously violates the laws of physics, such as fish "swimming onto" the beach, which obviously violates the laws of physics. The authenticity of environmental interaction needs to be improved. The current solution only achieves this through simple speed correction, lacking consideration of physical authenticity.

[0029] The prior art has weak interaction, cannot respond to multi-source interaction (mouse / player / camera), and has poor adaptability to the environment, and fails to dynamically respond to factors such as wind and resistance, thereby affecting the performance of the organisms in different environments. The particle death mechanism lacks smooth transition. At the same time, due to the limitation of the single-thread architecture, the current technology has low computational efficiency and a sharp decline in performance when processing large-scale particle group interaction, and is difficult to meet the complex computing demand. Especially when a large number of particles are processed, the computing demand grows rapidly, resulting in a very high CPU load and forming a performance bottleneck.

[0030] In addition, the movement of the particles along the fixed path lacks naturalness, the preset path is difficult to dynamically respond to environmental changes (such as the need to re-bake the path when birds avoid obstacles), and lacks adaptability to diversified scenes, and it is difficult to simultaneously process different physical environments such as water, land, and air (such as the need to independently develop fish groups and bird groups). When simulating a large number of particles, the load separation of rule calculation and collision detection is not realized, further limiting the performance. Based on this, the disclosed embodiment provides a method, device and electronic equipment for generating a biological cluster animation, which can be applied to the fields of game development and animation production.

[0031] To facilitate the understanding of the present embodiment, first, a method for generating a biological cluster animation disclosed by the present embodiment is described in detail, as shown in Figure 1 The method comprises the following steps:

[0032] Step S102, in response to an animation generation instruction, generating a particle group set moving in a virtual scene according to a preset motion rule based on a particle system; wherein the particle group set comprises a plurality of particle objects, the particle group set corresponds to a biological virtual group, and the biological virtual group comprises a plurality of biological individuals;

[0033] The execution subject of the method can be a computer, a server, a processor, or the like. The biological group can be a terrestrial organism (such as a human), an air organism (such as a bird), a marine organism (such as a dolphin or a whale), an amphibian (such as a crab), and the like, which is not limited herein.

[0034] Optionally, the animation generation instruction can be generated by acting on an animation generation control. In response to the animation generation instruction, a preset motion rule can be determined. The preset motion rule at least includes the emission parameters of the particle objects (such as the emission rate, the life cycle of the particles, the initial speed, etc.), the motion rule, the update rule (such as the updated position and speed of the particle objects), and the like.

[0035] First, initialize the particle system (Boids particle system), first create a Boids particle emitter instance object, inherit the grid particle emitter base class, obtain the Boids type configuration data (TypeDataElement), find the master emitter instance (MasterEmitter) through the main particle system and establish the association, call the base class initialization method to complete the basic particle system construction, and dynamically adjust the data container capacity according to the emitter attribute: specifically, read the maximum particle number attribute (GetMaxParticles), obtain the "MaxParticleScale" parameter value to adjust the actual capacity, and initialize the Boids special data storage area (mBoidsParticlesData).

[0036] Optionally, when creating a BoidsParticleEmitterInstance object, a conditional judgment can be added, for example: dynamically judge the distance between the virtual character controlled by the player and the particle to be less than a certain threshold, and then create it, and if it is greater than the threshold, it will not be created. Optionally, time period control can also be added, for example, simulate fireflies and create them within 21:05.

[0037] Step S104, for each particle object, determine the target position attracting the current particle object, if the distance between the current position of the current particle object and the target position satisfies the preset condition, determine the target speed of the current particle object according to the preset parameter corresponding to the target position, and control the current moving speed of the current particle object to increase the target speed;

[0038] Optionally, the target position includes at least one or more of the following: a central attractive position, a current position of a target particle object in a plurality of particle objects, and a target path point position in a path currently occupied by the current particle object.

[0039] If the emitter is a global coordinate system (non-Local), the central attractive position is the origin (0, 0, 0) of the world coordinate system or the world position, i.e. world.GetTranslation()). If the emitter is a local coordinate system (Local), the central attractive position is the position of the emitter itself (in the local coordinate system, the position of the emitter itself is the origin, i.e. (0, 0, 0)).

[0040] The above-mentioned target particle object usually refers to a leader particle object. By establishing a leader particle mechanism, ordinary particles can effectively follow the movement of the leader particle, thereby improving the authenticity and controllability of group behavior. This method solves the problem existing in traditional particle swarm simulation, that is, the group behavior often lacks the guidance of leader individuals, resulting in the lack of directionality of group movement. In addition, each path point also has an attractive force.

[0041] Different target positions correspond to different preset conditions. Optionally, if the distance between the current particle object and the target position is outside the preset range corresponding to the target position, the target speed of the current particle object is determined according to the preset parameter corresponding to the target position, and the current moving speed of the current particle object is controlled to increase the target speed. The preset parameters usually include the attraction force action radius, the attraction force strength, and the strength scaling coefficient corresponding to the target position. For example, the target speed of the current particle object is determined according to the distance between the current particle object and the target position and the preset parameters.

[0042] In step S106, the particle objects are rendered in real time according to the model vertex data of the biological individuals prepared in advance, and the biological group animation of the biological virtual group is generated.

[0043] The rendering operation is also performed while steps S102 and S104 are executed, and the corresponding biological group animation is generated in real time.

[0044] The embodiment of the present disclosure provides a biological group animation generation method. In response to an animation generation instruction, a particle group is generated based on a particle system to move in a virtual scene according to a preset motion rule. The particle group includes a plurality of particle objects, the particle group corresponds to a biological virtual group, and the biological virtual group includes a plurality of biological individuals. For each particle object, a target position attracting the current particle object is determined. If the distance between the current position of the current particle object and the target position meets a preset condition, the target speed of the current particle object is determined according to a preset parameter corresponding to the target position, and the current moving speed of the current particle object is controlled to increase the target speed. The particle objects are rendered in real time according to the model vertex data of the biological individuals prepared in advance, and the biological group animation of the biological virtual group is generated. In this way, by setting the target position attracting the particle object, the behavior state of the movement of the particle object to the attraction point is increased, so that the biological group has the behavior of approaching the target position, and the natural group motion is realized.

[0045] The above-mentioned step of determining the target position attracting the current particle object, if the distance between the current position of the current particle object and the target position meets a preset condition, determining the target speed of the current particle object according to a preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase the target speed, one possible implementation manner is as follows:

[0046] (1) The central attraction position is determined as the target position attracting the current particle object, and a first attraction parameter of the central attraction position is obtained. The first attraction parameter includes a first attraction force strength, a first attraction force action radius, and a first scaling coefficient.

[0047] The first attraction strength is obtained by the following manner: attractionAmt = boidsData->AttractionAmt, which means that the basic attraction strength value is obtained from the Boids type data, and the force (the greater the value, the faster the movement) of the control particle object moving to the center point (target position, i.e., the center attraction position) is controlled. The first attraction action radius is obtained by the following manner: attractionRadius = boidsData->AttractionRadius, which means that the basic attraction effective action radius is obtained from the Boids type data, and the attraction force takes effect only when the distance between the particle object and the center attraction position exceeds the radius.

[0048] (2) If the distance between the current position of the current particle object and the center attraction position is greater than the product of the first attraction action radius and the first scaling coefficient, a first difference value between the center attraction position and the current position of the current particle object is calculated.

[0049] (3) The first difference value and the product of the first attraction strength and the first scaling coefficient are determined as the first target speed of the current particle object, and the current moving speed of the current particle object is controlled to increase by the first target speed.

[0050] The first attraction strength and the first attraction action radius are dynamic parameters; the method further comprises: obtaining the current first attraction strength and the current first attraction action radius, and replacing the first attraction strength and the first attraction action radius with the changed first attraction strength and the changed first attraction action radius if the first attraction strength and the first attraction action radius change.

[0051] The runtime parameters "BoidsAttractionAmt" and "BoidsAttractionRadius" (i.e., the first attraction strength and the first attraction action radius) are obtained by the _GetParameter_on_ot() interface, and the basic value is covered if there is a dynamic parameter (i.e., if the first attraction strength and the first attraction action radius are different from the initial value, the initial value is updated to the newly obtained value).

[0052] The plurality of particle objects comprises at least one first particle object and a plurality of second particle objects; and the first particle object is a leader particle object.

[0053] The step of determining the target position attracting the current particle object, if the distance between the current position of the current particle object and the target position meets a preset condition, determining the target speed of the current particle object according to the preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase by the target speed, in a possible implementation manner:

[0054] (2) determining a target particle object closest to the current particle object from at least one first particle object, and determining an object position of the target particle object as a target position attracting the current particle object;

[0055] Generally, it is first detected whether a main emitter instance (mMasterEmitterInstance) exists, and if it exists, it is continued, and if it does not exist, it is skipped. The particle container of the main emitter is obtained, and it is checked whether it is non-empty. It is checked whether the coordinate system attributes of the main emitter and the current emitter are unified (must be the same local coordinate system or global coordinate system), and if they are not unified, an error is reported (in the editing mode).

[0056] All particle objects of the main emitter are traversed to find the object position of the chief particle object closest to the current particle object.

[0057] (2) obtaining a second attraction parameter set in advance for the target particle object; wherein the second attraction parameter includes a second attraction force strength, a second attraction force action radius, and a second scaling coefficient;

[0058] (3) if the distance between the current position of the current particle object and the object position of the target particle object is greater than the product of the second attraction force action radius and the second scaling coefficient, calculating a second difference value between the object position of the target particle object and the current position of the current particle object; determining a second target speed of the current particle object as the product of the second difference value, the second attraction force strength, and the second scaling coefficient, and controlling the current moving speed of the current particle object to increase by the second target speed.

[0059] The above step of determining the target position attracting the current particle object, if the distance between the current position of the current particle object and the target position satisfies a preset condition, determining a target speed of the current particle object according to a preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase by the target speed, one possible implementation manner:

[0060] (1) determining a target path type in which the current particle object currently locates; the path type includes a first path type, a second path type, and a third path type, different path types correspond to different paths, the path has a plurality of path points, and the plurality of path points have an arrangement order;

[0061] The first path type is an EnterPath corresponding to a first path point list (mBoidsPathPointsEnter), the second path type is a NormalPath corresponding to a second path point list (mBoidsPathPoints), and the third path is a LeavePath corresponding to a third path point list (mBoidsPathPointsLeave).

[0062] (2) determining a target path corresponding to the target path type, and a target path point position in the target path, and determining the target path point position as the target position;

[0063] obtaining a current target path point index (stored in the z component of the particle parameter) of the current particle object, and obtaining the position of the target path point.

[0064] Optionally, the position of the target path point is controlled to add a random offset. A path point that will be reached next by the current particle object is determined as the target path point.

[0065] (3) obtaining a third attraction force parameter pre-configured for the position of the target path point; wherein the third attraction force parameter includes a third attraction force action radius and a third scaling coefficient;

[0066] (4) calculating a direction vector of the current particle object to the position of the target path point, and a distance between the current particle object and the position of the target path point; determining a product of a difference between the direction vector and the distance and the third scaling coefficient as a third target speed of the current particle object, and controlling the current moving speed of the current particle object to increase by the third target speed.

[0067] In the step of determining the target path point position in the target path, a possible implementation is: determining whether the current particle object reaches a first path point closest to the current particle object in the next frame; or determining whether a distance between the current position of the current particle object and the position of the first path point is less than a product of the third attraction force action radius and the third scaling coefficient; if yes, determining the target path point according to the position of the first path point in the target path; if no, determining the first path point as the target path point.

[0068] Optionally, the path type has a specified arrangement order; in the step of determining the target path point according to the position of the first path point in the target path, a possible implementation is:

[0069] if the first path point is not the last path point in the plurality of path points, determining a path point adjacent to and after the first path point as the target path point;

[0070] if the first path point is the last path point in the plurality of path points, and the target path has a loop attribute, determining a first path point in the plurality of path points as the target path point;

[0071] If the first path point is the last path point in the plurality of path points, and the target path does not have a loop attribute, in the specified arrangement order, a first path corresponding to a first path type arranged after the target path type is determined, and a first path point in the first path is determined as the target path point.

[0072] Specifically, if the path type is NormalPath and the path is looped (mBoidsPathLoop is true), the index is looped (modulo); otherwise, the index is incremented by 1. The path points are re-assigned when the path switches (e.g., from EnterPath to NormalPath, or from NormalPath to LeavePath).

[0073] In the above manner, the control of each particle object enables the completion of the flocking motion, so that the particle object does not deviate from the flock, does not deviate from the fixed motion path, and can follow the leader particle motion.

[0074] The above method further includes: for each particle object, controlling the current particle object to move on the corresponding path in the order of the first path type, the second path type, and the third path type.

[0075] Generally, each particle object has a path type (BoidsPathPointType) attribute (stored in the particle-specific data structure) indicating the path phase (EnterPath, NormalPath, LeavePath) in which the current particle object is located. The system supports setting three types of path points: EnterPath, NormalPath, and LeavePath state machine model. The NormalPath can be set as a loop path (the particle returns to the starting point after reaching the end point) or a non-loop path. The EnterPath and LeavePath are both non-loop paths.

[0076] Check whether the path point set (mBoidsPathPointsEnter, mBoidsPathPoints, mBoidsPathPointsLeave) is empty, and if it exists, update the path point state (such as position, activation state) regularly through the CheckPathPointRefresh() function.

[0077] Iterate through all newly generated particles (mNewSpawnedParticles) and assign the path type attribute (EnterPath, NormalPath, LeavePath). By default, the EnterPath is preferentially assigned (if there is an EnterPath point), and if there is no EnterPath point, the NormalPath type is directly assigned.

[0078] When a particle is spawned or its path point is updated, it is assigned a path point strategy according to its path type and the current set of path points. There are two ways to assign the path point: FindNearestPathPoint or FindRandomPathPoint.

[0079] The method further includes, for each particle object, determining a current path point of the current particle object; generating a current offset according to a preset radius parameter of the current path point, and controlling a position of the current path point to offset according to the offset.

[0080] When a path point is assigned to a particle, a current path point index is assigned to the particle and stored in a z component of a particle parameter (MeshParticle::parameter(it).z). Meanwhile, a random path point offset (PathPointOffset) is generated for each particle and stored in a particle special data structure (BoidsSpecialData). The offset is within a radius of the path point and is used to disperse the particle around the path point to increase the naturalness of path following.

[0081] In addition, in a particle updating process, a direction vector of the particle to the current path point (plus the random offset) is calculated according to the path type and the current path point of the particle, and an attraction force to the path point is obtained by multiplying the direction vector by a path attraction strength (mBoidsPathAmt), and is superimposed on a speed of the particle to make the particle move to the path point.

[0082] The path switching logic and path smoothing optimization techniques are described as follows:

[0083] When a particle approaches a current path point (i.e., a distance between the particle and the path point is less than a radius of the path point, or a motion trajectory of the particle intersects with a sphere of the path point), a current path point index is incremented by 1. If the particle is on a normal path and is set to be cyclic, the index is taken modulo; otherwise, when the index exceeds a number of path points, the particle is switched according to a current path type of the particle:

[0084] If the particle is on an entry path and the index is equal to a number of entry path points, the particle is switched to a normal path and a start point (the nearest point) of the normal path is reassigned. If the particle is on the normal path and the system requires leaving (or hibernating) and the index is equal to a preset switching point (mBoidsPathNormalToLeaveIndex), the particle is switched to a leave path and the index is reset to 0. If the particle is on the leave path and the index is equal to a number of leave path points, the particle is marked as dead.

[0085] To optimize the path point reaching decision, we use the LineIntersectSphere function to avoid particles skipping path points due to high speed. This method can predict whether the particle will reach the path point in the next frame. If an intersection is detected, it will switch to the next path point in advance, thus achieving a smooth transition.

[0086] During path switching, when the particle switches from entering the path to the normal path, the nearest path point is recalculated as the starting point to ensure the continuity of movement. The starting point of the exit path is determined by the nearest point in the normal path to the first point of the exit path (mBoidsPathNormalToLeaveIndex) to maintain the smooth transition effect of the path.

[0087] The particle disappearance conditions are described as follows:

[0088] The end of the life cycle (life>1.0f). On the non-cyclic normal path and the index is equal to the number of normal path points (i.e. reaching the end of the normal path). On the exit path and the index is equal to the number of exit path points (i.e. reaching the end of the exit path). In the InternalKillParticles function, these conditions are checked and the death event is triggered (if any) and the particle is removed.

[0089] Through the above steps, the particle swarm can move according to the preset path and realize the complete life cycle of entering→normal movement→leaving, while the random offset and allocation strategy of path points increase the naturalness and diversity of particle movement.

[0090] The above method further includes: if the biological individual corresponding to the particle object is a terrestrial organism, in response to the particle object being located on a virtual ground, enabling an action force of the virtual ground and a gravity action force of the particle object to enable the particle object to move on the virtual ground; in response to the particle object being located on a virtual wall, disabling the action force of the virtual ground to enable the particle object to move on the virtual wall.

[0091] Specifically, the particle emitter coordinate system type is determined, and if it is a local coordinate system, the original position and zero vector normal are directly returned. The current physical space interface is obtained, and if the physical space does not exist, the terrain detection process is terminated. The vertical direction ray detection offset parameter is read, and if it is not configured, the default offset value (positive and negative 5 units in the vertical direction) is used. Based on the current position of the particle and the offset, the start point (current position plus vertical offset) and the end point (current position minus vertical offset) of the ray detection are calculated.

[0092] In the physical space, a ray is emitted, the range of the ray is from the starting point to the ending point, and a preset collision level filter is applied; when the ray collides with the terrain, the three-dimensional coordinates of the collision point are recorded as the modified position reference point, and the collision surface normal vector is recorded. Output the data pair containing the modified position and the normal vector.

[0093] The particle group basic terrain action enable state is obtained, the external input terrain action force enable parameter is read in real time, and when the parameter value is greater than 0.01, the terrain action force mechanism is activated. The collision level filter parameter input externally is read in real time, and the collision screening condition of the ray detection is dynamically updated.

[0094] The above method further comprises: for each particle object, determining an expected arrival position of the current particle object; adding a preset offset to the normal direction of the expected arrival position to obtain a target arrival position, and controlling the current particle object to move to the target arrival position.

[0095] Specifically, for the newly generated particle object, the terrain fitting position is modified in the following manner: the expected arrival position is calculated according to the current motion speed and the survival time, the actual reachable modified position reference point is obtained through terrain collision detection, the preset terrain fitting offset is superimposed in the vertical direction to generate the final modified position, and the particle position is forcibly set to the modified position.

[0096] Specifically, for the existing particle dynamics update: the expected displacement target position is calculated according to the current motion speed and the time step, the actual reachable modified position reference point and the normal are obtained through terrain collision detection, the preset terrain fitting offset is superimposed in the vertical direction to generate the final modified position, when the distance squared value of the modified position and the current position is less than one millionth, the particle is determined to be static and the speed is zero, otherwise, the position correction amount is divided by the time step as a new speed vector.

[0097] The above method further comprises: if the biological individual corresponding to the particle object is aquatic organism, in response to the particle object being higher than the virtual water surface, determining that the particle object is in the effective gravity interval; according to the effective gravity interval, determining the gravitational acceleration of the particle object in the effective gravity interval; controlling the moving speed of the particle object to increase the gravitational acceleration, so that the particle object moves in the effective gravity interval.

[0098] When EnableGravity=true and the particle is higher than the sea level, the normalized proportion coefficient of the current height of the particle in the effective gravity interval (minimum height to maximum height) is calculated, and the gravity acceleration vector is superimposed on the particle speed according to the proportion coefficient.

[0099] The method further comprises: determining a horizontal component of a normal vector of the underwater ground, superimposing a preset intensity on the horizontal component to obtain a force on the horizontal component; and superimposing the force on the horizontal component on a moving speed of the particle object to enable the particle object to move along the underwater ground.

[0100] When the EnableNormalForce is true and the height meets the requirement, a horizontal component of a terrain normal vector is extracted, and a force in a normal direction is superimposed on a particle speed according to a preset intensity.

[0101] In addition, the final calculated speed is updated to a particle motion state, and optionally, a particle group can be added with resistance, wind interaction, and the like to enable the influence of a wind level.

[0102] The embodiment realizes adaptive motion control of a particle group under terrain constraint, solves the problems of particle penetration and motion distortion in a complex environment, and solves the division of the regions of aquatic and terrestrial organisms through superposition of an environmental force field, thereby avoiding the running of aquatic organisms to a beach or land. The embodiment is suitable for group behavior simulation in the fields of games and simulation.

[0103] The method further comprises: determining a current clustering center of a particle group through a clustering algorithm; if a number of the current clustering centers is same as a number of last clustering centers, for each current clustering center, obtaining a target clustering center closest to the current clustering center from the historical clustering centers; performing linear interpolation on the current clustering center and the target clustering center to obtain an interpolation result, and updating the current clustering center to the interpolation result.

[0104] Optionally, an interpolation weight of the current clustering center is a first weight, and an interpolation weight of the target clustering center is a second weight; and the first weight is less than the second weight.

[0105] The method further comprises: deleting the target clustering center from the historical clustering centers.

[0106] Specifically, all particles in a particle container (`mParticleContainer`) are traversed, three-dimensional position coordinates (x, y, z) of each particle are obtained, and are stored in a position array (`positions`). If the position array is empty (i.e., no particles), a currently stored clustering center result (`mKmeansResult.clear()`) is emptied and the process is terminated. The current clustering center result (`mKmeansResult`) is saved to a historical clustering result (`mHistoryKmeansResult`) for subsequent use.

[0107] Call K-means clustering algorithm (specifically, dkm::kmeans_lloyd algorithm) to perform preliminary clustering on the position array. If the number of historical clustering centers matches the target k value, reuse the historical data; otherwise, use the K-means++ algorithm (`dkm::details::random_plusplus`) to initialize the center point.

[0108] Check if the number of historical clustering results (`mHistoryKmeansResult`) is equal to k. If equal, use the historical clustering results as the initial clustering center; otherwise, use a random initialization method (such as K-means++) to generate k initial clustering centers.

[0109] Perform the following iterative update of clustering center process:

[0110] According to the current clustering center, calculate the category to which each particle belongs (i.e. the nearest clustering center). Recalculate the clustering center according to each category (i.e. the geometric center of all particles in that category). Compare the new clustering center with the last clustering center and the last last clustering center. The specific comparison method is: if the new clustering center is the same as the last clustering center, or the same as the last last clustering center (to prevent oscillation between two solutions), stop iteration; otherwise, continue iteration until the maximum number of iterations is reached (the maximum number of iterations is not explicitly set in the code, but there is a counter `count`, which can be set to an upper limit in actual application to prevent infinite loop).

[0111] If the number of current clustering centers (i.e. k) is the same as the number of last clustering centers, perform smoothing processing on each new clustering center. Specifically, for each new clustering center, find the nearest one in the historical clustering center. Calculate the linear interpolation (Lerp) between the new clustering center and the nearest historical clustering center, with the new center accounting for 4% and the historical center accounting for 96%. The interpolated result is used as the new clustering center, and the historical center is removed from the historical clustering center list to ensure that each historical center is only used once.

[0112] Assign the smoothed clustering center (or unsmoothed clustering center) to the current clustering center result (`mKmeansResult`).

[0113] When the cluster center locations are needed externally, the `GetParticleKmeansPosition` function is called. First, the number of cluster centers is stored in the result array. Then, each cluster center is iterated over: if the particle emitter is set to local coordinates, the cluster center's position is converted to world coordinates using a transformation matrix (`mFullTransform`); otherwise, the local coordinates of the cluster center are used directly. The three-dimensional coordinates (x, y, z) of each cluster center are then stored sequentially in the result array.

[0114] This paper proposes an improved K-means clustering algorithm to calculate particle swarm centers. By introducing a historical data smoothing mechanism and a dynamic convergence strategy, combined with local / world coordinate transformation, it achieves efficient and stable particle swarm center calculation, solving the real-time and stability issues in particle swarm cluster center calculation. It is particularly suitable for real-time calculation of particle swarm cluster centers in particle systems, and for controlling particle behavior or visualization. In particle system simulation, traditional methods struggle to calculate the dynamic cluster centers of large-scale particle swarms in real time, leading to unrealistic simulations of swarm behavior.

[0115] The above method also includes: reducing the time step of the particle object in response to the particle object's movement speed meeting a preset speed threshold.

[0116] Specifically, the "BoidsEnableAdditionalTick" parameter value is read from the particle component. When the parameter value is >0.01, the additional update mode is enabled to perform segmented updates to avoid distortion during high-speed motion.

[0117] Read the time multiplier parameter (BoidsTickMultiple) and calculate the actual time increment: floatnewDeltaTime=dtime×tickMultiple, which means that the total update time required = frame time×multiplier. Divide the frame time into sub-intervals of dtime×tickMultiple and then call UpdateInterval() one by one.

[0118] By calling UpdateInterval multiple times to simulate smaller time steps, motion accuracy is improved.

[0119] while(newDeltaTime>0.0f){ / / Update one sub-step each time (not exceeding the original frame time)

[0120] float step=min(newDeltaTime,dtime);

[0121] UpdateInterval(world, step); / / Core update logic

[0122] newDeltaTime -= step;}.

[0123] The method further includes: if the frame time of the cluster animation meets a preset time threshold, performing a preset motion rule on the newly generated particle object.

[0124] Specifically, the time increment limit processing: dtime = dtime > MAX_FRAME_DELTA, MAX_FRAME_DELTA: dtime; if the frame time (dtime) exceeds the maximum allowed value (0.066666 seconds, about 15 frames per second), it is truncated to the maximum value. This is to avoid abnormal particle behavior (such as crossing collision bodies) due to low frame rate.

[0125] Clear the new particle cache (mNewSpawnedParticles.clear()). Execute the particle generation logic (SpawnElement->Execute()). Traverse the initialization element list and perform initialization operations (InitializeElements loop).

[0126] The method further includes: in response to generating a first interaction behavior at a target scene position in the virtual scene, determining an attractive force generated at the target scene position; determining a first influence range of the target scene position, and increasing the moving speed of a first particle object in the first influence range towards the target scene position.

[0127] The first interaction behavior can be a mouse interaction behavior, a camera interaction behavior, or an interaction behavior of a player-controlled virtual character. For example, clicking the target scene position with the mouse, or moving the virtual character to the target scene position.

[0128] The purpose of increasing the moving speed of the first particle object towards the target scene position is to enable the first particle object to quickly move to the target scene position to generate the attractive force of the target scene position on the first particle object.

[0129] Optionally, an intensity parameter is set for the first particle object, wherein the value of the intensity parameter is larger when the first particle object is closer to the target scene position, and the moving speed of the first particle object is multiplied by the intensity parameter. The intensity parameter will increase as the distance between the first particle object and the target scene position decreases. Alternatively, the intensity parameter will increase at a preset rate.

[0130] The method further includes: in response to the second interaction behavior being generated at the target scene position of the virtual scene, determining a repulsion force generated at the target scene position; determining a second influence range of the target scene position, and gradually increasing a target attribute value of a second particle object in the second influence range; and in response to the target attribute value being increased to a preset attribute threshold, increasing a moving speed of the second particle object in a direction opposite to the target scene position.

[0131] The step of increasing the moving speed of the second particle object in the direction opposite to the target scene position includes: determining an initial speed of the second particle object in the direction opposite to the target scene position; and gradually increasing a current speed of the second particle object by the initial speed, and gradually decreasing the initial speed.

[0132] Specifically, a fear value (FearPercent) of the second particle object is initialized as 0, and a fear growth speed and a random factor are set. When the second particle object is affected by the repulsion force (such as mouse repulsion or repulsion field), the fear value is increased at the set speed. When the fear value reaches 1.0, the particle starts to escape from the repulsion source (the speed direction is away from the repulsion source). The fear value is randomly attenuated every frame until it is 0.

[0133] The above method can enhance the authenticity of the group behavior.

[0134] The method further includes: if the particle object is marked as a disappearance identifier, controlling the particle object to continue to move according to the preset behavior rule; and in response to the particle object satisfying a target condition, deleting the particle object.

[0135] By calling the KillParticleByPercent function and setting soft=true, the particle is marked as soft death (SoftDie=true). In the particle update process, the particle marked as soft death is not immediately removed, but continues to participate in simulation until the disappearance condition (i.e., the target condition) is met (for example, the path end point is reached). In the InternalKillParticles function, when the particle is marked as soft death and the path end point is reached, a death event is triggered and the particle is removed.

[0136] The above method allows the particle to be marked and delayed to die, and is suitable for scenes that need smooth transition.

[0137] This scheme improves the efficiency of Boids simulations across various scenarios through a series of algorithmic optimizations, including multi-stage path planning, fusion simulation of gravity and ocean buoyancy, and multi-threaded computation optimization. Specifically, it first addresses the problem of accurate ground-hugging motion, enabling creatures like crabs to exhibit a natural belly-to-the-ground movement when crawling. Second, it proposes effective solutions to address physical violations of marine life crossing land, such as schools of fish "swimming" onto beaches. Furthermore, a leader particle mechanism is introduced to enhance the hierarchical structure of group behavior. By combining particle swarming with path planning, multi-stage path performance control, including entry, looping, and exit, is implemented, thereby enhancing the naturalness, expressiveness, and customizable performance of the swarm. This embodiment also incorporates multi-source interaction fusion and a multi-level attraction-repulsion system to improve the naturalness of swarm interactions, optimize environmental interactions, and avoid relying solely on simple velocity correction, thus enhancing physical realism. Finally, with the addition of a Tick mode, squared distance optimization, historical clustering smoothing, particle properties, and multi-threaded optimization, the performance of large-scale simulations is significantly improved. These innovations make particle swarm animations more realistic and efficient, meeting diverse scene requirements.

[0138] For example, such as Figure 2 The flowchart of the group behavior shown refers to the step of reducing the time step of the particle object in response to the particle object's movement speed meeting the preset speed threshold. The execution of UpdateInterval refers to the step of reducing the time step of the particle object in response to the particle object's movement speed meeting the preset speed threshold.

[0139] The concepts of center attraction, leader attraction, and path attraction refer to the following: for each particle object, determining the target position that attracts the current particle object; if the distance between the current position and the target position meets a preset condition; determining the target speed of the current particle object based on preset parameters corresponding to the target position; and controlling the current movement speed of the current particle object to increase the target speed. Terrain constraints refer to the following: if the biological entity corresponding to the particle object is a terrestrial organism, in response to the particle object being on virtual ground, activating the forces of the virtual ground and the particle object's gravity to allow the particle object to move on the virtual ground; and in response to the particle object being on a virtual wall, deactivating the forces of the virtual ground to allow the particle object to move on the virtual wall. If the biological entity corresponding to the particle object is an aquatic organism, in response to the particle object being above the virtual water surface, determining that the particle object is within an effective gravity range; determining the gravitational acceleration of the particle object within the effective gravity range based on the effective gravity range; and controlling the particle object's movement speed to increase the gravitational acceleration to allow the particle object to move within the effective gravity range. Environmental interaction refers to the first interaction behavior described above.

[0140] For example, such as Figure 3 The flowchart shown illustrates the intelligent path-following behavior of particle objects in particle swarm simulation. This approach addresses the technical problems of traditional particle systems, such as single-path behavior, mechanical actions, and low efficiency. It resolves the path-singularity issue of traditional particle systems, supports performance-level path orchestration, and enables complete lifecycle management of particle swarms from generation and motion to disappearance.

[0141] For example, such as Figure 4 The flowchart and terrain constraints shown Figure 5 The diagram shown illustrates a terrain-constrained device that enables adaptive motion control of particle swarms under terrain constraints. This solves the problems of particle clipping and motion distortion in complex environments. The superposition of environmental force fields resolves the regional division of aquatic and terrestrial organisms, preventing them from wandering onto the beach or land. This is suitable for simulating group behavior in games and simulations. For the first time, precise ground-hugging motion (such as crab crawling) and boundary control between aquatic and terrestrial media (preventing fish from "swimming" onto the beach) are achieved in a particle system, enhancing the realism of environmental interaction.

[0142] For example, such as Figure 6 The interaction diagram of the attraction system shown and Figure 7 The diagram of the attraction system shown demonstrates how the attraction system breaks through the single-group rule of the traditional Boids algorithm, achieving dynamic weight fusion of multi-source attraction (center point, leader particle, path point), thereby enhancing the controllability and naturalness of group behavior.

[0143] For example, such as Figure 8 The flowchart shown enhances the realism of biological behavior, enabling particles to escape from external threats and supporting a smooth disappearance effect.

[0144] For example, such as Figure 9 The diagram shows the core components of the Boids system: Particle Emitter Device: The core processing unit, containing particle instances and dedicated data structures. Leader Particle Device: Independently stores leader particle data, linked via pointers. Pathpoint Management Device: Maintains the three-stage pathpoint set and allocation strategy. Terrain Interaction Device: Handles terrain collision detection and separation of aquatic and terrestrial life. Dynamic Parameter Control Device: Provides a runtime parameter adjustment interface. Clustering Calculation Device: Calculates particle swarm cluster centers in real time and transforms the coordinate system.

[0145] The above approach significantly reduces the CPU's computational burden while maintaining animation quality. The customizability of the path planning module enhances the flexibility of the animation, enabling Boids motion to adapt to more complex environments and diverse scenes. In particular, it enhances the realism of natural scenes in ground-hugging processing, gravity, and terrain normal simulation. Furthermore, its adaptability to multi-media environments and multi-threading optimization make it possible to handle large-scale Boids clusters, thereby significantly improving computational efficiency and real-time performance.

[0146] The beneficial effects of this invention are as follows:

[0147] 1. Highly realistic group behavior simulation: By implementing basic rules such as separation, alignment, and aggregation, as well as extended mechanisms (such as leader following and path following), near-natural group movement is achieved. Random offset of path points and dual-mode assignment (nearest point or random point) effectively avoid the mechanization of particle behavior and enhance the vividness of group movement.

[0148] 2. Flexible and controllable dynamic adjustment: All key parameters (such as attraction intensity and radius of effect) can be adjusted externally in real time to adapt to the needs of different scenarios. Furthermore, the system supports multi-source interaction (such as mouse, player, etc.), providing rich control methods for games or simulations and enhancing the user experience.

[0149] 3. Performance Optimization: An additional Tick mechanism (EnableAdditionalTick) is introduced to effectively avoid distortion caused by high-speed motion, and system stability is ensured by limiting the maximum frame time. Neighbor detection uses squared distance comparison, significantly reducing the overhead of square root calculation. Simultaneously, historical data smoothing (96% historical centers and 4% new centers) is introduced through the K-means clustering algorithm, reducing inter-frame jumps and achieving smoother particle behavior.

[0150] 4. Complex environment adaptability: Terrain constraints are detected by ray detection and normal force simulation, effectively preventing particles from penetrating the model, and supporting water-land separation. In addition, automatic conversion between local and world coordinate systems enables the system to adapt to different spatial requirements, enhancing overall flexibility.

[0151] 5. Life cycle integrity: By designing a three-stage path (entry, regular, exit) and a soft death mechanism, smooth transitions from particle generation to disappearance are achieved, enhancing the coherence and naturalness of animation performance.

[0152] Corresponding to the method embodiments described above, the present disclosure provides a biological cluster animation generation device, as shown in Figure 10 The device comprises:

[0153] A particle cluster generation module 1001 is configured to, in response to an animation generation instruction, generate a particle cluster based on a particle system, wherein the particle cluster moves in a virtual scene according to a preset motion rule; the particle cluster comprises a plurality of particle objects, and the particle cluster corresponds to a biological virtual cluster, wherein the biological virtual cluster comprises a plurality of biological individuals.

[0154] A particle object control module 1002 is configured to, for each particle object, determine a target position attracting the current particle object, and if the distance between the current position of the current particle object and the target position satisfies a preset condition, determine a target speed of the current particle object according to a preset parameter corresponding to the target position, and control the current moving speed of the current particle object to increase the target speed.

[0155] A cluster animation generation module 1003 is configured to render the particle objects in real time according to the model vertex data of the biological individuals prepared in advance, and generate a biological cluster animation of the biological virtual cluster.

[0156] The embodiment of the present disclosure provides a biological cluster animation generation device, which generates a particle cluster moving in a virtual scene according to a preset motion rule in response to an animation generation instruction; wherein the particle cluster includes a plurality of particle objects, the particle cluster corresponds to a biological virtual cluster, and the biological virtual cluster includes a plurality of biological individuals; for each particle object, a target position attracting the current particle object is determined, if the distance between the current position of the current particle object and the target position satisfies a preset condition, the target speed of the current particle object is determined according to the preset parameter corresponding to the target position, and the current moving speed of the current particle object is controlled to increase the target speed; the particle object is rendered in real time according to the model vertex data of the biological individual prepared in advance, and the biological cluster animation of the biological virtual cluster is generated. In this way, by setting the target position attracting the particle object, the behavior state of the movement of the particle object to the attracting point is increased, so that the biological group has the behavior of approaching the target position, and the natural group motion is realized.

[0157] The target position includes at least one or more of the following: a central attracting position, a current position of a target particle object in the plurality of particle objects, and a target path point position in a path currently located by the current particle object.

[0158] The particle object control module is further configured to: determine the central attracting position as the target position attracting the current particle object, and acquire a first attracting parameter of the central attracting position; wherein the first attracting parameter includes a first attracting force intensity, a first attracting force action radius, and a first scaling coefficient; if the distance between the current position of the current particle object and the central attracting position is greater than the product of the first attracting force action radius and the first scaling coefficient, a first difference value between the central attracting position and the current position of the current particle object is calculated; the first target speed of the current particle object is determined by the first difference value and the product of the first attracting force intensity and the first scaling coefficient, and the current moving speed of the current particle object is controlled to increase the first target speed.

[0159] The first attracting force intensity and the first attracting force action radius are dynamic parameters; and the particle object control module is further configured to: acquire the current first attracting force intensity and the first attracting force action radius, and replace the first attracting force intensity and the first attracting force action radius with the first attracting force intensity and the first attracting force action radius after the change if the first attracting force intensity and the first attracting force action radius change.

[0160] The plurality of particle objects includes at least one first particle object and a plurality of second particle objects; the particle object control module is further configured to: from the at least one first particle object, determine a target particle object closest to the current particle object, and determine an object position of the target particle object as a target position attracting the current particle object; obtain a second attraction parameter of the target particle object set in advance; the second attraction parameter includes a second attraction force strength, a second attraction force action radius, and a second scaling coefficient; if a distance between the current position of the current particle object and the object position of the target particle object is greater than a product of the second attraction force action radius and the second scaling coefficient, calculate a second difference value between the object position of the target particle object and the current position of the current particle object; determine a second target speed of the current particle object by multiplying the second difference value, the second attraction force strength, and the second scaling coefficient, and control the current moving speed of the current particle object to increase the second target speed.

[0161] The particle object control module is further configured to: determine a target path type in which the current particle object is currently located; the path type includes a first path type, a second path type, and a third path type, different path types correspond to different paths, the path has a plurality of path points, and the plurality of path points have an arrangement order; determine a target path corresponding to the target path type and a target path point position in the target path, and determine the target path point position as a target position; obtain a third attraction force parameter of the target path point position configured in advance; the third attraction force parameter includes a third attraction force action radius and a third scaling coefficient; calculate a direction vector of the current particle object to the target path point position and a distance between the current particle object and the target path point position; determine a third target speed of the current particle object by multiplying a difference value between the direction vector and the distance and the third scaling coefficient, and control the current moving speed of the current particle object to increase the third target speed.

[0162] The particle object control module is further configured to: determine whether the current particle object reaches a first path point closest to the current particle object in a next frame; or determine whether a distance between the current position of the current particle object and the first path point position is less than a product of the third attraction force action radius and the third scaling coefficient; if yes, determine a target path point according to a position of the first path point in the target path; if no, determine the first path point as the target path point.

[0163] The path type has a specified arrangement order; the particle object control module is further configured to: if the first path point is not the last path point in the plurality of path points, determine a path point adjacent to and after the first path point as a target path point; if the target path point is the last path point in the plurality of path points and the target path has a loop attribute, determine the first path point in the plurality of path points as the target path point; if the target path point is the last path point in the plurality of path points and the target path does not have the loop attribute, determine, according to the specified arrangement order, a first path corresponding to a path type arranged after the target path type and a first path point in the first path, and determine the first path point as the target path point.

[0164] The particle object control module is further configured to: for each particle object, determine a current path point of the current particle object; generate a current offset according to a preset radius parameter of the current path point, and control a position of the current path point to offset according to the offset.

[0165] The particle object control module is further configured to: for each particle object, control the current particle object to move on the corresponding path in an order of the first path type, the second path type and the third path type.

[0166] The particle object control module is further configured to: if the biological individual corresponding to the particle object is a terrestrial organism, in response to the particle object being located on a virtual ground, turn on an action force of the virtual ground and a gravity action force of the particle object to enable the particle object to move on the virtual ground; and in response to the particle object being located on a virtual wall, turn off the action force of the virtual ground to enable the particle object to move on the virtual wall.

[0167] The particle object control module is further configured to: for each particle object, determine an expected arrival position of the current particle object; increase a preset offset in a normal direction of the expected arrival position to obtain a target arrival position, and control the current particle object to move to the target arrival position.

[0168] The particle object control module is further configured to: if the biological individual corresponding to the particle object is an aquatic organism, in response to the particle object being higher than a virtual water surface, determine an effective gravity interval of the particle object; determine a gravity acceleration of the particle object in the effective gravity interval according to the effective gravity interval; and control a moving speed of the particle object to increase the gravity acceleration to enable the particle object to move in the effective gravity interval.

[0169] The particle object control module is further configured to: determine a horizontal component of a normal vector of an underwater ground, superimpose a preset intensity on the horizontal component to obtain an action force on the horizontal component; and superimpose the action force on the horizontal component on a moving speed of the particle object to enable the particle object to move along the underwater ground.

[0170] The particle object control module is further configured to: determine current cluster centers of the particle clusters by a clustering algorithm; if a number of the current cluster centers is same as a number of last cluster centers, for each current cluster center, obtain a target cluster center closest to the current cluster center from the history cluster centers; and perform linear interpolation on the current cluster center and the target cluster center to obtain an interpolation result, and update the current cluster center to the interpolation result.

[0171] The interpolation weight of the current cluster center is a first weight, and the interpolation weight of the target cluster center is a second weight; and the first weight is less than the second weight.

[0172] The particle object control module is further configured to: delete the target cluster center from the history cluster centers.

[0173] The particle object control module is further configured to: in response to a moving speed of the particle object satisfying a preset speed threshold, reduce a time step of the particle object.

[0174] The particle object control module is further configured to: if a frame time of the cluster animation satisfies a preset time threshold, execute a preset motion rule for a newly generated particle object.

[0175] The particle object control module is further configured to: in response to a first interaction behavior being generated at a target scene position of the virtual scene, determine an attractive force generated at the target scene position; determine a first influence range of the target scene position, and increase a moving speed of a first particle object toward the target scene position for a first particle object in the first influence range.

[0176] The particle object control module is further configured to: in response to a second interaction behavior being generated at a target scene position of the virtual scene, determine a repulsive force generated at the target scene position; determine a second influence range of the target scene position, and gradually increase a target attribute value of a second particle object for a second particle object in the second influence range; and in response to the target attribute value increasing to a preset attribute threshold, increase a moving speed of the second particle object in a direction opposite to the target scene position.

[0177] The particle object control module is further configured to: determine an initial speed of the second particle object in the direction opposite to the target scene position; control a current speed of the second particle object to increase the initial speed, and gradually decrease the initial speed.

[0178] The particle object control module is further configured to: if the particle object is marked as a disappearance identifier, control the particle object to continue to move according to a preset behavior rule; and in response to the particle object satisfying a target condition, delete the particle object.

[0179] The biological cluster animation generation apparatus provided by the embodiments of the present disclosure has the same technical features as the biological cluster animation generation method provided by the above embodiments, and can solve the same technical problems and achieve the same technical effects.

[0180] The embodiments also provide an electronic device including a processor and a memory. The memory stores machine executable instructions capable of being executed by the processor. The processor executes the machine executable instructions to implement the biological cluster animation generation method. The electronic device can be a server or a terminal device.

[0181] Referring to Figure 11 The electronic device includes a processor 100 and a memory 101. The memory 101 stores machine executable instructions capable of being executed by the processor 100. The processor 100 executes the machine executable instructions to implement the biological cluster animation generation method.

[0182] Further, Figure 11 The electronic device also includes a bus 102 and a communication interface 103. The processor 100, the communication interface 103 and the memory 101 are connected through the bus 102.

[0183] The memory 101 can include a high-speed random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. The communication between the system network element and at least one other network element is realized through at least one communication interface 103 (which can be wired or wireless). The communication can be realized through the Internet, a wide area network, a local area network, a metropolitan area network, etc. The bus 102 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 11 Only one bidirectional arrow is used in the figure to represent the bus, but it does not mean that there is only one bus or only one type of bus.

[0184] The processor 100 can be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 100 or the instruction in the form of software. The processor 100 described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. Each method, step and logic block diagram disclosed in the embodiments of the present disclosure can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present disclosure can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register, etc. The storage medium in the art. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101, and combines the hardware to complete the steps of the method of the above embodiment.

[0185] The processor in the above electronic device can implement the following operations in the biological cluster animation generation method by executing machine executable instructions:

[0186] In response to an animation generation instruction, a particle cluster is generated based on a particle system according to a preset motion rule in a virtual scene; wherein the particle cluster includes a plurality of particle objects, the particle cluster corresponds to a biological virtual cluster, and the biological virtual cluster includes a plurality of biological individuals; for each particle object, a target position attracting the current particle object is determined, if the distance between the current position of the current particle object and the target position satisfies a preset condition, the target speed of the current particle object is determined according to the preset parameter corresponding to the target position, and the current moving speed of the current particle object is controlled to increase the target speed; the particle object is rendered in real time according to the model vertex data of the biological individual prepared in advance, and the biological cluster animation of the biological virtual cluster is generated. In this way, by setting the target position attracting the particle object, the behavior state of the particle object moving to the attracting point is increased, so that the biological group has the behavior of approaching the target position, and the natural group motion is realized.

[0187] The target position comprises at least one or more of the following: a central attraction position, a current position of a target particle object in the plurality of particle objects, and a target path point position in a current path of the current particle object.

[0188] The method further comprises: determining a target position attracting the current particle object, and determining a target speed of the current particle object according to a preset parameter corresponding to the target position if a distance between the current position of the current particle object and the target position meets a preset condition, and controlling the current moving speed of the current particle object to increase the target speed, wherein the target position comprises at least one or more of the following: a central attraction position, a current position of a target particle object in the plurality of particle objects, and a target path point position in a current path of the current particle object.

[0189] The first attraction force strength and the first attraction force action radius are dynamic parameters, and the method further comprises: obtaining the first attraction force strength and the first attraction force action radius, and replacing the first attraction force strength and the first attraction force action radius with changed first attraction force strength and first attraction force action radius if the first attraction force strength and the first attraction force action radius change.

[0190] The plurality of particle objects comprises at least one first particle object and a plurality of second particle objects, and the method further comprises: determining a target position attracting the current particle object, and determining a target speed of the current particle object according to a preset parameter corresponding to the target position if a distance between the current position of the current particle object and the target position meets a preset condition, and controlling the current moving speed of the current particle object to increase the target speed, wherein the target position comprises at least one or more of the following: a central attraction position, a current position of a target particle object in the plurality of particle objects, and a target path point position in a current path of the current particle object.

[0191] The step of determining the target position attracting the current particle object, determining the target speed of the current particle object according to the preset parameter corresponding to the target position if the distance between the current position of the current particle object and the target position meets the preset condition, and controlling the current moving speed of the current particle object to increase the target speed includes: determining the target path type in which the current particle object currently locates; the path type includes a first path type, a second path type and a third path type, different path types correspond to different paths, the path has a plurality of path points, and the plurality of path points have an arrangement order; determining the target path corresponding to the target path type and a target path point position in the target path, and determining the target path point position as the target position; obtaining a third attraction force parameter pre-configured for the target path point position; the third attraction force parameter includes a third attraction force action radius and a third scaling coefficient; calculating a direction vector from the current particle object to the target path point position and a distance between the current particle object and the target path point position; determining a product of a difference between the direction vector and the distance and the third scaling coefficient as a third target speed of the current particle object, and controlling the current moving speed of the current particle object to increase the third target speed.

[0192] The step of determining the target path point position in the target path includes: determining whether the current particle object reaches a first path point closest to the current particle object in the next frame; or determining whether the distance between the current position of the current particle object and the first path point position is less than the product of the third attraction force action radius and the third scaling coefficient; if yes, determining the target path point according to the position of the first path point in the target path; and if no, determining the first path point as the target path point.

[0193] The path type has a specified arrangement order; the step of determining the target path point according to the position of the first path point in the target path includes: if the first path point is not the last path point in the plurality of path points, determining a path point adjacent to and after the first path point as the target path point; if the target path point is the last path point in the plurality of path points and the target path has a loop attribute, determining the first path point in the plurality of path points as the target path point; if the target path point is the last path point in the plurality of path points and the target path does not have the loop attribute, determining a first path corresponding to a first path type arranged after the target path type according to the specified arrangement order and a first path point in the first path, and determining the first path point as the target path point.

[0194] The method further includes: for each particle object, determining a current path point of the current particle object; generating a current offset according to a preset radius parameter of the current path point, and controlling the position of the current path point to offset according to the offset.

[0195] The method further includes: for each particle object, controlling the current particle object to move on the corresponding path in the order of the first path type, the second path type and the third path type.

[0196] The method further includes: if the biological individual corresponding to the particle object is a terrestrial organism, in response to the particle object being located on a virtual ground, starting the action force of the virtual ground and the gravity action force of the particle object to enable the particle object to move on the virtual ground; in response to the particle object being located on a virtual wall, stopping the action force of the virtual ground to enable the particle object to move on the virtual wall.

[0197] The method further includes: for each particle object, determining an expected arrival position of the current particle object; increasing a preset offset in a normal direction of the expected arrival position to obtain a target arrival position, and controlling the current particle object to move to the target arrival position.

[0198] The method further includes: if the biological individual corresponding to the particle object is an aquatic organism, in response to the particle object being higher than a virtual water surface, determining an effective gravity interval of the particle object; determining a gravity acceleration of the particle object in the effective gravity interval according to the effective gravity interval; and controlling the moving speed of the particle object to increase the gravity acceleration to enable the particle object to move in the effective gravity interval.

[0199] The method further includes: determining a horizontal component of a normal vector of an underwater ground, superimposing a preset intensity on the horizontal component to obtain an action force on the horizontal component; and superimposing the action force on the horizontal component on the moving speed of the particle object to enable the particle object to move along the underwater ground.

[0200] The method further includes: determining a current cluster center of the particle cluster by a clustering algorithm; if the number of the current cluster center is the same as the number of the last cluster center, for each current cluster center, obtaining a target cluster center closest to the current cluster center from the historical cluster centers; performing linear interpolation on the current cluster center and the target cluster center to obtain an interpolation result, and updating the current cluster center to the interpolation result.

[0201] The interpolation weight of the current cluster center is a first weight, and the interpolation weight of the target cluster center is a second weight; wherein the first weight is less than the second weight.

[0202] The method further includes: deleting the target cluster center from the historical cluster centers.

[0203] The method further includes: in response to the moving speed of the particle object satisfying a preset speed threshold, reducing the time step of the particle object.

[0204] The method further includes: if the frame time of the cluster animation meets a preset time threshold, performing a preset motion rule on the newly generated particle object.

[0205] The method further includes: in response to the first interaction behavior being generated at the target scene position of the virtual scene, determining an attractive force generated at the target scene position; determining a first influence range of the target scene position, and increasing a moving speed of a first particle object in the first influence range towards the target scene position.

[0206] The method further includes: in response to the second interaction behavior being generated at the target scene position of the virtual scene, determining a repulsive force generated at the target scene position; determining a second influence range of the target scene position, and gradually increasing a target attribute value of a second particle object in the second influence range; and in response to the target attribute value being increased to a preset attribute threshold, increasing a moving speed of the second particle object in a direction opposite to the target scene position.

[0207] The step of increasing the moving speed of the second particle object in the direction opposite to the target scene position includes: determining an initial speed of the second particle object in the direction opposite to the target scene position; increasing a current speed of the second particle object by the initial speed, and gradually decreasing the initial speed.

[0208] The method further includes: if the particle object is marked with a disappearance identifier, controlling the particle object to continue to move according to the preset behavior rule; and in response to the particle object meeting a target condition, deleting the particle object.

[0209] The embodiment also provides a machine readable storage medium, which stores machine executable instructions. When the machine executable instructions are called and executed by a processor, the machine executable instructions cause the processor to implement the method for generating a biological cluster animation.

[0210] The machine executable instructions stored in the machine readable storage medium can implement the following operation in the method for generating a biological cluster animation by executing the machine executable instructions.

[0211] In response to the animation generation instruction, a particle cluster moving in the virtual scene according to preset motion rules is generated based on a particle system; wherein the particle cluster includes a plurality of particle objects, the particle cluster corresponds to a biological virtual cluster, and the biological virtual cluster includes a plurality of biological individuals; for each particle object, a target position attracting the current particle object is determined, if the distance between the current position of the current particle object and the target position satisfies a preset condition, the target speed of the current particle object is determined according to the preset parameter corresponding to the target position, and the current moving speed of the current particle object is controlled to increase the target speed; the particle object is rendered in real time according to the model vertex data of the biological individual prepared in advance, and the biological cluster animation of the biological virtual cluster is generated. In this way, by setting the target position attracting the particle object, the behavior state of the particle object moving to the attracting point is increased, so that the biological population has the behavior of approaching the target position, and the natural group motion is realized.

[0212] The target position includes at least one or more of the following: a central attracting position, a current position of a target particle object in the plurality of particle objects, and a target path point position in a path currently located by the current particle object.

[0213] The step of determining the target position attracting the current particle object, if the distance between the current position of the current particle object and the target position satisfies a preset condition, determining the target speed of the current particle object according to the preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase the target speed includes: determining the central attracting position as the target position attracting the current particle object, and obtaining a first attracting parameter of the central attracting position; wherein the first attracting parameter includes: a first attracting force intensity, a first attracting force action radius, and a first scaling coefficient; if the distance between the current position of the current particle object and the central attracting position is greater than the product of the first attracting force action radius and the first scaling coefficient, a first difference value between the central attracting position and the current position of the current particle object is calculated; the first target speed of the current particle object is determined by the first difference value and the product of the first attracting force intensity and the first scaling coefficient, and the current moving speed of the current particle object is controlled to increase the first target speed.

[0214] The first attracting force intensity and the first attracting force action radius are dynamic parameters; the method further includes: obtaining the current first attracting force intensity and the first attracting force action radius, and if the first attracting force intensity and the first attracting force action radius change, replacing the first attracting force intensity and the first attracting force action radius with the changed first attracting force intensity and the first attracting force action radius.

[0215] The plurality of particle objects include at least one first particle object and a plurality of second particle objects; a target position attracting the current particle object is determined, if the distance between the current position of the current particle object and the target position meets a preset condition, a target speed of the current particle object is determined according to a preset parameter corresponding to the target position, and the step of controlling the current moving speed of the current particle object to increase the target speed includes: determining a target particle object closest to the current particle object from the at least one first particle object, and determining the object position of the target particle object as the target position attracting the current particle object; obtaining a second attraction parameter of the target particle object; wherein the second attraction parameter includes: a second attraction force strength, a second attraction force action radius and a second scaling coefficient; if the distance between the current position of the current particle object and the object position of the target particle object is greater than the product of the second attraction force action radius and the second scaling coefficient, a second difference value between the object position of the target particle object and the current position of the current particle object is calculated; the second difference value and the product of the second attraction force strength and the second scaling coefficient are determined as a second target speed of the current particle object, and the current moving speed of the current particle object is controlled to increase the second target speed.

[0216] The step of determining the target position attracting the current particle object, if the distance between the current position of the current particle object and the target position meets a preset condition, determining the target speed of the current particle object according to a preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase the target speed includes: determining a target path type in which the current particle object currently locates; the path type includes: a first path type, a second path type and a third path type, different path types correspond to different paths, the path has a plurality of path points, and the plurality of path points have an arrangement order; a target path corresponding to the target path type and a target path point position in the target path are determined, and the target path point position is determined as the target position; a third attraction force parameter of the target path point position is obtained in advance; wherein the third attraction force parameter includes: a third attraction force action radius and a third scaling coefficient; a direction vector of the current particle object to the target path point position and the distance between the current particle object and the target path point position are calculated; the product of the difference between the direction vector and the distance and the third scaling coefficient is determined as a third target speed of the current particle object, and the current moving speed of the current particle object is controlled to increase the third target speed.

[0217] The step of determining the target path point position in the target path includes: determining whether the current particle object reaches a first path point closest to the current particle object in the next frame; or determining whether the distance between the current position of the current particle object and the first path point position is less than the product of the third attraction force action radius and the third scaling coefficient; if yes, a target path point is determined according to the position of the first path point in the target path; if no, the first path point is determined as the target path point.

[0218] The path type has a specified arrangement order; the step of determining the target path point according to the position of the first path point in the target path comprises: if the first path point is not the last path point in the plurality of path points, determining the path point adjacent to and after the first path point as the target path point; if the target path point is the last path point in the plurality of path points, and the target path has a loop attribute, determining the first path point in the plurality of path points as the target path point; if the target path point is the last path point in the plurality of path points, and the target path does not have a loop attribute, determining the first path corresponding to the first path type arranged after the target path type according to the specified arrangement order, and the first path point in the first path, and determining the first path point as the target path point.

[0219] The method further comprises: for each particle object, determining a current path point of the current particle object; generating a current offset according to a preset radius parameter of the current path point, and controlling the position of the current path point to offset according to the offset.

[0220] The method further comprises: for each particle object, controlling the current particle object to move on the corresponding path in the order of the first path type, the second path type and the third path type.

[0221] The method further comprises: if the biological individual corresponding to the particle object is a terrestrial organism, in response to the particle object being located on a virtual ground, starting the action force of the virtual ground and the gravity action force of the particle object, so that the particle object moves on the virtual ground; in response to the particle object being located on a virtual wall surface, closing the action force of the virtual ground, so that the particle object moves on the virtual wall surface.

[0222] The method further comprises: for each particle object, determining an expected arrival position of the current particle object; increasing a preset offset in the normal direction of the expected arrival position to obtain a target arrival position, and controlling the current particle object to move to the target arrival position.

[0223] The method further comprises: if the biological individual corresponding to the particle object is an aquatic organism, in response to the particle object being higher than a virtual water surface, determining an effective gravity interval of the particle object; determining a gravity acceleration of the particle object in the effective gravity interval according to the effective gravity interval; controlling the moving speed of the particle object to increase the gravity acceleration, so that the particle object moves in the effective gravity interval.

[0224] The method further comprises: determining a horizontal component of a normal vector of an underwater ground, superimposing a preset intensity on the horizontal component to obtain an action force on the horizontal component; superimposing the action force on the horizontal component on the moving speed of the particle object, so that the particle object moves along the underwater ground.

[0225] The method further includes: determining current cluster centers of the particle clusters by a clustering algorithm; if the number of the current cluster centers is the same as the number of last cluster centers, obtaining, for each current cluster center, a target cluster center closest to the current cluster center from the historical cluster centers; performing linear interpolation on the current cluster center and the target cluster center to obtain an interpolation result, and updating the current cluster center to the interpolation result.

[0226] The interpolation weight of the current cluster center is a first weight, and the interpolation weight of the target cluster center is a second weight; and the first weight is less than the second weight.

[0227] The method further includes: deleting the target cluster center from the historical cluster centers.

[0228] The method further includes: in response to the moving speed of the particle object satisfying a preset speed threshold, reducing the time step of the particle object.

[0229] The method further includes: if the frame time of the cluster animation satisfies a preset time threshold, performing a preset motion rule on the newly generated particle object.

[0230] The method further includes: in response to generating a first interaction behavior at a target scene position of the virtual scene, determining an attractive force generated at the target scene position; determining a first influence range of the target scene position, and increasing the moving speed of a first particle object in the first influence range towards the target scene position.

[0231] The method further includes: in response to generating a second interaction behavior at a target scene position of the virtual scene, determining a repulsive force generated at the target scene position; determining a second influence range of the target scene position, and gradually increasing a target attribute value of a second particle object in the second influence range; in response to the target attribute value increasing to a preset attribute threshold, increasing the moving speed of the second particle object in the opposite direction of the target scene position.

[0232] The step of increasing the moving speed of the second particle object in the opposite direction of the target scene position includes: determining an initial speed of the second particle object in the opposite direction of the target scene position; controlling the current speed of the second particle object to increase by the initial speed, and gradually reducing the initial speed.

[0233] The method further includes: if the particle object is marked as a disappearance identifier, controlling the particle object to continue to move according to a preset behavior rule; and in response to the particle object satisfying a target condition, deleting the particle object.

[0234] The computer program product of the biological colony animation generation method, device and system provided by the embodiment of the present disclosure includes a computer readable storage medium storing program codes, and the program codes include instructions for executing the method described in the foregoing method embodiments. For specific implementation, please refer to the method embodiments, which will not be described here.

[0235] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.

[0236] In addition, in the description of the embodiments of the present disclosure, unless otherwise explicitly specified and limited, the terms "mounting", "connection", "connecting" should be understood in a broad sense, for example, can be fixed connection, can also be detachable connection, or integral connection; can be mechanical connection, can also be electrical connection; can be direct connection, can also be indirect connection through an intermediate medium, can be internal communication of two elements. For those skilled in the art, the specific meaning of the above terms in the present disclosure can be understood according to the specific circumstances.

[0237] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present disclosure or the part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0238] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present disclosure. In addition, the terms "first", "second", "third" are only for descriptive purposes, and cannot be understood as indicating or implying relative importance.

[0239] Finally, it should be noted that the above examples are merely specific embodiments of the present disclosure, used to illustrate the technical solutions of the present disclosure, and are not intended to limit the present disclosure. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing examples, those skilled in the art should understand that any person skilled in the art can still make modifications or easily think of changes to the technical solutions recorded in the foregoing examples, or make equivalent replacements to some of the technical features, within the technical scope disclosed by the present disclosure. Such modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A method for generating animation of a biological cluster, characterized by, The method comprises: in response to an animation generation instruction, generating a particle cluster moving in a virtual scene according to a preset motion rule based on a particle system; wherein the particle cluster comprises a plurality of particle objects, the particle cluster corresponds to a biological virtual cluster, and the biological virtual cluster comprises a plurality of biological individuals; for each particle object, determining a target position attracting the current particle object, if the distance between the current position of the current particle object and the target position meets a preset condition, determining a target speed of the current particle object according to a preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase the target speed; real-time rendering the particle object according to the model vertex data of the biological individual prepared in advance to generate a biological cluster animation of the biological virtual cluster.

2. The method of claim 1, wherein, The target position comprises at least one or more of the following: a central attractive position, a current position of a target particle object in the plurality of particle objects, and a target path point position in a path currently located by the current particle object.

3. The method of claim 2, wherein, The step of determining a target position attracting the current particle object, if the distance between the current position of the current particle object and the target position meets a preset condition, determining a target speed of the current particle object according to a preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase the target speed, comprises: determining the central attractive position as the target position attracting the current particle object, and obtaining a first attraction parameter of the central attractive position; wherein the first attraction parameter comprises a first attraction force intensity, a first attraction force action radius, and a first scaling coefficient; if the distance between the current position of the current particle object and the central attractive position is greater than the product of the first attraction force action radius and the first scaling coefficient, calculating a first difference value between the central attractive position and the current position of the current particle object; determining a first target speed of the current particle object by multiplying the first difference value, the first attraction force intensity, and the first scaling coefficient, and controlling the current moving speed of the current particle object to increase the first target speed.

4. The method of claim 3, wherein, The first attraction force intensity and the first attraction force action radius are dynamic parameters; the method further comprises: obtaining the first attraction force intensity and the first attraction force action radius, and if the first attraction force intensity and the first attraction force action radius change, replacing the first attraction force intensity and the first attraction force action radius with the changed first attraction force intensity and the first attraction force action radius.

5. The method of claim 2, wherein, The plurality of particle objects comprises at least one first particle object and a plurality of second particle objects; The step of determining a target position attracting the current particle object, if the distance between the current position of the current particle object and the target position meets a preset condition, determining a target speed of the current particle object according to a preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase the target speed, comprises: determining a target particle object closest to the current particle object from the at least one first particle object, and determining an object position of the target particle object as a target position attracting the current particle object; obtaining a second attraction parameter of the target particle object, wherein the second attraction parameter comprises a second attraction strength, a second attraction action radius and a second scaling coefficient; if a distance between the current position of the current particle object and the object position of the target particle object is greater than a product of the second attraction action radius and the second scaling coefficient, calculating a second difference value between the object position of the target particle object and the current position of the current particle object; determining a second target speed of the current particle object by multiplying the second difference value with the product of the second attraction strength and the second scaling coefficient, and controlling the current moving speed of the current particle object to increase the second target speed.

6. The method of claim 2, wherein, The step of determining a target position attracting the current particle object, if a distance between the current position of the current particle object and the target position satisfies a preset condition, determining a target speed of the current particle object according to a preset parameter corresponding to the target position, and controlling the current moving speed of the current particle object to increase the target speed, comprises: determining a target path type in which the current particle object currently locates, wherein the path type comprises a first path type, a second path type and a third path type, different path types correspond to different paths, and the path has a plurality of path points, and the plurality of path points have an arrangement order; determining a target path corresponding to the target path type and a target path point position in the target path, and determining the target path point position as the target position; obtaining a third attraction parameter of the target path point position, wherein the third attraction parameter comprises a third attraction action radius and a third scaling coefficient; calculating a direction vector of the current particle object to the target path point position and a distance between the current particle object and the target path point position; determining a third target speed of the current particle object by multiplying a difference value between the direction vector and the distance with the third scaling coefficient, and controlling the current moving speed of the current particle object to increase the third target speed.

7. The method of claim 6, wherein, The step of determining the target path point position in the target path comprises: determining whether the current particle object reaches a first path point closest to the current particle object in a next frame or determining whether a distance between the current position of the current particle object and the first path point position is less than a product of the third attraction action radius and the third scaling coefficient; if yes, determining the target path point according to a position of the first path point in the target path; if no, determining the first path point as the target path point.

8. The method of claim 7, wherein, The path type has a specified arrangement order; The step of determining the target path point according to the position of the first path point in the target path comprises: if the first path point is not the last path point in the plurality of path points, determining a path point adjacent to the first path point and after the first path point as the target path point; if the target path point is the last path point in the plurality of path points, and the target path has a loop attribute, determining a first path point in a first path corresponding to a first path type arranged after the target path type in the specified arrangement order as the target path point; if the target path point is the last path point in the plurality of path points, and the target path does not have a loop attribute, determining a first path point in a first path corresponding to a first path type arranged after the target path type in the specified arrangement order as the target path point.

9. The method of claim 1, wherein, The method further comprises: determining a current path point of a current particle object for each particle object; generating the current offset according to a preset radius parameter of the current path point, and controlling the position of the current path point to offset by the offset.

10. The method of claim 1, wherein, The method further comprises: controlling the current particle object to move on the corresponding path in the order of the first path type, the second path type and the third path type for each particle object.

11. The method of claim 1, wherein, The method further comprises: if the biological individual corresponding to the particle object is a terrestrial organism, in response to the particle object being located on a virtual ground, starting the action force of the virtual ground and the gravity action force of the particle object to make the particle object move on the virtual ground; in response to the particle object being located on a virtual wall, closing the action force of the virtual ground to make the particle object move on the virtual wall.

12. The method of claim 11, wherein, The method further comprises: determining an expected arrival position of a current particle object for each particle object; increasing a preset offset in the normal direction of the expected arrival position to obtain a target arrival position, and controlling the current particle object to move to the target arrival position.

13. The method of claim 1, wherein, The method further comprises: if the biological individual corresponding to the particle object is an aquatic organism, in response to the particle object being higher than a virtual water surface, determining an effective gravity interval of the particle object; determining the gravitational acceleration of the particle object in the effective gravity interval according to the effective gravity interval; controlling the moving speed of the particle object to increase the gravitational acceleration to make the particle object move in the effective gravity interval.

14. The method of claim 13, wherein, The method further comprises: determining a horizontal component of a normal vector of an underwater ground, superimposing a preset intensity on the horizontal component to obtain an action force on the horizontal component; superimposing the action force on the horizontal component on the moving speed of the particle object to make the particle object move along the underwater ground.

15. The method of claim 1, wherein, The method further comprises: determining the current cluster center of the particle cluster by a clustering algorithm; if the number of current cluster centers is the same as the number of last cluster centers, for each current cluster center, obtaining a target cluster center closest to the current cluster center from the historical cluster centers; Linearly interpolating the current cluster center and the target cluster center to obtain an interpolation result, and updating the current cluster center to the interpolation result.

16. The method of claim 15, wherein, The interpolation weight of the current cluster center is a first weight, and the interpolation weight of the target cluster center is a second weight. The first weight is less than the second weight.

17. The method of claim 15, wherein, The method further comprises: Deleting the target cluster center from the historical cluster centers.

18. The method of claim 1, wherein, The method further comprises: In response to the moving speed of the particle object satisfying a preset speed threshold, reducing the time step of the particle object.

19. The method of claim 1, wherein, The method further comprises: If the frame time of the cluster animation satisfies a preset time threshold, performing the preset motion rule on a newly generated particle object.

20. The method of claim 1, wherein, The method further comprises: In response to a first interaction behavior occurring at a target scene position of the virtual scene, determining an attractive force generated at the target scene position; Determining a first influence range of the target scene position, and increasing the moving speed of a first particle object in the first influence range towards the target scene position.

21. The method of claim 1, wherein, The method further comprises: In response to a second interaction behavior occurring at a target scene position of the virtual scene, determining a repulsive force generated at the target scene position; Determining a second influence range of the target scene position, and gradually increasing a target attribute value of a second particle object in the second influence range; In response to the target attribute value increasing to a preset attribute threshold, increasing the moving speed of the second particle object in the direction opposite to the target scene position.

22. The method of claim 1, wherein, The step of increasing the moving speed of the second particle object in the direction opposite to the target scene position comprises: Determining an initial speed of the second particle object in the direction opposite to the target scene position; Controlling the current speed of the second particle object to increase the initial speed, and gradually decreasing the initial speed.

23. The method of claim 1, wherein, The method further comprises: If the particle object is marked as a disappearance identifier, controlling the particle object to continue to move according to the preset behavior rule; In response to the particle object satisfying a target condition, deleting the particle object.

24. A device for generating animations of biological clusters, characterized in that, The device comprises: A particle cluster generation module configured to, in response to an animation generation instruction, generate a particle cluster that moves in a virtual scene according to a preset motion rule based on a particle system; wherein the particle cluster comprises a plurality of particle objects, the particle cluster corresponds to a biological virtual cluster, and the biological virtual cluster comprises a plurality of biological individuals. A particle object control module configured to, for each particle object, determine a target position that attracts the current particle object, determine a target speed of the current particle object according to a preset parameter corresponding to the target position if a distance between a current position of the current particle object and the target position satisfies a preset condition, and control a current moving speed of the current particle object to increase the target speed. A cluster animation generation module configured to render the particle object in real time according to model vertex data of the biological individual that is pre-produced, and generate a biological cluster animation of the biological virtual cluster.

25. An electronic device, comprising: A computer readable storage medium storing computer executable instructions that, when called and executed by a processor, cause the processor to implement the method of any one of claims 1-23.

26. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer executable instructions that, when called and executed by a processor, cause the processor to implement the method of any one of claims 1-23.