Methods, apparatus, devices, and readable media for simulating behavior of a biological population

CN117314725BActive Publication Date: 2026-11-03SHANGHAI MIHOYO TIANMING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311275381.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2026-11-03
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

In existing technologies, the computational simulation of biological group behavior is difficult to improve in terms of complexity when resources are limited, which affects the execution time of other operations.

Method used

By obtaining the target LOD scaling factor, the balance between simulation effect and GPU performance is adjusted, the LOD level of individual biological groups in each frame image is determined, and spatial traversal and data impact analysis are performed to optimize rendering performance.

Benefits of technology

Without affecting the simulation results, computational efficiency has been improved, allowing the GPU more time to perform other operations to increase the complexity of biological population simulation, thus achieving efficient simulation under different hardware and scales.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117314725B_ABST
    Figure CN117314725B_ABST
Patent Text Reader

Abstract

The application provides a method, device, equipment and readable medium for simulating the behavior of a biological population. The method comprises: obtaining a target LOD scaling factor; determining, according to the target LOD scaling factor, an LOD level for simulating each individual of the biological population in each frame of image; respectively performing spatial traversal on each individual according to the LOD level to obtain influence data of three basic behaviors for affecting the separation, alignment and aggregation of each individual; and simulating the behavior of the biological population according to the influence data, so as to at least achieve the purpose of improving the efficiency of simulation calculation and allowing more time to perform other operations for improving the complexity of biological population simulation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, and readable medium for simulating the behavior of biological groups. Background Technology

[0002] Simulation of group behavior refers to modeling the basic laws of group behavior, providing action plans through computer programs, and finally, through simulation, visually presenting the situation of group behavior. Group behavior can be simulated using the bird flocking algorithm. The bird flocking algorithm is a swarm intelligence algorithm that simulates the group behavior of insects and birds in nature. Its basic idea is to simulate the group behavior of birds in nature and utilize the intelligence of the group to complete search and optimization tasks. Specifically, the bird flocking algorithm defines three basic behaviors for each individual in the flock: separation, alignment, and cohesion. By simulating these three basic behaviors for each individual, groups with rich morphological patterns can be spontaneously formed based on the individuals. Then, by adjusting the range, intensity, and other parameters of these basic behaviors, the behavioral characteristics of the group can exhibit significant differences. This bird flocking algorithm can also be used to simulate organisms such as insects and fish that exhibit large-scale gregarious behavior. As an optimization algorithm, it is widely used in computer animation or computer-aided design in the field of computer 3D geometry. It has not only been widely used in the field of film and television special effects but has also found some application in the field of video games.

[0003] The inventors have discovered at least the following technical problems in the related technologies: In these technologies, it is desirable to keep the simulation calculations of group behavior within a set resource consumption limit, so that more time can be devoted to performing other operations that enhance the complexity of the biological group simulation. Therefore, how to improve the efficiency of simulation calculations without affecting the simulation results, thereby allowing more time for other operations that enhance the complexity of the biological group simulation, has become an urgent problem to be solved. Summary of the Invention

[0004] One object of this application is to provide a method, apparatus, device, and readable medium for simulating the behavior of biological groups, which can at least improve the efficiency of simulation computation, allowing more time to be spent on other operations that increase the complexity of the biological group simulation.

[0005] To achieve the above objectives, some embodiments of this application provide the following aspects:

[0006] In a first aspect, some embodiments of this application provide a method for simulating the behavior of a biological group, the method comprising: obtaining a target LOD scaling factor; the target LOD scaling factor being used to adjust the balance between simulation effect and GPU performance; determining the LOD level of each individual in each frame of an image for simulating the biological group based on the target LOD scaling factor; performing spatial traversal on each individual based on the LOD level to obtain influence data for influencing the three basic behaviors of separation, alignment, and aggregation of each individual; and simulating the behavior of the biological group based on the influence data.

[0007] Secondly, some embodiments of this application also provide an apparatus for simulating the behavior of a biological group, the apparatus comprising: an acquisition module for acquiring a target LOD scaling factor; the target LOD scaling factor being used to adjust the balance between simulation effect and GPU performance; a determination module for determining, based on the target LOD scaling factor, the LOD level of each individual in each frame of an image used to simulate the biological group; a traversal module for performing spatial traversal on each individual according to the LOD level to obtain influence data for influencing the three basic behaviors of separation, alignment, and aggregation of each individual; and a simulation module for simulating the behavior of the biological group based on the influence data.

[0008] Thirdly, some embodiments of this application also provide a computer device, the device comprising: one or more processors; and a memory storing computer program instructions, which, when executed, cause the processor to perform the method described above.

[0009] Fourthly, some embodiments of this application also provide a computer-readable medium having computer program instructions stored thereon, which can be executed by a processor to implement the methods described above.

[0010] Optionally, in some examples, obtaining the target LOD scaling factor includes: for each frame of image, monitoring the time required to simulate the biological population; obtaining the LOD scaling factor for each frame of image; and adjusting the LOD scaling factor according to the time required to obtain the adjusted target LOD scaling factor for each frame of image. Since the time required to simulate the biological population and the computational resources are strongly correlated for each frame of image, the applicant cleverly and fully utilizes this characteristic to adjust the LOD scaling factor, achieving adaptive adjustment of the LOD scaling factor.

[0011] Optionally, in some examples, adjusting the LOD scaling factor based on the time consumption to obtain an adjusted target LOD scaling factor for each frame of the image includes: acquiring performance budget data, performance fluctuation data, and the rate of change of the LOD scaling factor; acquiring data characterizing the trend of change of the LOD scaling factor; and adjusting the LOD scaling factor based on the time consumption, the performance budget data, the performance fluctuation data, the rate of change of the LOD scaling factor, and the data characterizing the trend of change of the LOD scaling factor to obtain an adjusted target LOD scaling factor for each frame of the image. Thus, by fully utilizing the performance budget data, performance fluctuation data, the rate of change of the LOD scaling factor, the data characterizing the trend of change of the LOD scaling factor, and the time consumption to adjust the LOD scaling factor, a specific implementation method is provided for adjusting the LOD scaling factor based on the time consumption to obtain an adjusted target LOD scaling factor for each frame of the image.

[0012] Optionally, in some examples, adjusting the LOD scaling factor based on the duration of the event, the performance budget data, the performance fluctuation data, the rate of change of the LOD scaling factor, and the data representing the trend of change of the LOD scaling factor to obtain the adjusted target LOD scaling factor includes: if the duration of the event is greater than the performance budget data and the trend of change represented by the trend data is not increasing, or the duration of the event is greater than the sum of the performance budget data and the performance fluctuation data, then the LOD scaling factor is adjusted based on the LOD scaling factor, the rate of change of the LOD scaling factor, and a first threshold to obtain the target LOD scaling factor; if the duration of the event is less than the performance budget data and the trend of change represented by the trend data is not decreasing, or the duration of the event is less than the difference between the performance budget data and the performance fluctuation data, then the LOD scaling factor is adjusted based on the LOD scaling factor, the rate of change of the LOD scaling factor, and a second threshold to obtain the target LOD scaling factor. This adjustment method not only fully utilizes the strong correlation between the time required to simulate the biological population and the computational resources in each frame of the image to achieve adaptive adjustment of the LOD scaling factor, but also ensures that the value of the target LOD scaling factor is within a suitable range, neither too large nor too small, thus achieving a better balance between the simulated image quality and GPU performance.

[0013] Optionally, in some examples, determining the LOD level of each individual in each frame of an image used to simulate the biological population based on the target LOD scaling factor includes: acquiring first distance information between each individual and the target viewpoint in space; determining the LOD level of each individual in each frame of an image used to simulate the biological population based on the target LOD scaling factor and the first distance information; wherein the first distance information and the LOD level are positively correlated. Thus, a specific implementation of determining the LOD level of each individual in each frame of an image used to simulate the biological population is provided.

[0014] Optionally, in some examples, determining the LOD level of each individual in each frame of the image used to simulate the biological population based on the target LOD scaling factor and the first distance information includes: obtaining the second distance information corresponding to reaching a preset minimum precision, and the maximum LOD level among the LOD levels; and determining the LOD level of each individual in each frame of the image based on the target LOD scaling factor, the first distance information, the second distance information, and the maximum LOD level. This allows subsequent simulation calculations to be performed based on the LOD level of each individual, which helps to further improve the efficiency of the simulation calculations.

[0015] Optionally, in some examples, the step of spatially traversing each individual according to the LOD level to obtain the influence data for the three basic behaviors of separation, alignment, and clustering affecting each individual includes: obtaining the grid position information to be visited for each individual in each frame of the image; constructing a spatially accelerated data structure; using the spatially accelerated data structure to access the grid position information to be visited, so as to distribute the access across multiple frames of the image to obtain access results; wherein, the degree of access distribution is positively correlated with the first distance information; and based on the access results, the influence data for the three basic behaviors of separation, alignment, and clustering affecting each individual is obtained. This method further distributes the access of the spatially accelerated data structure across multiple frames of the image, and since the degree of access distribution is positively correlated with the first distance information, it can not only significantly reduce resource overhead, thus significantly reducing the overhead of "performing spatial search operations near all individuals" and improving the efficiency of simulation calculation, but also simultaneously reduce the impact of jitter caused by frame-by-frame calculation on the visual effect.

[0016] Optionally, in some examples, obtaining the grid location information to be visited for each individual in each frame of the image includes: determining the number of grids to be visited for each individual in each frame of the image based on the LOD level; performing spatial traversal based on the number of grids to determine the position offset of each individual in each frame of the image, thereby determining the grid location information to be visited. A specific implementation method for determining the grid location information is provided.

[0017] Optionally, in some examples, determining the number of grids to be visited by each individual in each frame of an image based on the LOD level includes: obtaining a preset maximum number of grids; and determining the number of grids to be visited by each individual in each frame of an image based on the preset maximum number of grids and the LOD level. Thus, by using a preset maximum number of grids and the LOD level to determine the number of grids to be visited by each individual in each frame of an image, this method is simple, convenient, and can obtain the number of grids relatively efficiently.

[0018] Optionally, in some examples, the step of spatially traversing according to the number of grids to determine the position offset of each individual in each frame of the image, thereby determining the grid position information to be accessed, includes: combining an arbitrary infinitely long low-dissimilarity sequence, performing spatial traversal according to the number of grids, and determining the position offset of each individual in each frame of the image, thereby determining the grid position information to be accessed. In this way, the characteristics of the arbitrary infinitely long low-dissimilarity sequence itself are fully utilized to determine which grids to select, allowing for a more efficient determination of the grid position information to be accessed.

[0019] Optionally, in some examples, constructing the spatial acceleration data structure includes: constructing the spatial acceleration data structure according to a spatial grid hashing algorithm; using the spatial acceleration data structure to access the grid location information to be accessed, distributing the access across multiple frames of images to obtain access results includes: obtaining the field of view of each individual in the biological population; performing an access operation on the grid location information to be accessed according to the spatial acceleration data structure and the field of view, determining other individuals in the spatial grid corresponding to each individual in the biological population; obtaining the influence data for the three basic behaviors of separation, alignment, and aggregation of each individual based on the access results includes: obtaining the influence data for the three basic behaviors of separation, alignment, and aggregation of each individual based on other individuals in the spatial grid corresponding to each individual. This not only improves the efficiency of determining the influence data but also allows the method provided in this application embodiment to be implemented flexibly and varied.

[0020] Optionally, in some examples, simulating the behavior of the biological group based on the influence data includes: applying time filtering of different intensities to the influence data according to the LOD level; and simulating the behavior of the biological group based on the data obtained after the time filtering. Here, regardless of the LOD level, the computational cost of performing time filtering on all individuals not only smooths out the jitter generated during the simulation calculation but also helps to further improve the simulation effect.

[0021] Optionally, in some examples, the step of applying different intensities of temporal filtering to the impact data based on the LOD level includes: obtaining the volume of a single spatial grid containing each individual; determining a number of image frames to represent how many image frames are needed to complete one spatial traversal based on the volume, the field of view, and the number of grids to be visited; determining the time information required to access one image frame based on the number of image frames; and determining the filtering intensity based on the time information to apply different intensities of temporal filtering to the impact data. This provides a specific implementation of applying different intensities of temporal filtering to the impact data based on the LOD level.

[0022] Compared to existing technologies, the method for simulating biological group behavior provided in this application is not mutually exclusive with existing simulation algorithms. By obtaining a target LOD scaling factor to adjust the balance between simulation effects and GPU performance, and then performing subsequent steps based on the target LOD scaling factor, a balance between image quality and performance consumption can be guaranteed. Since LOD technology for optimizing rendering performance is introduced on top of existing simulation algorithms, and after obtaining the target LOD scaling factor, the LOD level of each individual in each frame used to simulate the biological group is determined based on the target LOD scaling factor, and then spatial traversal is performed on each individual according to the LOD level to obtain influence data affecting the three basic behaviors of separation, alignment, and aggregation of each individual, the computation speed for finding other individuals within the spatial range of each individual is improved, i.e., the speed of calculating the influence data is improved. Based on the influence data, the efficiency of simulating biological group behavior can be greatly improved. Because the speed of calculating the influence data is improved within the same time requirement. Therefore, the GPU can have more time to perform other operations that enhance the complexity of the biological swarm simulation, thus achieving the highest possible simulation quality while meeting performance requirements when facing hardware with varying performance and biological swarm sizes. These other simulation operations can include the panicked escape of the biological swarm, obstacle avoidance, curve following, and other visual characteristics. Attached Figure Description

[0023] Figure 1 An exemplary flowchart of a method for simulating the behavior of biological groups provided in Embodiment 1 of this application;

[0024] Figure 2 An exemplary flowchart of a sub-step of step S101 in a method for simulating the behavior of biological groups provided in Embodiment 2 of this application;

[0025] Figure 3 An exemplary flowchart of a sub-step of step S102 in a method for simulating the behavior of biological groups provided in Embodiment 4 of this application;

[0026] Figure 4 An exemplary flowchart of a sub-step of step S103 in a method for simulating the behavior of biological groups provided in Embodiment 5 of this application;

[0027] Figure 5 This is another exemplary flowchart of a sub-step of step S103 in a method for simulating the behavior of biological groups provided in Embodiment 8 of this application.

[0028] Figure 6 An exemplary flowchart of a sub-step of step S104 in a method for simulating the behavior of biological groups provided in Embodiment 9 of this application;

[0029] Figure 7 This is an exemplary structural diagram of a computer device provided in an embodiment of this application. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0031] The following terms are used in this document.

[0032] LOD, short for Levels of Detail, refers to the level of detail in a model. It's a metric used in computer graphics to describe the level of detail in a 3D model, represented by a positive integer indicating the level of coarseness. A higher LOD value reduces the performance overhead of rendering distant objects; a LOD value of 0 indicates the most detailed image. LOD scaling refers to how the LOD value increases as the distance between an object and the viewpoint increases, reaching a specific distance threshold. By scaling this distance threshold, the LOD values ​​of objects in the scene can be generally increased or decreased, thus adjusting the overall rendering overhead of the scene.

[0033] Spatial range query is an operation that allows you to quickly find out which objects are within a specified range in a space where many objects are scattered.

[0034] Spatial traversal refers to the operation of traversing all objects within a specified range in space.

[0035] Time filtering removes certain components from a time signal to suppress interference and extract useful information.

[0036] Low-discrepancy sequences, also known as pseudo-random sequences, are a type of deterministic numerical sequence that has good spatial coverage and exhibits statistical similarity to uniformly distributed random sequences when calculating the coverage ratio of subspaces.

[0037] Example 1

[0038] Embodiment 1 of this application provides a method for simulating the behavior of biological groups, the method including the following steps, such as... Figure 1 As shown:

[0039] Step S101: Obtain the target LOD scaling factor; the target LOD scaling factor is used to adjust the balance between simulation effect and GPU performance.

[0040] Step S102: Determine the LOD level of each individual in each frame of the image used to simulate the biological population based on the target LOD scaling factor;

[0041] Step S103: Perform spatial traversal on each individual according to the LOD level to obtain the influence data of the three basic behaviors of separation, alignment and aggregation that affect each individual;

[0042] Step S104: Simulate the behavior of the biological group based on the impact data.

[0043] The following sections will provide a detailed explanation of each of the above steps.

[0044] First, it should be noted that the biological community can be, but is not limited to, schools of fish, flocks of sheep, flocks of birds, herds of horses, etc., and this application does not specifically limit this. For ease of understanding, the embodiments in this application use schools of fish as an example for illustration.

[0045] Regarding step S101, specifically, in some examples, the LOD scaling factor for each frame of the image can be obtained using an existing LOD system, where the LOD scaling factor is used to characterize the simulation accuracy. Specifically, relevant personnel, such as game developers, can combine experience and actual needs to manually input performance budget data, tolerable performance fluctuation data, and the rate of change of the LOD scaling factor into the LOD system, where the rate of change of the LOD scaling factor characterizes the rate of change during the adjustment of the LOD scaling factor. For example, in a PC running a target game, to simulate a school of fish, the manually input performance budget data could be 0.5 milliseconds, the tolerable performance fluctuation data could be 0.1 milliseconds, and the rate of change of the LOD scaling factor could be on the order of 0.005. Further, in some examples, the output value of the LOD system generally includes f and S, where f represents the LOD scaling factor, and S represents the trend of change of the LOD scaling factor. The trend of change can include increase, decrease, and remain unchanged. For example, when the initial value of S is 0, it means that the LOD scaling factor is changing in a constant trend; when the initial value of S is 1, it means that the LOD scaling factor is changing in an increasing trend; and when the initial value of S is -1, it means that the LOD scaling factor is changing in a decreasing trend.

[0046] Furthermore, in some examples, a larger LOD scaling factor f results in better image simulation, but worse GPU processing performance; conversely, a smaller LOD scaling factor f results in worse image simulation, but better GPU processing performance. In this example, the LOD scaling factor f can be adaptively adjusted based on its value to obtain the adjusted target LOD scaling factor. For instance, in some specific implementations, a maximum and a minimum threshold for the LOD scaling factor f can be set. When the LOD scaling factor f is large, such as exceeding the maximum threshold, its value can be appropriately reduced to improve GPU processing performance; conversely, when the LOD scaling factor f is small, such as below the minimum threshold, its value can be appropriately increased to improve the image simulation effect. This achieves a balance between the image simulation effect and GPU processing performance. The maximum threshold, the minimum threshold, and the rules for adaptively adjusting the LOD scaling factor f can be set by relevant personnel, such as game developers, according to actual needs. This application embodiment does not impose specific limitations on this.

[0047] Regarding step S102, specifically, in some examples, the maximum LOD level corresponding to the LOD level can be determined based on the game developer's development experience and actual needs for the target game. This application embodiment does not specifically limit this. For example, the maximum LOD level can be 23, 24, etc. In this step, the LOD level of each individual used to simulate the biological group in each frame image can be determined. That is, for example, the LOD level of fish number 1 in the fish group is 2, the LOD level of fish number 2 in the fish group is 10, the LOD level of fish number 2 in the fish group is 13, and so on, until the LOD level corresponding to each fish in the fish group is obtained.

[0048] Specifically, regarding step S103, in some examples, spatial traversal is performed on each individual according to the LOD level. This yields data on how an individual is affected by other individuals within the corresponding spatial range. This influence is quantified as influence data, corresponding to the adaptive bird flocking algorithm, which provides data on the three basic behaviors affecting each individual: separation, alignment, and clustering. For instance, spatial traversal is performed on each fish according to the LOD level, yielding data on the influence of other fish on a particular fish within the corresponding spatial range. This influence data includes not only data on the number of other individuals but also data on the combined effects of other individuals' positional information, speed information, and other factors.

[0049] Specifically, regarding step S104, in some examples, the influence data can be used as input data to a bird flocking algorithm to simulate the behavior of biological groups. The bird flocking algorithm is an existing algorithm in the prior art, and its data processing logic based on the influence data is essentially the same as that of existing bird flocking algorithms. To avoid redundancy, it will not be elaborated further here.

[0050] It should be noted that the method for simulating the behavior of biological groups provided in this application can be applied to the target game, thereby improving the efficiency of simulating the behavior of biological groups in the target game and thus enhancing the overall gaming experience. In some other examples, the method for simulating the behavior of biological groups can also be applied to other application scenarios that require large-scale neighborhood space search and calculation, such as film and television simulation, etc., without specific limitations here.

[0051] It should be noted that in the above steps, step S101 can be run on the CPU, and steps S102 to S104 can be run on the GPU.

[0052] Understandably, in applications with high real-time requirements, simulating flock behavior using bird flocking algorithms to achieve a smooth and natural simulation typically requires tens of simulation rounds per second for all individuals in the flock. During these rounds, each individual in the flock needs to have its average position, velocity, and other attributes calculated for all nearby individuals, consuming significant computational resources and representing a major performance bottleneck. This application aims to improve the computationally intensive aspects, increasing the performance ceiling and allowing sufficient time for additional calculations such as the transmission of fear information among fish, the following of the leader fish, and obstacle avoidance by fish, resulting in richer and more natural simulations. For example, in a certain game on a PC, the time allotted for a school of fish per frame is only 0.5 milliseconds. Therefore, under such a short time constraint, without improving existing simulation methods, the size of the fish school in that scene will be significantly limited, resulting in a less refined simulation and unnatural individual behavior. Therefore, it is necessary to improve the efficiency of the simulation computation without affecting the simulation effect, allowing more time to perform other operations that enhance the complexity of the biological group simulation.

[0053] It is not difficult to see that, compared with related technologies, the method for simulating the behavior of biological groups provided in this application is not mutually exclusive with existing simulation algorithms. By obtaining a target LOD scaling factor for adjusting the balance between simulation effect and GPU performance, and then performing subsequent steps based on the target LOD scaling factor, a balance between image quality and performance consumption can be guaranteed. Since LOD technology for optimizing rendering performance is introduced on the basis of existing simulation algorithms, and after obtaining the target LOD scaling factor, the LOD level of each individual in each frame of the image used to simulate the biological group is determined according to the target LOD scaling factor, and then spatial traversal is performed on each individual according to the LOD level to obtain the influence data for the three basic behaviors of separation, alignment, and aggregation affecting each individual, the computation speed for finding other individuals within the spatial range of each individual is improved, that is, the speed for calculating the influence data is improved. Based on the influence data, the simulation of biological group behavior can be performed, which can greatly improve the efficiency of simulating biological group behavior. Because the speed of calculating the influence data is improved within the same time requirement. Therefore, the GPU can have more time to perform other operations that enhance the complexity of the biological swarm simulation, thus achieving the highest possible simulation quality while meeting performance requirements when facing hardware with varying performance and biological swarm sizes. These other simulation operations can include the panicked escape of the biological swarm, obstacle avoidance, curve following, and other visual characteristics.

[0054] Example 2

[0055] Embodiment 2 of this application is a further improvement on Embodiment 1. Specifically, Embodiment 2 provides a specific implementation method for obtaining the target LOD scaling factor. Specifically, the step S101 of obtaining the target LOD scaling factor can further include the following sub-steps, such as... Figure 2 As shown:

[0056] Step S1011: For each frame of image, monitor the time required to simulate the biological population;

[0057] Step S1012: Obtain the LOD scaling factor for each frame of the image;

[0058] Step S1013: Adjust the LOD scaling factor according to the time consumption to obtain the adjusted target LOD scaling factor for each frame of the image.

[0059] Specifically, in some examples, the GPU time consumed by the simulated biological group, such as a school of fish, can be monitored based on each frame of the image, and the GPU time can be used as the duration of the time consumed.

[0060] Furthermore, in some examples, assuming the time required to monitor the simulated biological population is A, it can be calculated using the exponential moving average method to obtain a smoothed time duration B', which is then used as the actual time duration. It can be understood that the exponential moving average method allows newly monitored time durations and historical time durations to be mixed and processed according to certain weights to obtain the time duration B'. It can be understood that the closer the image frame is to the current time, the greater its influence on the time duration B', and the higher the accuracy of the corresponding calculation result. When using the exponential moving average method, the specific values ​​of the weighting coefficients can be set by relevant personnel, such as game developers, based on experience. For example, the first weighting coefficient in the formula corresponding to the exponential moving average method can be set to 0.03 and the second weighting coefficient to 0.97. The first result is obtained by multiplying the time taken for each newly monitored data by 0.03, and the second result is obtained by multiplying the historical time taken at the previous moment by 0.97. Then, the first result and the second result are added together according to the formula to obtain the smoothed time B'.

[0061] Furthermore, in some embodiments of this application, adjusting the LOD scaling factor according to the time consumption to obtain an adjusted target LOD scaling factor for each frame of the image may further include: acquiring performance budget data, performance fluctuation data, and the rate of change of the LOD scaling factor; acquiring data characterizing the trend of change of the LOD scaling factor; and adjusting the LOD scaling factor according to the time consumption, the performance budget data, the performance fluctuation data, the rate of change of the LOD scaling factor, and the data characterizing the trend of change of the LOD scaling factor to obtain an adjusted target LOD scaling factor for each frame of the image.

[0062] Specifically, in some examples, referring to the description of step S101 in Embodiment 1, game developers, based on experience and actual needs, can obtain the corresponding performance budget data, performance fluctuation data, and LOD scaling factor change rate based on the performance budget data, tolerable performance fluctuation data, and LOD scaling factor change rate input by the LOD system. The output value of the LOD system generally includes f and S, where f represents the LOD scaling factor and S represents the change trend data of the LOD scaling factor. In some examples, the initial value of the LOD scaling factor f can be set to 1, and the initial value of S, representing the change trend of the LOD scaling factor, can be set to 0.

[0063] It should be noted that the above is merely an example, and the embodiments of this application do not specifically limit the order in which steps S1011 and S1012 are executed. For example, step S1012 can be executed first to obtain the LOD scaling factor of each frame of the image, and then step S1011 can be executed to monitor the time required to simulate the biological population for each frame of the image.

[0064] It is not difficult to see that, compared with Embodiment 1 of this application, Embodiment 2 of this application, based on Embodiment 1, provides a specific implementation method for obtaining the target LOD scaling factor. Specifically, for each frame of image, the time required to simulate the biological population is monitored to obtain the LOD scaling factor of each frame of image. Then, the LOD scaling factor is adjusted according to the time required to obtain the adjusted target LOD scaling factor. It can be understood that for each frame of image, the time required to simulate the biological population and the computing resources are strongly correlated. The applicant cleverly and fully utilizes this characteristic to adjust the LOD scaling factor, achieving adaptive adjustment of the LOD scaling factor.

[0065] Example 3

[0066] Embodiment 3 of this application is a further improvement on Embodiment 2. Specifically, Embodiment 3 provides a method for adjusting the LOD scaling factor based on the time consumption, the performance budget data, the performance fluctuation data, the rate of change of the LOD scaling factor, and the data used to characterize the trend of change of the LOD scaling factor, to obtain an adjusted target LOD scaling factor.

[0067] Specifically, in some examples, for each frame of an image, if the duration of the image is greater than the performance budget data and the trend of change represented by the trend data is not increasing, or if the duration of the image is greater than the sum of the performance budget data and the performance fluctuation data, then the LOD scaling factor is adjusted according to the LOD scaling factor, the rate of change of the LOD scaling factor, and a first threshold to obtain the target LOD scaling factor.

[0068] Furthermore, in some examples, see the following formula:

[0069] If (B'>B∧S≠1)∨(B'>B+b), then let f←max{f-Δf,0.2},S←-1;

[0070] Where B' represents the duration of the process, B represents the performance budget data, S represents the trend data of the LOD scaling factor, b represents the performance fluctuation data, f after the max formula represents the LOD scaling factor before adjustment, and f before the max formula represents the target LOD scaling factor obtained after adjustment.

[0071] Furthermore, in some examples, if the above conditions are met—that is, the duration B' is greater than the performance budget data B and the trend represented by the trend data is not increasing (i.e., S≠1), or the duration B' is greater than the sum of the performance budget data B and the performance fluctuation data b—then the LOD scaling factor is adjusted according to the LOD scaling factor, the rate of change of the LOD scaling factor, and a first threshold to obtain the target LOD scaling factor. Specifically, the LOD scaling factor f and the rate of change Δf of the LOD scaling factor can be subtracted, and the resulting value can be compared with 0.2, taking the maximum value. That is, in this example, the first threshold is 0.2, and the minimum value of the adjusted target LOD scaling factor cannot be less than f-Δf, and the maximum cannot exceed 0.2. Simultaneously, the value of the trend data can be adjusted to -1.

[0072] Specifically, in some examples, for each frame of an image, if the time taken is less than the performance budget data and the trend of change represented by the trend data is not decreasing, or if the time taken is less than the difference between the performance budget data and the performance fluctuation data, then the LOD scaling factor is adjusted according to the LOD scaling factor, the rate of change of the LOD scaling factor, and the second threshold to obtain the target LOD scaling factor.

[0073] Furthermore, in some examples, see the following formula:

[0074] If (B'<B ∧ S≠-1) ∨ (B'<B-b), let f←min{f+Δf, 1}, S←1;

[0075] Wherein, B' denotes the elapsed time duration, B denotes the performance budget data, S denotes the change trend data of the LOD scaling factor, b denotes the performance fluctuation data, the f following the min formula denotes the LOD scaling factor before adjustment, and the f preceding the min formula denotes the target LOD scaling factor obtained after adjustment.

[0076] Further, in some examples, if the above condition is satisfied, that is, the elapsed time duration B' is less than the performance budget data B and the change trend represented by the change trend data is not a decreasing relationship, i.e., S≠-1, or the elapsed time duration B' is less than the difference between the performance budget data B and the performance fluctuation data b, the LOD scaling factor is adjusted according to the LOD scaling factor, the change speed of the LOD scaling factor and a second threshold, to obtain the target LOD scaling factor. Specifically, the LOD scaling factor f and the change speed Δf of the LOD scaling factor may be added, the value obtained by the addition is compared with 1, and the minimum value thereof is taken. That is, in this example, the second threshold is 1, the maximum value of the adjusted target LOD scaling factor is 1, and the minimum value cannot be smaller than f+Δf. At the same time, the value of the change trend data may be adjusted to 1.

[0077] It should be noted that in the above example, the value of the first threshold is 0.2, the value of the second threshold is 1, and the value of the target LOD scaling factor ranges between 0.2 and 1. The specific values of the first threshold and the second threshold are generally empirical parameters, which can be adjusted by relevant staff according to actual needs. However, it should be noted that if the value of the adjusted target LOD scaling factor is too small, the quality of the simulated image will be relatively poor; if the value of the adjusted target LOD scaling factor is too large, although the quality of the simulated image will be higher, it will often lead to poor GPU performance, so a balance is struck between the simulated image quality and the GPU performance.

[0078] It should be noted that in the above example, during the process of adjusting the LOD scaling factor f to obtain the target LOD scaling factor, the value of the change trend data S may also be changed, so as to be continuously used in the next frame of image. The change trend data S acts inside the LOD system, and is used to make the LOD scaling factor f more stable and avoid severe jitter.

[0079] In addition, it should be noted that the third embodiment of the present application may also be an improvement made on the basis of the first embodiment.

[0080] It is not difficult to see that the method provided in Embodiment 3 of this application provides a specific implementation of adaptive adjustment of the LOD scaling factor. By adjusting in this way, not only is the characteristic that the time required to simulate the biological population and the computing resources required in each frame of the image are strongly correlated, thus realizing the adaptive adjustment of the LOD scaling factor, but the value of the target LOD scaling factor can also be kept within a suitable range, neither too large nor too small, so that the simulated image quality and GPU performance can reach a relatively balanced state.

[0081] Example 4

[0082] Embodiment 4 of this application is a further improvement on Embodiment 1. Specifically, in Embodiment 4, the step S102, which determines the LOD level of each individual in each frame of the image used to simulate the biological population based on the target LOD scaling factor, can further include the following steps: Figure 3 As shown:

[0083] Step S1021: Obtain the first distance information between each individual and the target viewpoint in space;

[0084] Step S1022: Determine the LOD level of each individual in each frame of the image used to simulate the biological population based on the target LOD scaling factor and the first distance information; wherein the first distance information and the LOD level are positively correlated.

[0085] Specifically, in some examples, the first position information of each individual in space and the second position information of the target character's viewpoint in space can be obtained. Then, the first distance information is obtained by subtracting the first and second position information. The first position information of each individual's spatial position is generally represented in the form of three-dimensional coordinates. For example, each fish can be considered an individual, and the first position information of each fish in space can correspond to a three-dimensional coordinate. Further, in some examples, the target viewpoint can be the player's viewpoint. For example, in a game scene, the player usually observes their character through an independent perspective, and this perspective also has a position in space, which is the second position information of the player's viewpoint in space. Since the first distance information and the LOD level are positively correlated, it means that the smaller the first distance information, the smaller the LOD level; and the larger the first distance information, the larger the LOD level.

[0086] Furthermore, in some embodiments of this application, the step of determining the LOD level of each individual in each frame of the image used to simulate the biological population based on the target LOD scaling factor and the first distance information, i.e., step S1032 above, may further include the following steps: obtaining the second distance information corresponding to reaching a preset minimum precision, and the maximum LOD level in the LOD levels; determining the LOD level of each individual in each frame of the image based on the target LOD scaling factor, the first distance information, the second distance information, and the maximum LOD level.

[0087] Specifically, in some cases, the greater the distance between two individuals, the lower the accuracy; conversely, the closer the distance between two individuals, the higher the accuracy. It is understood that in related technologies, it is impossible to reduce the accuracy to a preset minimum accuracy indefinitely. When this preset minimum accuracy is achieved, the distance between two individuals is the first distance information. In some cases, the preset minimum accuracy can be an empirical value, which can be flexibly set by relevant personnel according to actual needs. Therefore, no specific limitations are placed on the values ​​of the preset minimum accuracy and the first distance information here.

[0088] Specifically, in some cases, the maximum LOD level can be flexibly set by relevant personnel according to actual needs. For example, the maximum LOD level can be 23, 24, etc., without specific limitations. It can be understood that the maximum LOD level corresponds to the lowest precision simulation calculation. That is, the larger the LOD level, the lower the simulation precision; the smaller the LOD level, the higher the simulation precision.

[0089] Furthermore, in some embodiments of this application, the step of determining the LOD level of each individual in the biological population in each frame of an image based on the target LOD scaling factor, the first distance information, the second distance information, and the maximum LOD level is specifically achieved through the following formula:

[0090]

[0091] Among them, ||p i -o|| represents the first distance information, D represents the second distance information, f represents the target LOD scaling factor, and p i LOD represents the first location information of an individual in the biological population, o represents the second location information, and LOD represents the first location information. max This indicates the maximum LOD level.

[0092] As can be seen, the leftmost side of the above formula is the LOD. iLet represent the LOD level of individual i. By calculating the LOD level of each individual using the formula above, we can obtain the LOD level of each individual, such as the LOD level of each fish.

[0093] It should be noted that Embodiment 4 of this application may also be an improvement based on Embodiment 2 or Embodiment 3.

[0094] It is not difficult to see that the method provided in Embodiment 4 of this application obtains the first distance information between each individual and the target viewpoint in space; and determines the LOD level of each individual in each frame of the image used to simulate the biological population based on the target LOD scaling factor and the first distance information; wherein the first distance information and the LOD level are positively correlated. Thus, by using the target LOD scaling factor to linearly scale the distance threshold for switching different LOD levels, the overall performance of simulating the biological population is controlled by utilizing the target LOD scaling factor. Then, simulation calculations can be performed using the determined LOD level of each individual, which helps to further improve the efficiency of simulation calculations.

[0095] Example 5

[0096] Embodiment 5 of this application is a further improvement on Embodiment 4. Specifically, in Embodiment 5, the step of performing spatial traversal on each individual according to the LOD level to obtain influence data for the three basic behaviors affecting separation, alignment, and aggregation of each individual can further include the following sub-steps: Figure 4 As shown:

[0097] Step S1031: Obtain the grid location information to be visited for each individual in each frame of image;

[0098] Step S1032: Construct a spatially accelerated data structure;

[0099] Step S1033: The spatial acceleration data structure is used to access the grid location information to be accessed, so as to distribute the access across multiple frames of images to obtain the access result; wherein, the degree of access distribution is positively correlated with the first distance information;

[0100] Step S1034: Based on the access results, obtain the impact data of the three basic behaviors of separation, alignment and aggregation that affect each individual.

[0101] Furthermore, in some embodiments of this application, the step of obtaining the grid location information to be visited for each individual in each frame of image, i.e., step S1031 above, may further include the following steps: determining the number of grids to be visited for each individual in each frame of image based on the LOD level; performing spatial traversal based on the number of grids to determine the position offset of each individual in each frame of image, thereby determining the grid location information to be visited. It can be understood that since an individual is generally surrounded by many grids, the number of grids to be visited for a particular individual in a particular frame of image can be calculated first, and then the grids at which locations need to be visited can be calculated. In this way, it can be determined which other individuals in the spatial grids surrounding a particular individual need to be searched later.

[0102] Specifically, in some examples, spatial range queries can be performed by constructing a spatially accelerated data structure. For example, a KD-tree method or a spatial grid hash algorithm can be used. This application does not specifically limit this approach. It should be noted that when using the spatial grid hash algorithm to construct the spatially accelerated data structure, the "grid" used in constructing the spatially accelerated data structure is the same in part of speech and meaning as the "grid" in step S1031 of this application. However, they belong to different steps and play different roles. The grid appearing in step S1031 of this application is a table that has not yet been actually accessed. That is, through step S1031, it can be determined how large a range of spatial grids surrounding a given individual will be searched for other individuals later. Furthermore, it should be noted that in some other examples, when the spatial range of all individuals is small, a uniform grid method can be directly used to obtain the influence data; when the spatial range occupied by all individuals is large, the spatial grid hash algorithm can be used to hash the grid coordinates to a smaller range, thus avoiding excessive expansion of the required video memory space.

[0103] It should be noted that the order of the above steps is merely an example. Logically, step S1032 only needs to be performed before step S1034. For example, step S1032 can also be performed before step S101 in Embodiment 1, and this application does not specifically limit this.

[0104] It should be noted that Embodiment 5 of this application may also be an improvement based on any one or more embodiments of Embodiments 1 to 3.

[0105] It is not difficult to see that in the method provided in Embodiment 5 of this application, the grid position information to be visited for each individual in each frame of the image can be obtained. Thus, for a certain individual, the range of the surrounding spatial grid and the range of other individuals in that individual are determined. Next, by constructing a spatial acceleration data structure, the grid position information to be visited is accessed using the spatial acceleration data structure, so that the access is distributed across multiple frames of the image to obtain access results. Then, based on the access results, the influence data for the three basic behaviors of separation, alignment, and aggregation that affect each individual is obtained. Through this method, the access of the spatial acceleration data structure is further distributed across multiple frames of the image. Since the degree of access distribution is positively correlated with the first distance information, not only can resource overhead be significantly reduced, making the overhead of "performing spatial search operations near all individuals" significantly reduced and improving the efficiency of simulation calculation, but the impact of jitter caused by frame-by-frame calculation on visual effects can also be weakened.

[0106] Research has found that, taking a certain game as an example, the above method can reduce the overhead of "spatial search operations near all individuals" to 15% to 30% of the original version. It can be understood that, taking a school of fish as an example, the method provided in this application allows a high-configuration PC to simulate a large-scale group of millions of fish in real time, if only the school of fish is considered. Based on this improvement, subsequent calculations of the three basic behaviors affecting the separation, alignment, and aggregation of each individual can be completed with very little time. This allows the GPU to spend more time improving the complexity of the fish school behavior and other visual features of the game, thereby enhancing the overall gaming experience.

[0107] Example 6

[0108] Embodiment Six of this application is a further improvement on Embodiment Five. Specifically, in Embodiment Six, the step of determining the number of grids to be accessed by each individual in each frame of the image based on the preset maximum number of grids and the LOD level may further include the following steps: obtaining the preset maximum number of grids; and determining the number of grids to be accessed by each individual in each frame of the image based on the preset maximum number of grids and the LOD level.

[0109] Specifically, in some examples, a lower LOD level means that the individual is closer to the target viewpoint, and the number of grids to be visited is higher.

[0110] Furthermore, in some embodiments of this application, the determination of the number of grids to be accessed by each individual in each frame of image based on the preset maximum number of grids and the LOD level is specifically achieved through the following formula:

[0111] N i =N base -LOD i And N i >LOD max

[0112] Where i represents an individual in the biological population, and N i N represents the number of grid cells to be visited by individual i in a given frame of an image. base This represents the preset maximum number of grid cells, LOD. i This represents the LOD level of individual i. max This indicates the highest LOD level among the LOD levels.

[0113] It should be noted that the LOD level of individual i is LOD. i and the maximum LOD level LOD max It can be compared with the LOD level provided in Example 4. i and the maximum LOD level LOD max The meaning is the same, so it will not be repeated here.

[0114] It should be noted that Embodiment Six of this application may also be an improvement based on any one or more embodiments from Embodiments One to Four.

[0115] It is not difficult to see that the method provided in Embodiment Six of this application obtains a preset maximum number of grids, and then performs spatial traversal based on the preset maximum number of grids and the LOD level to determine the number of grids to be visited for each individual in each frame of the image.

[0116] Example 7

[0117] Embodiment 7 of this application is a further improvement on Embodiment 6. Specifically, the improvement is that, in Embodiment 7 of this application, the step of performing spatial traversal based on the number of grids and determining the position offset of each individual in each frame of the image to determine the grid position information to be accessed can further include the following steps: combining any infinitely long low-discrepancy sequence, performing spatial traversal based on the number of grids, and determining the position offset of each individual in each frame of the image to determine the grid position information to be accessed.

[0118] Specifically, in some examples, any hash algorithm can be used to associate each individual with an infinitely long, low-dissimilarity sequence, from which consecutive 3N values ​​can be extracted. i N real numbers located in [0, 1) constitute N i A three-dimensional vector. It is worth noting that, in this example, the position of each individual in its corresponding sequence is persistent, and the next frame will start from the position after the last value taken.

[0119] Furthermore, in some embodiments of this application, the step of combining an arbitrary infinitely long low-difference sequence, performing spatial traversal based on the number of grids, and determining the position offset of each individual in each frame of the image to determine the grid position information to be accessed is specifically achieved through the following formula:

[0120] n j =(L[3t) i ], L[3t i +1],L[3t i +2]), j∈{1,2,...,N} i};

[0121] Let t i ←t i +3N i

[0122] Where L represents an arbitrarily long, low-dissimilarity sequence, t i This represents the position of individual i in any infinitely long low-dispersion sequence, n j This indicates the determination of the grid location information to be accessed.

[0123] Specifically, in some cases, the t can be first... i Perform initialization operations. For example, the t can be initialized. i It is randomly initialized to a large positive integer.

[0124] Specifically, in some examples, since L represents an arbitrarily long, low-dissimilarity sequence, the 3rd × t-th element in this arbitrarily long, low-dissimilarity sequence can be obtained using the above formula. i Element number, the 3rd × (t) i +1) element, the 3rd × (t) i +2) elements to get n j In other words, assuming t i If we set it to 10, we can obtain the 30th, 31st, and 32nd elements from the arbitrary infinitely long low-dispersion sequence.

[0125] Furthermore, in some examples, assuming that, according to Embodiment Six, for a given individual, the number of grids that need to be visited around that individual in a certain frame of image is 20, then in this embodiment of the application, it is necessary to select the 20 grids around the individual from among many grids, determine the position offset of the individual in that frame of image, and thus determine the position information of the grids to be visited. It can be understood that each of these 20 grids corresponds to a coordinate. Since this coordinate is a coordinate in three-dimensional space, three numbers are needed to determine the coordinate. These three numbers correspond to the three elements obtained from the arbitrary infinitely long low-difference sequence in the above formula. Since in this example, the number of grids that need to be visited around the individual is 20, 20 sets of coordinates are calculated, each set of coordinates corresponding to one grid, and each set of coordinates includes three elements of data, that is, a total of 60 numbers are obtained from the arbitrary infinitely long low-difference sequence. Furthermore, in some examples, in the next frame of image, based on the number of grids visited around the individual, these 60 numbers can be skipped, and selection can begin from the 61st number. Continuing to perform this operation completes the spatial traversal step based on the number of grid cells. In other words, this embodiment aims to utilize the inherent characteristics of any infinitely long, low-dissimilarity sequence to determine which grid cells to select and the positional offset of the individual within the frame image, thereby determining the location information of the grid cells to be accessed.

[0126] It should be noted that Embodiment 7 of this application may also be an improvement based on any one or more of Embodiments 1 to 5.

[0127] It is not difficult to see that the method provided in this application, by combining an arbitrary infinitely long low-dissimilarity sequence and performing spatial traversal according to the number of grids, determines the position offset of each individual in each frame of the image, thereby determining the location information of the grids to be visited. In this way, the characteristics of the arbitrary infinitely long low-dissimilarity sequence itself are fully utilized to determine which grids to select. On the one hand, this ensures that the grids visited in each frame are sufficiently random, avoiding the effect flaw of clustering illusion; on the other hand, it ensures that all grids visited within multiple frames can fully cover the space near the individual, preventing omissions from affecting the stability of simulating biological group behavior.

[0128] Example 8

[0129] Embodiment 8 of this application is a further improvement on Embodiment 7. Specifically, the improvement lies in that: in Embodiment 8, constructing the spatial acceleration data structure includes: constructing the spatial acceleration data structure according to a spatial grid hash algorithm; the step S1033, which involves using the spatial acceleration data structure to access the grid location information to be accessed, distributing the access across multiple frames to obtain the access result, can further include the following sub-steps, such as... Figure 5 As shown:

[0130] Step S10331: Obtain the field of vision of each individual in the biological population;

[0131] Step S10332: Based on the spatial acceleration data structure and the field of view, perform an access operation on the grid location information to be accessed, and determine other individuals in the spatial grid where the grid location information to be accessed for each individual in the biological population is located.

[0132] Further, step 1034, namely, obtaining the influence data of the three basic behaviors of separation, alignment and aggregation that affect each individual based on the access results, specifically involves obtaining the influence data of the three basic behaviors of separation, alignment and aggregation that affect each individual based on the other individuals in the spatial grid corresponding to each individual.

[0133] Specifically, in some cases, spatial grid hashing algorithms can be used to build spatially accelerated data structures for grid-based spatial lookups on GPUs.

[0134] Specifically, in some examples, R can be used to represent the field of vision of an individual i within the biological population. For instance, R can be equal to 5 meters, meaning that individual i can see other individuals within five meters. In some examples, the value of R may differ among different fish in different schools, and this difference allows different fish to exhibit different habits. The value of the field of vision can be set by relevant personnel according to actual needs, and is not specifically limited here.

[0135] Furthermore, in some embodiments of this application, the step of performing an access operation on the grid location information to be accessed based on the spatial acceleration data structure and the field of view, and determining other individuals in the spatial grid where the grid location information to be accessed for each individual in the biological population is located, is specifically achieved through the following formula:

[0136] G[i,n] j ]={k|k is in hashed grid i+RU(n j )}

[0137] Where R represents the field of vision of individual i, and G[i, n] j ] represents the grid location information n to be visited corresponding to individual i. j All other individuals in the spatial grid; U(n) j ) indicates that n j The corresponding three-dimensional coordinates are treated as uniformly distributed random variables and converted into uniformly distributed data within a unit sphere centered on the individual i; k represents the individual in the spatial grid.

[0138] Specifically, in some examples, the calculation result G[i, n] j It includes two parameters, i being the individual and n being the individual. j The grid location information n corresponding to individual i, calculated using the formula provided in Example 7, is the location of the individual i to be visited. j This formula allows us to obtain the grid where the grid position information nj corresponding to individual i is located, centered on individual i. Other individuals within this grid are represented by G, which is a set including the number, position, speed, etc., of these other individuals. For example, this set could include other fish within a target range centered on a particular fish. It can be understood that since the grid position information nj corresponding to individual i... j The grid in which an individual i exists includes other individuals. Based on this formula, access can be achieved by considering the location information of the grid cells surrounding the individual i, thus allowing access to all other individuals within the spatial grid. This spatial grid is generated by the spatial acceleration data structure, meaning that the structure comprises many spatial grid cells.

[0139] Specifically, in some examples, the long vertical line in the above formula represents a "set" symbol, which divides the content within the curly braces into two parts. The content on the left represents one of the many individuals in the spatial grid, denoted by k, and the content on the right represents the conditions that individual k must satisfy.

[0140] Specifically, in some examples, such as n obtained in Embodiment 7 of this application j For [0, 1) 3 The three-dimensional coordinates between them. That is, each n obtained... j All three-dimensional coordinates are within this unit cube. Therefore, by using [0, 1) 3 Transforming the three-dimensional coordinates between them into a spherical space centered on a particular individual allows the resulting mesh to be located within a spherical space surrounding that individual, such as a fish.

[0141] Furthermore, in some examples, there are 20 sets of three-dimensional coordinates. Using the formula above, these 20 sets of three-dimensional coordinates can be randomly distributed within a unit sphere centered on the individual i. Then, the size of the generated sphere is determined based on the unit sphere and the field of view R. Thus, the positions of the 20 sets of three-dimensional coordinates can be determined. It should be noted that while the random distribution of these 20 sets of three-dimensional coordinates cannot be completely random, it is approximately random.

[0142] Furthermore, in some embodiments of this application, the step of obtaining influence data for the three basic behaviors of separation, alignment, and aggregation of each individual based on other individuals in the spatial grid where the grid location information to be visited corresponding to each individual is located is specifically achieved through the following formula:

[0143]

[0144] Where h(i, k) represents a function used to calculate the effects of the other individuals k on the separation, alignment, and clustering of individual i; τ i This represents the data showing the impact of the three basic behaviors of separation, alignment, and aggregation on individual i caused by other individuals k.

[0145] Specifically, in some examples, τ i The effects of separation, aggregation, and alignment on individual i can be represented by the influence of other individuals k. It can be understood that other individuals k is a set representing the other individuals surrounding individual i. Using the above formula, the influence data of each other individual in the set k on individual i under each basic behavior can be calculated, and these influence data are summed. Thus, for example, for a certain fish, the influence of other fish on that fish under the above three basic behaviors can be obtained, yielding the influence data. It is worth mentioning that since h(i, k) corresponds to the function of separation, alignment, and aggregation, this function is existing technology and will not be elaborated here.

[0146] Furthermore, in some examples, the influence data obtained above can be substituted into the bird flock algorithm to simulate the behavior of the biological group.

[0147] It should be noted that Embodiment 8 of this application may also be an improvement based on any one or more embodiments from Embodiment 1 to Embodiment 6.

[0148] It is not difficult to see that in the method provided in Embodiment 8 of this application, the spatial acceleration data structure is specifically constructed according to the spatial grid hash algorithm; then, the field of vision of each individual in the biological population is obtained respectively; and then, according to the spatial acceleration data structure and the field of vision, an access operation is performed on the grid position information to be accessed, to determine the other individuals in the spatial grid corresponding to each individual in the biological population; and then, based on the other individuals in the spatial grid corresponding to each individual, the influence data for influencing the three basic behaviors of separation, alignment, and aggregation of each individual is obtained. It should be noted that in related technologies, although the original algorithm requires traversing all other individuals based on each individual, the performance overhead is huge; even if a spatial acceleration data structure is introduced to significantly improve the simulation efficiency, it still requires accessing many units in the spatial acceleration data structure, which cannot meet the performance requirements of some application scenarios. In this embodiment of the application, by further distributing the access of the spatial acceleration data structure across multiple frames, and the aggressiveness of the distribution is positively correlated with the distance between each individual in space and the target viewpoint, this strategy can significantly reduce the overhead while also reducing the impact of jitter caused by frame-by-frame calculation on the visual effect.

[0149] Example 9

[0150] Embodiment Nine of this application is a further improvement on Embodiment Eight. Specifically, in Embodiment Nine, the step S104, which involves simulating the behavior of the biological group based on the influence data, can further include the following steps: Figure 6 As shown:

[0151] Step S1041: Based on the LOD level, perform time filtering processing of different intensities on the impact data respectively;

[0152] Step S1042: Simulate the behavior of the biological group based on the data obtained after the time filtering process.

[0153] Specifically, in some examples, since in step S103, i.e., in the process of spatially traversing each individual according to the LOD level to obtain the influence data for the three basic behaviors of separation, alignment, and aggregation affecting each individual, it is generally only necessary to spatially traverse a subset of other individuals near a given individual. Therefore, when the LOD level of an individual is LOD... iWhen the value of LOD is large, it can easily cause significant fluctuations in the behavior of a particular individual, such as generating high-frequency noise in the direction an individual faces. Although noise is automatically filtered out to some extent when calculating the behavior of a biological group due to the large number of individuals, it can still cause visual fluctuations in individuals, affecting the perception of the group as a whole, such as the perception of a school of fish. Therefore, by applying time filtering of the influencing data with different intensities according to the LOD level, and then simulating the behavior of the biological group based on the data obtained after time filtering, the aforementioned significant fluctuations can be reduced, thereby decreasing the impact of an individual's behavior on the group's behavior.

[0154] Specifically, in some examples, the higher the LOD level, the stronger the temporal filtering of the impact data; conversely, the lower the LOD level, the weaker the temporal filtering of the impact data. In practical applications, a mapping relationship can be established between the LOD level and the intensity of the temporal filtering.

[0155] Furthermore, in some embodiments of this application, the step of performing temporal filtering processing on the impact data with different intensities according to the LOD level may include the following steps: obtaining the volume of a single spatial grid in which each individual is located; determining a number of image frames to characterize how many image frames need to be distributed to complete one spatial traversal based on the volume, the field of view, and the number of grids to be visited; and determining the filtering intensity based on the number of frames to perform temporal filtering processing on the impact data with different intensities.

[0156] Furthermore, in some embodiments of this application, the determination of the number of image frames required to complete one spatial traversal, based on the volume, the field of view, and the number of grids to be visited, can be implemented using the following formula:

[0157]

[0158] result = τ′ i (1-1 / F)+τ i (1 / F) (2)

[0159] Where g represents the volume of a single spatial grid cell containing the individual, and N i R represents the number of grid cells to be visited by individual i in a certain frame of image, A represents a preset value, F represents the number of cells, and τ represents the number of cells to be visited by individual i. i τ′ represents the data showing the influence of individual i on the three basic behaviors of separation, alignment, and aggregation caused by other individuals k. iThis represents the historical impact data of the three basic behaviors of separation, alignment, and aggregation caused by other individuals k in the previous frame image, and result represents the data obtained after performing the time filtering process on the impact data according to the intensity.

[0160] Specifically, in some examples, it can be seen from the above formula that the LOD level is specifically determined by N. i The quantity value F is equal to the minimum value within the curly braces in the above formula. In this example, when the value of A is 1, it means that the maximum value of F cannot exceed 1. The volume g of a single spatial grid can be 8 cubic meters, 7.5 cubic meters, etc., which can be calculated using existing calculation methods and will not be elaborated further.

[0161] Specifically, in some cases, when an individual has a lower LOD level in a certain image frame, that is, when the simulation accuracy is higher, the area for spatial traversal is larger, and there is a greater tendency to discard historical impact data and use the latest impact data for temporal filtering. On the other hand, when an individual has a higher LOD level in a certain image frame, that is, when the simulation accuracy is lower, the impact data is subjected to stronger temporal filtering to avoid more obvious jitter caused by insufficient accuracy.

[0162] It should be noted that part of the above formula (1) is inspired by the volume of a sphere. Since R represents the field of vision of individual i and g represents the volume of a single spatial grid, dividing the volume of the sphere by the volume of the single spatial grid g gives the result of how many spatial grids can be accommodated within the field of vision of an individual (such as a fish). This result is not necessarily an integer; for example, it can be calculated that M spatial grids can be accommodated within the field of vision of a fish. And since N i This represents the number of grid cells to be visited by individual i in a given frame, which is also the number of grid cells that need to be actually visited later. Therefore, dividing M by the number of grid cells that need to be actually visited yields a value that represents approximately how many frames are needed to visit all the spatial grid cells surrounding the individual. This value is F. The reciprocal of this value, 1 / F, can then be taken as the time required to visit one frame, i.e., the time information. For example, if M = 23.5 and the number of grid cells to be actually visited is 3, then 8 frames are needed to visit all the spatial grid cells surrounding the individual. Therefore, 1 / 8 of the time required to visit one frame can be obtained, and this 1 / 8 is used as the time information, corresponding to the filtering intensity.

[0163] Furthermore, using the above formula (2), based on the filtering intensity, the data τ representing the influence of individual i on the three basic behaviors of separation, alignment, and aggregation caused by other individuals k is processed.i And, τ′ represents the historical influence data of individual i on the three basic behaviors of separation, alignment, and aggregation caused by other individuals k in the previous frame image. i Perform blending processing. Continuing with the example above, the impact data τ of the current frame is... i Multiply by 1 / 8 (which is τ) i With a weight of 1 / 8, the historical influence data τ′ corresponding to the previous frame image is used. i Multiply by 7 / 8 (which is τ') i With a weight of 7 / 8, the results of multiplying the two are added together to obtain the data after the time filtering process.

[0164] Furthermore, it should be noted that the impact data corresponding to the three basic behaviors of separation, alignment, and aggregation, τ i There are 3 possible values ​​for τ' i There are three possible values ​​for , therefore three possible values ​​for 'result'. These correspond to three data points obtained after time filtering based on the influence data of the intensity on the three basic behaviors of separation, alignment, and aggregation. Inputting these three data points into the bird flocking algorithm simulates the behavior of biological groups. It is evident that by cleverly combining this with the existing formula for calculating the volume of a sphere, the algorithm innovatively utilizes this formula to determine the appropriate filtering intensity, ensuring effective simulation. The simulation results of this method for simulating biological group behavior have been well-validated.

[0165] Additionally, it should be noted that in this embodiment, regardless of the LOD level, temporal filtering is performed on all individuals. The higher the LOD level, the stronger the temporal filtering. In some other examples, as an implementation parallel to this embodiment, it can be first determined whether the LOD level is greater than a preset level. If the LOD level is greater than the preset level, then the influence data is subjected to temporal filtering of different intensities according to the LOD level. If the LOD level is less than or equal to the preset level, then temporal filtering can be omitted, and the behavior of the biological group can be simulated directly based on the influence data. That is, the lower the LOD level, the higher the simulation accuracy and the less noticeable the jitter; the higher the LOD level, the lower the simulation accuracy and the more noticeable the jitter. However, it should be noted that if implemented in this way, it is generally necessary to first find the individuals corresponding to LOD levels that are less than or equal to the preset level, then collect these individuals, and process the collected individuals individually. The computational cost of this process on the GPU is greater than that provided in the embodiments of this application, which perform time filtering operations on all individuals regardless of the LOD level. Therefore, compared to that example, the method provided in the embodiments of this application is advantageous for further improving simulation efficiency.

[0166] It should be noted that Embodiment Nine of this application may also be an improvement based on any one or more embodiments from Embodiment One to Embodiment Seven.

[0167] It is not difficult to see that the method provided in this application embodiment, by applying time filtering of different intensities to the influence data according to the LOD level, can achieve the simulation of biological group behavior by applying time filtering of different intensities to the behavioral parameters of the simulation output, such as speed magnitude and head-tail orientation, and then further simulating the biological group behavior based on the data obtained after the time filtering. This not only smooths out the jitter generated during the simulation calculation, but also helps to reduce the impact of the LOD on the simulated group behavior, and further improves the simulation effect.

[0168] Example 10

[0169] Embodiment 10 of this application provides an apparatus for simulating the behavior of a biological group. The apparatus may include an acquisition module, a determination module, a traversal module, and a simulation module. The acquisition module is used to acquire a target LOD scaling factor, which is used to adjust the balance between simulation effect and GPU performance. The determination module is used to determine the LOD level of each individual in each frame of an image for simulating the biological group, based on the target LOD scaling factor. The traversal module is used to perform spatial traversal on each individual according to the LOD level to obtain influence data for the three basic behaviors affecting the separation, alignment, and aggregation of each individual. The simulation module is used to simulate the behavior of the biological group based on the influence data.

[0170] Specifically, in some examples, the acquisition module is specifically used to monitor the time required to simulate the biological population for each frame of image; acquire the LOD scaling factor of each frame of image; and adjust the LOD scaling factor according to the time consumption to obtain the adjusted target LOD scaling factor for each frame of image.

[0171] Furthermore, in some examples, the acquisition module is specifically used to acquire performance budget data, performance fluctuation data, and the rate of change of the LOD scaling factor; acquire data representing the trend of change of the LOD scaling factor; and adjust the LOD scaling factor according to the time duration, the performance budget data, the performance fluctuation data, the rate of change of the LOD scaling factor, and the data representing the trend of change of the LOD scaling factor to obtain the adjusted target LOD scaling factor for each frame of the image.

[0172] Furthermore, in some examples, the acquisition module is specifically configured to: if the duration of the data consumption is greater than the performance budget data and the trend of the data is not increasing, or if the duration of the data consumption is greater than the sum of the performance budget data and the performance fluctuation data, then adjust the LOD scaling factor according to the LOD scaling factor, the rate of change of the LOD scaling factor, and a first threshold to obtain the target LOD scaling factor; if the duration of the data consumption is less than the performance budget data and the trend of the data is not decreasing, or if the duration of the data consumption is less than the difference between the performance budget data and the performance fluctuation data, then adjust the LOD scaling factor according to the LOD scaling factor, the rate of change of the LOD scaling factor, and a second threshold to obtain the target LOD scaling factor.

[0173] Specifically, in some examples, the determining module is specifically used to acquire first distance information between each individual in space and the target viewpoint; and to determine the LOD level of each individual in each frame of the image used to simulate the biological population based on the target LOD scaling factor and the first distance information; wherein the first distance information and the LOD level are positively correlated.

[0174] Specifically, in some examples, the determining module is specifically used to acquire the second distance information corresponding to the achievement of a preset minimum precision, as well as the maximum LOD level in the LOD level; and to determine the LOD level of each individual of the biological population in each frame image based on the target LOD scaling factor, the first distance information, the second distance information, and the maximum LOD level.

[0175] Specifically, in some examples, the device further includes a construction module for constructing a spatially accelerated data structure; a traversal module specifically for acquiring the grid position information to be accessed for each individual in each frame of image; constructing the spatially accelerated data structure; using the spatially accelerated data structure to access the grid position information to be accessed, so as to distribute the access across multiple frames of image to obtain access results; wherein the degree of access distribution is positively correlated with the first distance information; and based on the access results, obtaining influence data for influencing the three basic behaviors of separation, alignment, and aggregation of each individual.

[0176] Specifically, in some examples, the traversal module is further configured to determine the number of grids to be visited for each individual in each frame of the image based on the LOD level; and to perform spatial traversal based on the number of grids to determine the position offset of each individual in each frame of the image, so as to determine the position information of the grids to be visited.

[0177] Furthermore, in some examples, the traversal module is also specifically used to obtain a pre-set maximum number of grids; and to determine the number of grids to be visited by each individual in each frame of the image based on the pre-set maximum number of grids and the LOD level.

[0178] Furthermore, in some examples, the traversal module is also specifically used to combine any infinitely long low-dissimilarity sequence, perform spatial traversal according to the number of grids, and determine the position offset of each individual in each frame of the image to determine the grid position information to be visited.

[0179] Furthermore, in some examples, the construction module is specifically used to construct the spatial acceleration data structure according to the spatial grid hash algorithm; the traversal module is also specifically used to obtain the field of vision range of each individual in the biological population; according to the spatial acceleration data structure and the field of vision range, to perform an access operation on the grid location information to be accessed, to determine the other individuals in the spatial grid corresponding to each individual in the biological population; and according to the other individuals in the spatial grid corresponding to each individual, to obtain the influence data for influencing the three basic behaviors of separation, alignment and aggregation of each individual.

[0180] Specifically, in some examples, the simulation module is used to perform time filtering of the influence data with different intensities according to the LOD level; and to simulate the behavior of biological groups based on the data obtained after the time filtering.

[0181] Furthermore, in some examples, the simulation module is further specifically used to obtain the volume of a single spatial grid in which each individual resides; determine, based on the volume, the field of view, and the number of grids to be visited, a number of image frames that represent how many image frames need to be distributed to complete one spatial traversal; determine, based on the number of image frames, the time information required to access one image frame; and determine the filtering intensity based on the time information to perform time filtering processing of the influencing data with different intensities.

[0182] It is not difficult to see that Embodiment 10 of this application is a device embodiment corresponding to any one or more of the method embodiments in Embodiments 1 to 9. The implementation details provided by the above method embodiments can be applied to this device embodiment. To avoid repetition, they will not be repeated here.

[0183] Example 11

[0184] Embodiment 11 of this application provides a computer device, the structure of which is as follows: Figure 7 As shown, the device includes a memory 10 for storing computer-readable instructions and a processor 20 for executing the computer-readable instructions, wherein when the computer-readable instructions are executed by the processor, the processor is triggered to execute the method described thereon.

[0185] The methods and / or embodiments in this application can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowchart. When the computer program is executed by a processing unit, it performs the functions defined in the methods of this application.

[0186] It should be noted that the computer-readable medium described in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0187] In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wireline, optical fiber, RF, etc., or any suitable combination thereof.

[0188] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0189] The flowcharts or block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of devices, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-specific system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0190] In another aspect, embodiments of this application also provide a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The aforementioned computer-readable medium carries one or more computer-readable instructions, which may be executed by a processor to implement the steps of the methods and / or technical solutions of the various embodiments of this application.

[0191] In a typical configuration of this application, the terminal and the service network devices each include one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0192] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0193] Computer-readable media include both permanent and non-permanent, removable and non-removable media, which can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, read-only optical disc (CD-ROM), digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0194] Furthermore, this application also provides a computer program stored in a computer device, which causes the computer device to execute the method for executing the control code.

[0195] It should be noted that this application can be implemented in software and / or a combination of software and hardware, for example, using an application-specific integrated circuit (ASIC), a general-purpose computer, or any other similar hardware device. In some embodiments, the software program of this application can be executed by a processor to implement the steps or functions described above. Similarly, the software program of this application (including related data structures) can be stored in a computer-readable recording medium, such as RAM memory, magnetic or optical drives, floppy disks, and similar devices. Furthermore, some steps or functions of this application can be implemented in hardware, for example, as circuitry that cooperates with a processor to perform the various steps or functions.

[0196] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within this application. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in the apparatus claims may also be implemented by a single unit or device in software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any particular order.

Claims

1. A method for simulating the behavior of biological groups, characterized in that, The method includes: Obtain the target LOD scaling factor; the target LOD scaling factor is used to adjust the balance between simulation effects and GPU performance. Based on the target LOD scaling factor, determine the LOD level of each individual in each frame of the image used to simulate the biological population; Based on the LOD level, spatial traversal is performed on each individual to obtain the influence data of the three basic behaviors that affect the separation, alignment and aggregation of each individual; Based on the aforementioned impact data, the behavior of biological groups is simulated.

2. The method according to claim 1, characterized in that, The process of obtaining the target LOD scaling factor includes: For each frame of image, monitor the time required to simulate the biological population; Obtain the LOD scaling factor for each frame of the image; The LOD scaling factor is adjusted based on the time consumption to obtain the adjusted target LOD scaling factor for each frame of the image.

3. The method according to claim 2, characterized in that, The step of adjusting the LOD scaling factor according to the time consumption to obtain the adjusted target LOD scaling factor for each frame of the image includes: Obtain performance budget data, performance fluctuation data, and the rate of change of the LOD scaling factor; Obtain data to characterize the changing trend of the LOD scaling factor; Based on the time consumption, the performance budget data, the performance fluctuation data, the rate of change of the LOD scaling factor, and the data used to characterize the trend of change of the LOD scaling factor, the LOD scaling factor is adjusted to obtain the adjusted target LOD scaling factor for each frame of the image.

4. The method according to claim 3, characterized in that, The step of adjusting the LOD scaling factor based on the time consumption, the performance budget data, the performance fluctuation data, the rate of change of the LOD scaling factor, and the data used to characterize the changing trend of the LOD scaling factor, to obtain the adjusted target LOD scaling factor, includes: If the duration of the time spent is greater than the performance budget data and the trend of change represented by the trend data is not increasing, or if the duration of the time spent is greater than the sum of the performance budget data and the performance fluctuation data, then the LOD scaling factor is adjusted according to the LOD scaling factor, the rate of change of the LOD scaling factor and the first threshold to obtain the target LOD scaling factor; If the time duration is less than the performance budget data and the trend represented by the trend data is not decreasing, or if the time duration is less than the difference between the performance budget data and the performance fluctuation data, then the LOD scaling factor is adjusted according to the LOD scaling factor, the rate of change of the LOD scaling factor, and the second threshold to obtain the target LOD scaling factor.

5. The method according to any one of claims 1 to 4, characterized in that, The step of determining the LOD level of each individual in each frame of the image used to simulate the biological population, based on the target LOD scaling factor, includes: Obtain the initial distance information between each individual and the target viewpoint in space; Based on the target LOD scaling factor and the first distance information, the LOD level of each individual in each frame of the image used to simulate the biological population is determined; wherein, the first distance information and the LOD level are positively correlated.

6. The method according to claim 5, characterized in that, The step of determining the LOD level of each individual in each frame of the image used to simulate the biological population based on the target LOD scaling factor and the first distance information includes: Obtain the second distance information corresponding to the minimum preset accuracy, as well as the maximum LOD level in the LOD level; The LOD level of each individual in the biological population in each frame of the image is determined based on the target LOD scaling factor, the first distance information, the second distance information, and the maximum LOD level.

7. The method according to claim 5, characterized in that, The spatial traversal performed on each individual according to the LOD level to obtain the influence data for the three basic behaviors of separation, alignment, and clustering that affect each individual includes: Obtain the grid location information to be visited for each individual in each frame of the image; Construct spatially accelerated data structures; The spatial acceleration data structure is used to access the grid location information to be accessed, so that the access is distributed across multiple frames of images to obtain the access result; wherein, the degree of access distribution is positively correlated with the first distance information; Based on the access results, impact data for the three basic behaviors of separation, alignment, and aggregation that affect each individual are obtained.

8. The method according to claim 7, characterized in that, The process of obtaining the grid location information to be visited for each individual in each frame of image includes: Based on the LOD level, the number of grids to be visited by each individual in each frame of the image is determined. Spatial traversal is performed based on the number of grids to determine the position offset of each individual in each frame of the image, thereby determining the grid position information to be accessed.

9. The method according to claim 8, characterized in that, The step of determining the number of grids to be visited by each individual in each frame of image based on the LOD level includes: Get the preset maximum number of grid cells; Based on the preset maximum number of grids and the LOD level, the number of grids to be visited by each individual in each frame of the image is determined.

10. The method according to claim 8, characterized in that, The step of spatial traversal based on the number of grids to determine the position offset of each individual in each frame of the image, in order to determine the position information of the grid to be visited, includes: By combining any infinitely long low-difference sequence, spatial traversal is performed according to the number of grids to determine the position offset of each individual in each frame of the image, so as to determine the grid position information to be visited.

11. The method according to claim 8, characterized in that, The construction of the spatial acceleration data structure includes: constructing the spatial acceleration data structure according to the spatial grid hash algorithm; The access to the grid location information to be accessed is performed using the spatial acceleration data structure, and the access is distributed across multiple frames of images to obtain the access results, including: Obtain the field of vision of each individual in the biological population; Based on the spatial acceleration data structure and the field of view, an access operation is performed on the grid location information to be accessed, and other individuals in the spatial grid where the grid location information to be accessed is located for each individual in the biological population is determined. Based on the access results, the influence data for the three basic behaviors of separation, alignment and aggregation used to influence each individual includes: based on other individuals in the spatial grid where the grid location information to be accessed for each individual is located, the influence data for the three basic behaviors of separation, alignment and aggregation used to influence each individual is obtained.

12. The method according to claim 11, characterized in that, The simulation of the behavior of biological groups based on the impact data includes: Based on the LOD level, the impact data are subjected to time filtering of different intensities. The behavior of biological groups is simulated based on the data obtained after the aforementioned time filtering process.

13. The method according to claim 12, characterized in that, The step of performing time filtering of the impact data with different intensities according to the LOD level includes: Obtain the volume of the individual spatial grid in which each individual resides; Based on the volume, the field of view, and the number of grids to be visited, determine the number of image frames required to represent the number of image frames needed to complete one spatial traversal. Based on the quantity value, determine the time information required to access one of the image frames; The filtering intensity is determined based on the time information, so that the affected data are subjected to time filtering processing of different intensities.

14. A device for simulating the behavior of biological groups, characterized in that, The device includes: The acquisition module is used to acquire the target LOD scaling factor; the target LOD scaling factor is used to adjust the balance between simulation effects and GPU performance. The determination module is used to determine the LOD level of each individual in each frame of the image used to simulate the biological population, based on the target LOD scaling factor. The traversal module is used to perform spatial traversal on each individual according to the LOD level to obtain the influence data of the three basic behaviors of separation, alignment and aggregation that affect each individual; The simulation module is used to simulate the behavior of biological groups based on the impact data.

15. A computer device, characterized in that, The device includes: One or more processors; and A memory storing computer program instructions, which, when executed, cause the processor to perform the method as described in any one of claims 1 to 13.

16. A computer-readable medium having stored thereon computer program instructions that can be executed by a processor to implement the method as claimed in any one of claims 1 to 13.