Growth animation generation method and device, equipment and readable storage medium
By determining the branching growth conditions of the biological model through point cloud-driven methods, generating and rendering branch sub-models, the problem of low iterative parsing efficiency of the L-system algorithm in complex branching models is solved, and more efficient animation performance is achieved.
Patent Information
- Application Number
- CN202511836258.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-03-10
AI Technical Summary
When simulating biological models with complex branching effects, existing technologies suffer from low iterative parsing efficiency of the L-system fractal algorithm, resulting in poor animation performance.
By determining attribute information based on the spatial relationship between point clouds and neighboring point clouds in the point cloud space, target point clouds that meet the branch growth conditions are selected, and target line segments are generated in the direction indicating density distribution. The branch sub-models are rendered sequentially using offset length, bypassing the traditional string rewriting parsing.
It improves the animation performance of complex branching biological models, realizes the real-time and diversity of branch growth, and avoids the complex iterative analysis of the traditional L-system algorithm.
Smart Images

Figure CN121639877A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and specifically to a method, apparatus, device, and readable storage medium for generating growth animations. Background Technology
[0002] Virtual game assets related to biological representations, such as virtual models or animations, are a common type of element in games and directly affect the user's gaming experience.
[0003] In particular, for organisms with branching growth effects, such as mycelia, vines, or trees, the relevant technology is often implemented through L-system (Lindenmayer-system, a mathematical model) fractal algorithms. However, these algorithms, which parse strings by piling them up, cause their efficiency to drop exponentially during the iterative growth process, making them particularly unsuitable for organisms with complex branching effects. Summary of the Invention
[0004] This application provides a method, apparatus, device, and readable storage medium for generating growth animations, aiming to partially solve the above-mentioned problems and provide growth animations of virtual models with complex branches.
[0005] In a first aspect, this application provides a method for generating a growth animation, comprising: The attribute information of the point cloud is determined based on the spatial relationship between each point cloud and its neighboring point clouds in the point cloud space; the attribute information includes an offset vector indicating the density distribution of the neighborhood space of the point cloud and an offset length indicating the point cloud density of the neighborhood space of the point cloud. Based on the attribute information of the point cloud, a first target point cloud that meets the preset branch growth conditions is determined from the point cloud; Based on the first target point cloud, a target line segment is generated in the direction indicated by the offset vector of the first target point cloud, and the target line segment is used to indicate the branch sub-model in the target model; Based on the order of the offset length indication, the branch sub-models indicated by the target line segment are sequentially generated during the generation process of the target model to obtain the growth animation of the target model.
[0006] Secondly, this application provides an apparatus for generating growth animation, comprising: The determination module is used to determine the attribute information of the point cloud based on the spatial relationship between each point cloud and its neighboring point clouds in the point cloud space; the attribute information includes an offset vector indicating the density distribution of the neighborhood space where the point cloud is located and an offset length indicating the point cloud density of the neighborhood space where the point cloud is located. The filtering module is used to determine a first target point cloud that meets preset branch growth conditions from the point cloud based on the attribute information of the point cloud. A generation module is used to generate a target line segment in the direction indicated by the offset vector of the first target point cloud, based on the first target point cloud, wherein the target line segment is used to indicate a branch sub-model in the target model; The rendering module is used to sequentially generate branch sub-models indicated by the target line segments during the generation process of the target model based on the order of the offset length indication, so as to obtain the growth animation of the target model.
[0007] The growth animation generation method provided in this application determines the attribute information of point clouds by the spatial relationship between each point cloud and its neighboring point clouds in the point cloud space. This includes the offset vector used to indicate the density distribution of the neighborhood space where the point cloud is located and the offset length of the point cloud density. Then, point clouds that meet the branch growth conditions are selected and line segments used to indicate branch sub-models are generated in the direction indicating the density distribution. Subsequently, each branch sub-model is rendered sequentially according to the order indicated by the offset length. This method can be used to simulate the effect of branches growing in spatial density order in biological virtual models. The method provided in this application can fit the L-system fractal algorithm based on point cloud data processing to simulate the effect of the most important branch sequence growth during the growth process. This avoids the complex iterative analysis in the traditional L-system fractal algorithm and effectively improves the animation performance of biological models with complex branching effects. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0009] Figure 1 This is a schematic diagram illustrating the performance of a branching growth process implemented using an L-system fractal algorithm, which shows that; Figure 2 A flowchart illustrating the steps of a method for generating a growth animation provided in this application embodiment; Figure 3 This application provides a schematic flowchart illustrating the steps of simulating iterative growth to continuously form new branches. Figure 4 A schematic diagram of a growth animation generation device provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0010] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. 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.
[0011] In this application, the term "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes are not described in detail to avoid obscuring the description of this application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0012] To clearly understand the implementation process of the growth animation generation method provided in this application embodiment, the relevant application scenarios of the growth animation generation method are first described below. Specifically, the growth animation generation method provided in this application is suitable for simulating the growth animation of organisms with branching structures, especially focusing on showing the sequential growth process of branching structures in biological models. For example, organisms with branching structures can be vegetation such as vines or trees, or filamentous structures such as mycelia, etc. This application embodiment does not limit this; any growth animation of a model that needs to be represented by showing the sequential growth process of branching structures is within the scope of protection claimed in this application. For ease of description, in the subsequent embodiments of this application, a plant model will be used as an example. At this time, the branch sub-model of the plant model can usually include tree branches and branches further subdivided into twigs, etc. Based on this, the relevant technology mainly relies on the L-system fractal algorithm to simulate the branching growth of organisms. Specifically, the L-system fractal algorithm defines a series of characters to represent the fractal representation effect of branches in the model through a string. For ease of understanding, please refer to [link to relevant documentation]. Figure 1 The diagram illustrates the performance of a branching growth process implemented using an L-system fractal algorithm. It shows that as the number of iterations increases, the virtual model undergoes fractal changes according to specific rules. For example, the above... Figure 1The observed change effect can be represented by the string "F→F+F--F+F", where "F", "+", and "-" are characters defined by the L-system fractal algorithm. "F" represents moving forward, "+" represents turning 60° to the left, and "-" represents turning 60° to the right. Therefore, the string "F→F+F--F+F" means replacing each line segment F with "F' right turn F' left turn then left turn F' right turn F'", and through multiple iterations, the aforementioned branching growth effect can be achieved. Therefore, based on the above scheme, by writing appropriate L-system strings, the growth effect of any branch in the target model can be represented.
[0013] However, while the above approach can effectively represent the changes in the branching structure of the model, it relies on the concatenation and parsing of strings, and the complexity of the n-iteration process is k. n The order is k, where k is the number of times a certain element needs to be processed in each iteration. In other words, the amount of computation increases exponentially with the number of iterations, which seriously affects the real-time branch growth animation effect of some models with complex branches.
[0014] To address the aforementioned technical challenges, this application bypasses traditional string rewriting and parsing. Instead, it utilizes specific procedural modeling tools to process data, simulating the core behavior of L-system systems used to represent the sequential growth of branches. This achieves the iterative growth effect of branches based on point cloud data. Specifically, for ease of understanding, the following will describe the process in conjunction with specific embodiments.
[0015] Please see Figure 2 , Figure 2 This application provides a flowchart illustrating the steps of a method for generating a growth animation, specifically including steps S210 to S240: S210, determine the attribute information of the point cloud based on the spatial relationship between each point cloud and its neighboring point clouds in the point cloud space.
[0016] To bypass traditional string rewriting and parsing, this application's embodiments utilize a point cloud data-driven approach to achieve iterative branch growth. Specifically, since the generation method provided in this application selects point clouds with specific requirements as vertices of the subsequently generated model based on attribute information describing the distribution of the point cloud, this application does not restrict the point cloud data used. For example, it can be irregular point cloud data obtained by scanning any entity scene, or it can be directly read from an online database. It should be noted that the generation method provided in this application can also reverse-engineer existing related models, such as static models with branching structures, to obtain their corresponding growth animation, i.e., transform them into dynamic effects. Therefore, the point cloud space here can also be obtained by scanning a given initial model.
[0017] Based on the aforementioned foundation, considering the growth characteristics of tree branches—that is, the core behavior in the L-system system used to represent the sequential growth of branches (i.e., preferentially generating branches at nodes with lower spatial density, and terminating growth once the spatial density reaches a given condition due to the increase in branches)—in the embodiments of this application, the attribute information of each point cloud is determined based on the spatial relationship between each point cloud and its neighboring point clouds within the point cloud space. Specifically, this attribute information typically includes an offset vector indicating the density distribution of the point cloud's neighborhood and an offset length indicating the point cloud density of the neighborhood. Specifically, the offset vector indicating the density distribution of the point cloud's neighborhood can be understood as the growth direction of the branch, while the offset length indicating the point cloud density of the neighborhood typically indicates the growable space of the branch. Specifically, the attribute information can typically be determined by the vector between the weighted positions of a node and its neighboring nodes. For example, in one embodiment, determining the attribute information of the point cloud based on the spatial relationship between each point cloud and its neighboring point clouds within the point cloud space includes: Identify at least one neighboring point cloud within a preset neighborhood space of each point cloud in the point cloud space; The vector of the weighted average position from the point cloud to its neighboring point clouds is used as the offset vector in the attribute information, and the length of the offset vector is used as the offset length of the attribute information.
[0018] Specifically, the preset neighborhood space can usually refer to the point cloud within a preset radius threshold, that is, the point cloud whose distance from the point cloud does not exceed the radius threshold. In particular, the number of neighboring point clouds determined by sampling usually does not exceed a preset number threshold. That is to say, the neighboring point clouds of a certain point cloud can be the nearest neighbor point clouds obtained within its preset radius threshold, and the number of such nearest neighbor point clouds does not exceed the preset number threshold. Of course, it is also feasible to determine the neighboring point clouds of a point cloud by other means, and this application embodiment does not limit this.
[0019] Building upon this, by further calculating the weighted average position of the neighborhood point cloud, and then calculating the vector from the point cloud to this weighted average position, we can obtain the offset vector of the point cloud. This offset vector can roughly indicate the density distribution of the neighborhood space, for example, pointing to areas where the point cloud distribution is denser within the neighborhood space. Furthermore, by calculating the length of this offset vector, we can obtain the offset length indicating the point cloud density in the neighborhood space. It can be understood that the longer the offset vector length, the longer the average distance between the neighboring point clouds and this point cloud, indicating that the neighborhood space of this point cloud is relatively more open and has greater growth potential. Conversely, the shorter the offset vector length, the shorter the average distance between the neighboring point clouds and this point cloud, indicating that the neighborhood space of this point cloud is relatively more crowded and its growth potential is somewhat limited.
[0020] Of course, the aforementioned solution is only one possible implementation. In fact, it is also feasible to calculate the offset vector, which can be used to indicate the density distribution of the neighborhood space of the point cloud, and the offset length, which can be used to indicate the density of the point cloud in the neighborhood space, based on the spatial relationship between the point cloud and its neighboring point clouds. However, the above method has a lower computational load, and the attribute information can be calculated while scanning the point cloud. It can effectively simulate the core behavior of the L-system system, and also meet the real-time requirements of model growth animation generation implemented by the point cloud-driven method provided in this application. For ease of description, the offset vector and offset length calculated by the above method will be used as an example in the subsequent embodiments of this application. At this time, the longer the vector length of the offset vector, the more spacious the neighborhood space of the point cloud is.
[0021] S220, based on the attribute information of the point cloud, determine a first target point cloud that meets the preset branch growth conditions from the point cloud.
[0022] Based on the aforementioned solution, since the attribute information of point cloud can usually describe the point cloud density and density distribution in its neighborhood space, and can also indicate the probability of the node growing a branch to a certain extent, in one embodiment of this application, a first target point cloud that meets the preset branch growth conditions can be determined from the point cloud based on the attribute information of the point cloud.
[0023] In one embodiment, the preset branch growth condition can typically require nodes to have a certain growth space. Therefore, the point cloud can be detected as the first target point cloud that meets the preset branch growth condition based on whether the offset length of the point cloud exceeds a preset length threshold. Of course, it should be noted that if the offset length is calculated in a way that is positively correlated with the point cloud density, that is, the larger the offset length, the higher the point cloud density in the neighborhood of the indicated point cloud and the more restricted the growth space, then it is necessary to detect whether the offset length is lower than the length threshold to determine whether the point cloud meets the first target point cloud that meets the preset branch growth condition. The two methods achieve equivalent results, and this application will not elaborate on this. For ease of description, the following will use the example of the lower point cloud density in the neighborhood of the indicated point cloud when the offset length is larger as an example.
[0024] Specifically, in order to achieve plant morphological diversity, that is, to allow the generation of different branching structures using the same point cloud data, in one embodiment of this application, the preset length threshold can also be randomly generated for each point cloud. In other words, determining the first target point cloud that meets the preset branching growth conditions from the point cloud based on the attribute information of the point cloud includes: Based on a length threshold randomly generated for each point cloud, point clouds with an offset length exceeding the length threshold are identified as the first target point cloud that meets the preset branch growth conditions.
[0025] In this embodiment, it is understood that the higher the offset length of the point cloud, the higher the probability that it will exceed the randomly generated length threshold. This aligns with the plant growth pattern where branches tend to form in more open areas. Meanwhile, nodes with limited growth space still have a lower probability of branching, thus satisfying the diversity of plant branch morphology. When the same point cloud data is used to drive different scenarios, the target point clouds selected based on different randomly generated length thresholds will vary, resulting in differences in the final simulated plant branch growth effect. Specifically, in one embodiment, the random length threshold for each point cloud can be generated using the Mersenne Twister algorithm to generate a high-quality random threshold. Of course, other methods are also feasible for randomly generating length thresholds for each point cloud, and this embodiment does not limit this approach.
[0026] Furthermore, in some embodiments, considering that in addition to the plant growth pattern of preferential growth in more open areas, the root region or areas near the root tend to generate more branches than the top region during plant growth; that is, more branches are generated near the ground surface, and fewer branches are generated at the top of the plant. Therefore, in addition to considering the offset length of the point cloud density in the neighborhood space of the aforementioned indicator point cloud, the attribute information of the point cloud can usually also include its target distance to a preset target. This preset target can typically be used to indicate the growth location of the target model. For example, the preset target can be a target geometry with a specific surface, which can typically indicate the plant's growth surface. It is understood that the density of vegetation branches often decreases with distance from this target. Therefore, in one embodiment of this application, determining the first target point cloud that meets the preset branch growth conditions from the point cloud based on the point cloud's attribute information can typically also rely on the ratio of the target distance to a preset distance threshold. Specifically, similar to the length threshold, the distance threshold here can also typically be generated randomly using a random algorithm, such as the Mersenne Twister algorithm. That is, in one embodiment of this application, determining the first target point cloud that meets the preset branching conditions from the point cloud based on the point cloud's attribute information includes: Based on a distance threshold randomly generated for each point cloud, point clouds whose target distance does not exceed the distance threshold and whose offset length exceeds the length threshold are determined as the first target point cloud that meets the preset branch growth conditions.
[0027] In particular, in this embodiment of the application, since the density of vegetation branches is inversely proportional to the target distance, by determining the point cloud with a target distance not exceeding the distance threshold as the first target point cloud that meets the preset branch growth conditions, the point cloud with a higher target distance has a lower probability of being selected as the first target point cloud that meets the branch growth conditions, while the point cloud with a lower target distance, that is, the point cloud that is closer to the plant growth surface, often has a higher probability of being determined as the first target point cloud that meets the branch growth conditions. Through the above scheme, the plant growth law of vegetation branch density screening with distance can be realized.
[0028] Of course, the above embodiments use the distance to the geometric surface of the indicator plant's growing area as an example. Conversely, if the distance to the geometric surface above the plant's growing area is used as an example, the selection criteria need to be reversed. That is, point clouds whose target distance exceeds the distance threshold are determined as the first target point cloud that meets the preset branching growth conditions, which can achieve the same effect. In addition, taking the opposite of the distance to the geometric surface of the indicator plant's growing area is also feasible. In particular, in order to reflect the exponential decay of vegetation branch density with distance, a specific power operation can be performed on the target distance, which can also achieve the technical solution of this application. This application embodiment does not limit it here.
[0029] Of course, it should be noted that, considering that plant growth animation is usually an iterative process of generating branches, a specific iteration endpoint is often required. Furthermore, the growth endpoint of plant growth often indicates the absence of a suitable growth space. Therefore, in one embodiment of this application, considering that the offset length of the point cloud changes during iteration as the point cloud is adjusted, especially since generating branches increases the density at that point cloud location, the offset length often decreases, while the target distance often remains unchanged. Therefore, in order to naturally reach the iteration endpoint, in this embodiment, the preset branch growth conditions must at least be related to the offset length. That is, for some specific scenarios or plants, without considering the attenuation of plant branch density with distance, point clouds with offset lengths exceeding the length threshold can be identified as the first target point cloud meeting the preset branch growth conditions. In other scenarios, point clouds with target distances not exceeding the distance threshold and offset lengths exceeding the length threshold can be identified as the first target point cloud meeting the preset branch growth conditions.
[0030] Furthermore, in some embodiments of this application, in order to better determine the first target point cloud that meets the preset branch growth conditions from the point cloud, the offset length and / or target distance can be normalized to map them to a specific range, such as between 0 and 1. Of course, in addition to normalization, other conventional data processing such as noise reduction or cleaning is also feasible without affecting the implementation of the solution, and this application does not limit such processing.
[0031] S230, Based on the first target point cloud, generate a target line segment in the direction indicated by the offset vector of the first target point cloud.
[0032] After filtering point clouds that meet the preset branch growth conditions using any of the aforementioned implementation schemes, a target line segment is generated in the direction indicated by the offset vector of the first target point cloud. This direction can be understood as the "escape direction," simulating the "obstacle avoidance behavior" of plants during growth to form new branches. Specifically, the target line segment can typically indicate branch sub-models within the target model, such as "trunks," "branches," or "twigs" in a tree. It should be noted that, under certain conditions, the trunk of a tree is essentially a special type of "branch," theoretically capable of infinite growth under certain conditions. Furthermore, another point on the target line segment can usually be considered the end point of the branch or a node on the branch, and in actual growth, it can also serve as a further node that meets the branch growth conditions.
[0033] Furthermore, since the model's growth animation is essentially a rendering process from point to line, line to surface, and surface to volume, and since the branching growth process, which is the most important part of the model's growth and is used to fit the actual growth pattern of plants, has already been determined through the aforementioned scheme, under normal circumstances, based on the generated target line segments used to indicate the branch sub-models in the target model, and driven by point cloud data, the effect of branch growth in the model can be simulated by executing a specific model rendering process within the shader. Specifically, the above will be explained in the relevant embodiments in subsequent steps.
[0034] Furthermore, as described above, since the branching growth process of a plant is essentially an iterative process of continuously growing and forming new branches within the allowed growth space until growth terminates when the growth conditions are no longer met, the selection of target line segments based on point cloud attribute information and the generation of new indicator branches in this embodiment is also a similar iterative process. That is, after each growth forms a new branch and node, the attributes of each point cloud are updated, and then target point clouds that meet the branching growth conditions are selected again, and new branches are generated again until the given termination growth condition is reached. Of course, the above iterative process will be explained and illustrated in subsequent specific embodiments.
[0035] S240, based on the order of the offset length indication, the branch sub-models indicated by the target line segment are sequentially generated during the generation process of the target model to obtain the growth animation of the target model.
[0036] In the embodiments of this application, in order to more realistically represent the branch growth animation of the plant, considering that the offset length can be used to indicate the point cloud density in the neighborhood space of the point cloud, and that the point cloud position with a larger growth space is more likely to generate new branches, the corresponding branch sub-models indicated by the target line segments can be generated sequentially during the generation process of the target model based on the order indicated by the offset length, until the final growth animation of the model is obtained, that is, the growth animation performance of the branches in the model.
[0037] Specifically, the above process can typically be implemented using shaders. That is, before generating the growth animation of the model, the obtained target point cloud can be used as the model vertices of the target model, and branch sub-models of the target model can be generated based on the target line segments. Thus, the offset length of the target point cloud can be stored as a point attribute in the model vertices of the target model. In other words, the method also includes: The offset length of the obtained target point cloud is used as the point attribute of the model vertex of the target model, and a branch sub-model of the target model is generated based on the target line segment.
[0038] In the embodiments of this application, the offset length of the point cloud density in the neighborhood space of the point cloud directly corresponds to the growth order. After being stored as the value of the model vertex, the shader can drive the generation of a complete growth animation by reading this data. In particular, it should be noted that, considering the iterative process, that is, the attribute information of the point cloud is constantly being updated during the iteration process, the sequence of offset length updates during the iteration process is usually completely recorded and saved. That is, the offset length sequence of the point cloud can be saved. The offset length sequence includes at least one offset length of the point cloud during the iterative update process. At this time, the offset length sequence of each point cloud density (which may also include the offset vector sequence) will be completely stored in the point attributes of the model vertex.
[0039] Of course, in addition to the solutions provided above, the branch sub-model typically includes multiple model vertices generated based on the interpolation of the target line segment. Since the branch growth effect of a plant can be expressed in more ways than just sequence, such as the thickness or growth rate of the branches, the point attributes of the model vertices of the target model can usually include a thickness coefficient and / or a growth rate coefficient associated with the offset length. The thickness coefficient indicates the thickness of the branch sub-models in the target model, that is, the thickness of each branch in the tree, such as the trunk or twig. The growth rate coefficient indicates the generation rate of the branch sub-models in the target model, such as the growth rate of the trunk or twig. Specifically, for ease of understanding, the thickness coefficient will be used as an example below.
[0040] Specifically, in the embodiments of this application, when generating branches, such as twigs, two values can be stored in the color channel of the model vertex on each branch. For example, the RGB channel stores the coordinates of type float3, which is used to store the coordinates of the vertex with a thickness of 0 in the current branch, while the A channel can store the normalized attribute value, ranging from 0 to 1. The smaller the value, the closer the model vertex is to the root of the branch, and vice versa.
[0041] Then, based on the attributes of channel a, a thickness coefficient between 0 and 1 is mapped to each model vertex. The smaller the coefficient, the thinner the branch segment where the current vertex is located. For example, in one embodiment, the thickness coefficient Mask mapping formula is: Mask=1 smoothstep(lerp(0 width,1,weight),lerp(0,1+width,weight),A) Where Mask is the final thickness coefficient, width is the mask coefficient used to indicate the transition width from 0 to 1, weight is the normalized growth progress of the branch, smoothstep(A, B, X) is the mapping function used to remap the value of X between A and B to between 0 and 1, lerp(A, B, X) is the interpolation function used to obtain the value between A and B, and X is the interpolation tendency.
[0042] Thus, in the final growth animation, by mixing the initial coordinates and the coordinates stored in the vertex color based on the current thickness coefficient of each vertex, the coordinates of its current model vertex can be obtained. This allows the changes in branch thickness to be naturally presented as the growth process unfolds. The final coordinate calculation formula for the model vertex is: Pos final =lerp(Pos thin (Pos, Mask) Pos final Pos is the coordinate of the final calculated model vertex. thin Pos is the vertex coordinate at the lowest coarseness value (0), Pos is the initial coordinate of the vertex, and Mask is the coarseness coefficient calculated above.
[0043] Furthermore, it should be noted that the above-described solution allows for adjustments based on actual transformations while maintaining the original growth efficiency, thereby creating more diverse model transformation effects. In other words, in one embodiment, the method further includes: Keeping the offset length in the point attributes of the model vertices of the target model unchanged, and performing position transformation on the model vertices to obtain the transformed target model vertices; wherein the position transformation includes at least one of translation transformation, scaling transformation and rotation transformation; Based on the transformed target model vertices and the offset length of the target model vertices, branch sub-models indicated by the target line segments are sequentially generated during the generation process of the target model, resulting in growth animations of the target model with different shapes.
[0044] For example, in one embodiment, the coordinates on the YZ plane of the model can be read as the offset vector of the vertex in the radial plane of the curve. Read the coordinates of the model along the X-axis and divide them by the length of the model along the X-axis to obtain the normalized path coordinates. The specific formula is as follows:
[0045]
[0046] By adding a time-incrementing value to the normalized coordinates, the model's sampling points move along the curve, and the coordinates of the vertex on the curve are obtained to acquire the curve data at the corresponding position. The specific formula is as follows:
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057] in, , , as well as These represent the two-dimensional sampled coordinates obtained from the curve simulating the overall deformation, based on normalized coordinates plus a time-increasing value, used to indicate the mixing coefficient, base position, normal vector, and tangent. , , as well as This indicates the data obtained by sampling from a preset data texture object based on the aforementioned two-dimensional sampling coordinates. Wherein, This represents the vector product, which is used to calculate the binormal based on the vector product of the normal vector and the tangent information. and They are respectively The first and second coordinates are used to indicate the thickness and transparency during the rotation transformation process.
[0058] The radial plane basis vectors after rotational transformation are obtained through calculation. The specific formula is as follows:
[0059]
[0060] in, The rotation angle during the rotation transformation process. and This represents the binormal basis vector and normal basis vector after rotation, determined based on the rotation angle.
[0061] A rotation transformation is applied to the offset vector of the vertex in the curve's radial plane to obtain the coordinates of the offset vector after rotation along the axial direction, thus achieving the effect of the model rotating around the path. The specific formula is as follows:
[0062]
[0063] The obtained path coordinates are added to the radial plane offset vector of the model vertex to reconstruct the final vertex coordinates. The specific formula is as follows:
[0064] Furthermore, as described above, the branch growth process in this application relies on iterative update calculations of the point cloud. For a clearer understanding of the above, please refer to [link to relevant documentation]. Figure 3 , Figure 3 This application provides a flowchart illustrating the steps of simulating iterative growth to continuously form new branches, specifically including steps S310 to S330: S310, a second target point cloud and a first target line segment connecting the first target point cloud and the second target point cloud are generated in the direction indicated by the offset vector of the first target point cloud.
[0065] In one embodiment of this application, based on the foregoing description, the offset vector can be considered as an "escape direction" to simulate the "obstacle avoidance behavior" of plants during growth as much as possible. Therefore, a second target point cloud can be generated at a preset distance in the direction indicated by the offset vector of the first target point cloud, and the first and second target point clouds can be connected to obtain the first target line segment indicating the branch. The preset distance can be set based on the actual branch growth behavior of the plant to minimize intersections with other branches. This example uses a two-dimensional representation of the model; a similar approach can be used for three-dimensional models. For example, the preset distance can be a fluctuation value set based on actual needs, such as a random fluctuation within a set distance. Of course, when avoidance is impossible, coupling between branches can form a more complex plant model without affecting the implementation of this application.
[0066] S320, based on the generated second target point cloud, update the attribute information, and based on the updated attribute information, determine the third target point cloud that meets the branch growth conditions again, and generate the fourth target point cloud and the second target line segment connecting the third target point cloud and the fourth target point cloud.
[0067] In the embodiments of this application, after obtaining a new second target point cloud, since the branches of vegetation can still generate new branches, such as twigs, the attribute information of each point cloud will be updated again based on the new point cloud space added to the second target point cloud. It should be noted that, compared to iteratively parsing strings, the calculation of point cloud data parsing is simpler, thus meeting the real-time requirements of animation generation.
[0068] Specifically, it can be understood that updating the attribute information of each point cloud is often due to the generation of new point clouds in the neighborhood space of the point cloud. For example, if a second target point cloud is generated in the neighborhood space of the first target point cloud, the neighborhood point clouds determined by the aforementioned method will change, thus affecting the offset vector indicating the density distribution of the neighborhood space of the point cloud and the offset length used to indicate the density of the point cloud in the neighborhood space. In particular, an increase in the density of the point cloud in the neighborhood space of a point cloud often leads to a decrease in the offset length of that point cloud. Since the preset branch growth condition is set based on the offset length, during the iteration process, when a point cloud gradually generates multiple branches, causing the density of the point cloud in its neighborhood to increase, making it no longer able to meet the branch growth condition, the branch growth at that point cloud will naturally terminate. Once the branch growth at that point cloud terminates, since the density of the point cloud in its neighborhood will only remain unchanged or increase, and with the randomly generated length threshold remaining unchanged, it can no longer meet the branch growth condition, so no new branches will be generated in subsequent iterations.
[0069] In other words, after each attribute information update, a third target point cloud that meets the branch growth conditions is identified again, and a new target line segment is generated, such as the second target line segment connecting the third and fourth target point clouds. Specifically, to simplify the calculation, considering that point clouds that do not meet the branch growth conditions after screening will not meet the branch growth conditions in subsequent iterations, new target point clouds can be obtained by further screening only among the target point clouds that meet the branch growth conditions in the previous round. For example, in the second round of iteration, screening can be performed between the first and second target point clouds to identify the (third) target point cloud that meets the branch growth conditions again. It can be understood that the third target point cloud can be the first target point cloud, that is, for each point cloud, as long as the growth conditions in its neighborhood meet the conditions, multiple target line segments indicating different branches can be generated multiple times. Similarly, the third target point cloud can also be the second target point cloud, that is, for each newly generated point cloud, as long as the growth conditions in its neighborhood meet the conditions, a new branch can be generated again based on the branch it belongs to.
[0070] S330, until no target point cloud meets the branch growth conditions, based on the offset length sequence of each point cloud, sequentially generate branch sub-models indicated by target line segments during the generation process of the target model to obtain the growth animation of the target model.
[0071] Based on the aforementioned descriptions, when there are no longer any target point clouds that meet the conditions for branching growth in the point cloud, that is, after each point cloud has reached the termination condition that conforms to the laws of nature, it can be considered that the branching growth process of the current plant has been completed, and an animation of plant branching growth is naturally generated accordingly.
[0072] Of course, in order to generate animation rendering effects in real time, in the embodiments of this application, the offset length sequence of each point cloud is also saved to realize the linear sequence of the shader to drive the generation of a complete growth animation.
[0073] Furthermore, in some embodiments of this application, the growth animation provided by this application can also be implemented in stages. That is, based on the order of the offset length indication, the branch sub-models indicated by the target line segment are sequentially generated during the generation process of the target model to obtain the growth animation of the target model, including: In response to a stage growth command, based on a proportional threshold associated with the stage growth command, a first branch sub-model indicating a first target line segment is sequentially generated during the generation of the target model in the order indicated by the offset length, wherein the offset length of the target node associated with the first target line segment conforms to the stage growth condition associated with the proportional threshold.
[0074] For example, in one embodiment, the growth progress can be controlled by the ratio of each offset length in the offset length sequence of the target node to the maximum offset length in the sequence, wherein the offset length of the target node associated with the first target segment meets the stage growth condition associated with the ratio threshold. For example, the target segment associated with the node whose offset length to the maximum offset length in the sequence is less than the ratio threshold is taken as the first target segment.
[0075] The growth animation generation apparatus provided in this application determines the attribute information of point clouds by the spatial relationship between each point cloud and its neighboring point clouds in the point cloud space. This includes the offset vector used to indicate the density distribution of the neighborhood space where the point cloud is located and the offset length of the point cloud density. Then, point clouds that meet the branch growth conditions are selected and line segments used to indicate branch sub-models are generated in the direction indicating the density distribution. Subsequently, each branch sub-model is rendered sequentially according to the order indicated by the offset length. This can be used to simulate the performance effect of branches growing in spatial density order in biological virtual models. The method provided in this application can fit the L-system fractal algorithm based on point cloud data processing to simulate the effect of the most important branch sequence growth in the growth process. This avoids the complex iterative analysis in the traditional L-system fractal algorithm and effectively improves the animation performance of biological models with complex branching effects.
[0076] To better implement the growth animation generation method provided in this application, based on the solution of this application, this application also provides a growth animation generation apparatus. Please refer to [link to relevant documentation]. Figure 4 , Figure 4 This application provides a schematic diagram of the structure of a growth animation generation device, specifically including: The determining module 410 is used to determine the attribute information of the point cloud based on the spatial relationship between each point cloud and its neighboring point clouds in the point cloud space; the attribute information includes an offset vector for indicating the density distribution of the neighborhood space where the point cloud is located and an offset length for indicating the point cloud density of the neighborhood space where the point cloud is located. The filtering module 420 is used to determine a first target point cloud that meets the preset branch growth conditions from the point cloud based on the attribute information of the point cloud. The generation module 430 is used to generate a target line segment in the direction indicated by the offset vector of the first target point cloud based on the first target point cloud, wherein the target line segment is used to indicate the branch sub-model in the target model; The rendering module 440 is used to sequentially generate the branch sub-models indicated by the target line segment during the generation process of the target model based on the order of the offset length indication, so as to obtain the growth animation of the target model.
[0077] In one embodiment, the generation module 430 is further configured to generate a second target point cloud and a first target line segment connecting the first target point cloud and the second target point cloud in the direction indicated by the offset vector of the first target point cloud. The attribute information is updated based on the generated second target point cloud, and a third target point cloud that meets the branch growth conditions is determined again based on the updated attribute information, and a fourth target point cloud and a second target line segment connecting the third target point cloud and the fourth target point cloud are generated. Until no target point cloud meets the branch growth conditions, the branch sub-models indicated by the target line segment are sequentially generated in the generation process of the target model based on the offset length sequence of each point cloud to obtain the growth animation of the target model, wherein the offset length sequence includes at least one offset length of the point cloud in the attribute information update process.
[0078] In one embodiment, the filtering module 420 is further configured to determine point clouds whose offset length exceeds the length threshold as first target point clouds that meet preset branch growth conditions, based on a length threshold randomly generated for each point cloud.
[0079] In one embodiment, the filtering module 420 is further configured to determine, based on a distance threshold randomly generated for each of the point clouds, point clouds whose target distance does not exceed the distance threshold and whose offset length exceeds the length threshold as first target point clouds that meet preset branch growth conditions.
[0080] In one embodiment, the rendering module 440 is further configured to use the offset length of the obtained target point cloud as the point attribute of the model vertex of the target model, and to generate a branch sub-model of the target model based on the target line segment.
[0081] In one embodiment, the rendering module 440 is further configured to keep the offset length in the point attributes of the model vertices of the target model unchanged, and to perform position transformation on the model vertices to obtain the transformed target model vertices; wherein the position transformation includes at least one of translation transformation, scaling transformation and rotation transformation. Based on the transformed target model vertices and the offset length of the target model vertices, branch sub-models indicated by the target line segments are sequentially generated during the generation process of the target model, resulting in growth animations of the target model with different shapes.
[0082] In one embodiment, the rendering module 440 is further configured to, in response to a stage growth instruction, sequentially generate a first branch sub-model indicated by a first target line segment in the process of generating the target model, based on a scale threshold associated with the stage growth instruction and in the order indicated by the offset length, wherein the offset length of the target node associated with the first target line segment conforms to the stage growth condition associated with the scale threshold.
[0083] In one embodiment, the determining module 410 is further configured to determine at least one neighboring point cloud that is located in a preset neighborhood space of each point cloud within the point cloud space. The vector of the weighted average position from the point cloud to its neighboring point clouds is used as the offset vector in the attribute information, and the length of the offset vector is used as the offset length of the attribute information.
[0084] Specific limitations regarding the growth animation generation device can be found in the limitations of the growth animation generation method described above, and will not be repeated here. Each module in the aforementioned growth animation generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module. In this embodiment, the attribute information of a point cloud is determined by the spatial relationship between each point cloud and its neighboring point clouds. This includes an offset vector indicating the density distribution of the neighborhood space of the point cloud and an offset length of the point cloud density. Then, point clouds that meet the branching growth conditions are selected, and line segments indicating branch sub-models are generated in the direction indicating the density distribution. Subsequently, each branch sub-model is rendered sequentially according to the order indicated by the offset length. This method can be used to simulate the effect of branches growing in spatial density order in biological virtual models. The method provided in this application can fit the L-system fractal algorithm based on point cloud data processing to simulate the effect of the most important branching sequence during the growth process. This avoids the complex iterative analysis in the traditional L-system fractal algorithm and effectively improves the animation performance of biological models with complex branching effects.
[0085] In some embodiments of this application, the apparatus for generating growth animations can be implemented as a computer program, which can be implemented in, for example... Figure 5 It runs on the computer device shown. The computer device's memory can store the various program modules that make up the generation device of the growth animation, for example, Figure 4The diagram shows a determining module 410, a filtering module 420, a generating module 430, and a rendering module 440. The computer program comprised of these modules causes the processor to execute the steps in the methods for generating growth animations according to the various embodiments of this application described in this specification.
[0086] For example, Figure 5 The computer equipment shown can be used as follows Figure 4 The determining module 410 in the illustrated growth animation generation apparatus executes step S210. The computer device can execute step S220 via the filtering module 420. The computer device can execute step S230 via the generation module 430. The computer device can execute step S240 via the rendering module 440. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communication with external computer devices via a network connection. When the computer program is executed by the processor, it implements a method for generating a growth animation.
[0087] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0088] In some embodiments of this application, a computer device is provided, including one or more processors; memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to perform the following steps: The attribute information of the point cloud is determined based on the spatial relationship between each point cloud and its neighboring point clouds in the point cloud space; the attribute information includes an offset vector indicating the density distribution of the neighborhood space of the point cloud and an offset length indicating the point cloud density of the neighborhood space of the point cloud. Based on the attribute information of the point cloud, a first target point cloud that meets the preset branch growth conditions is determined from the point cloud; Based on the first target point cloud, a target line segment is generated in the direction indicated by the offset vector of the first target point cloud, and the target line segment is used to indicate the branch sub-model in the target model; Based on the order of the offset length indication, the branch sub-models indicated by the target line segment are sequentially generated during the generation process of the target model to obtain the growth animation of the target model.
[0089] In some embodiments of this application, a computer-readable storage medium is provided, storing a computer program that is loaded by a processor, causing the processor to perform the following steps: The attribute information of the point cloud is determined based on the spatial relationship between each point cloud and its neighboring point clouds in the point cloud space; the attribute information includes an offset vector indicating the density distribution of the neighborhood space of the point cloud and an offset length indicating the point cloud density of the neighborhood space of the point cloud. Based on the attribute information of the point cloud, a first target point cloud that meets the preset branch growth conditions is determined from the point cloud; Based on the first target point cloud, a target line segment is generated in the direction indicated by the offset vector of the first target point cloud, and the target line segment is used to indicate the branch sub-model in the target model; Based on the order of the offset length indication, the branch sub-models indicated by the target line segment are sequentially generated during the generation process of the target model to obtain the growth animation of the target model.
[0090] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0091] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0092] The foregoing has provided a detailed description of a method, apparatus, device, and storage medium for generating a growth animation according to embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method of generating a growing animation, characterized by, The method comprises: determining attribute information of each point cloud in a point cloud space based on spatial relationships between the point cloud and its neighboring point clouds; the attribute information comprises an offset vector indicating a density distribution of a neighborhood space where the point cloud is located and an offset length indicating a point cloud density of the neighborhood space where the point cloud is located; determining a first target point cloud meeting a preset branch growth condition from the point clouds based on the attribute information of the point clouds; generating a target line segment in a direction indicated by the offset vector of the first target point cloud based on the first target point cloud, the target line segment being used to indicate a branch sub-model in a target model; sequentially generating branch sub-models indicated by the target line segment in a generation process of the target model based on an order indicated by the offset length to obtain a growth animation of the target model.
2. The method of claim 1, wherein, The method further comprises: generating a second target point cloud in the direction indicated by the offset vector of the first target point cloud and a first target line segment connecting the first target point cloud and the second target point cloud; updating the attribute information based on the generated second target point cloud to determine a third target point cloud meeting the branch growth condition again based on the updated attribute information and generate a fourth target point cloud and a second target line segment connecting the third target point cloud and the fourth target point cloud; until there is no target point cloud meeting the branch growth condition, sequentially generating branch sub-models indicated by the target line segment in the generation process of the target model based on an offset length sequence of each point cloud to perform the step of sequentially generating the branch sub-models indicated by the target line segment in the generation process of the target model based on the order indicated by the offset length to obtain the growth animation of the target model, wherein the offset length sequence comprises at least one offset length of the point cloud in an attribute information updating process.
3. The method of claim 1, wherein, The method further comprises: determining a point cloud whose offset length exceeds the length threshold as the first target point cloud meeting the preset branch growth condition based on a length threshold randomly generated for each point cloud.
4. The method of claim 3, wherein, The attribute information further comprises a target distance of the point cloud to a preset target, the preset target being used to indicate a growth position of the target model; The method further comprises: determining a point cloud whose target distance does not exceed the distance threshold and whose offset length exceeds the length threshold as the first target point cloud meeting the preset branch growth condition based on a distance threshold randomly generated for each point cloud.
5. The method of claim 1, wherein, The method further comprises: using the offset length of the obtained target point cloud as a point attribute of a model vertex of a target model, and generating branch sub-models of the target model based on the target line segment.
6. The method of claim 5, wherein, The branch sub-model includes a plurality of model vertices generated based on interpolation of the target line segment, and point attributes of the model vertices of the target model further include a thickness coefficient and / or a growth speed coefficient associated with the offset length, wherein the thickness coefficient is used to indicate a thickness performance effect of the branch sub-model in the target model, and the growth speed coefficient is used to indicate a generation rate of the branch sub-model in the target model.
7. The method of claim 5, wherein, The method further includes: keeping the offset length in the point attributes of the model vertices of the target model unchanged, and performing position transformation on the model vertices to obtain transformed target model vertices; wherein the position transformation includes at least one of translation transformation, scaling transformation, and rotation transformation; sequentially generating the branch sub-models indicated by the target line segments in the generation process of the target model based on the transformed target model vertices and the offset length of the target model vertices, to obtain a growth animation of the target model with different morphologies.
8. The method of claim 1, wherein, The sequentially generating the branch sub-models indicated by the target line segments in the generation process of the target model based on the order indicated by the offset length to obtain the growth animation of the target model includes: in response to a stage growth instruction, sequentially generating first branch sub-models indicated by first target line segments in the generation process of the target model according to the order indicated by the offset length based on a proportion threshold associated with the stage growth instruction, wherein the offset length of a target node associated with the first target line segment meets a stage growth condition associated with the proportion threshold.
9. The method of claim 1, wherein, The determining the attribute information of the point cloud based on the spatial relationship between each point cloud in the point cloud space and its neighborhood point cloud includes: determining at least one neighborhood point cloud in a preset neighborhood space of each point cloud in the point cloud space; taking a vector from the point cloud to a weighted average position of its neighborhood point cloud as an offset vector in the attribute information, and taking a length of the offset vector as an offset length in the attribute information.
10. The method according to any one of claims 1 to 9, characterized in that, The target model is a virtual model of a living being with a growable branch structure.
11. A device for generating growth animation, characterized in that, includes: a determining module configured to determine attribute information of a point cloud based on a spatial relationship between each point cloud in a point cloud space and its neighborhood point cloud; the attribute information includes an offset vector used to indicate a density distribution of a neighborhood space where the point cloud is located and an offset length used to indicate a point cloud density of the neighborhood space where the point cloud is located; a screening module configured to determine a first target point cloud meeting a preset branch growth condition from the point cloud based on the attribute information of the point cloud; a generating module configured to generate a target line segment in a direction indicated by an offset vector of the first target point cloud based on the first target point cloud, the target line segment being used to indicate a branch sub-model in a target model; a rendering module configured to sequentially generate the branch sub-models indicated by the target line segments in the generation process of the target model based on an order indicated by the offset length, to obtain a growth animation of the target model.
12. A computer device, comprising: The computer device includes: one or more processors; a memory; and One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the method for generating a growth animation according to any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is loaded by a processor to execute the method for generating a growth animation according to any one of claims 1 to 9.