Three-dimensional lightning chain generation method and device, medium and product
By generating three-dimensional lightning chains through three-dimensional endpoint coordinates and fractal simulation algorithms, the problems of low customization and large memory usage of lightning chain special effects are solved, and high realism and smooth game rendering effects are achieved.
Patent Information
- Application Number
- CN202510822466.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-10-03
AI Technical Summary
In the existing technology, the drawing texture scheme of the lightning chain special effect has a low degree of customization, and the vertex animation texture scheme has a large memory usage and performance overhead, making it difficult to achieve high realism and smooth operation in real-time rendering of games.
Through three-dimensional endpoint coordinates and fractal simulation algorithms, a main chain structure that conforms to physical randomness is generated, and a branch chain structure is dynamically derived based on the main chain structure. The three-dimensional lightning chain is rendered in real time, supporting real-time programmatic generation and rendering, avoiding offline software data conversion.
It achieves lightning chain generation with high realism, flexibility and visual expressiveness, reduces memory usage, maintains high frame rate rendering, and ensures smooth operation of game scenes.
Smart Images

Figure CN120747351A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, medium, and product for generating a three-dimensional lightning chain. Background Art
[0002] In real-time game rendering, the Lightning Chain effect utilizes computer graphics technology to simulate the shape and dynamic effects of lightning. This effect uses graphics rendering technology to recreate both the morphological characteristics of lightning (such as its winding trunk and branching structure) and its dynamic characteristics (such as current flow, brightness variations, and random jitter). To ensure smooth gameplay, this effect also needs to adapt to the real-time rendering performance requirements of the game engine, achieving a balance between visual quality and operational efficiency.
[0003] In related technologies, lightning chain special effects solutions that can be used for real-time game rendering mainly include drawing texture solutions and vertex animation texture solutions. Drawing texture solutions are a technical solution that creates a lightning chain special effect by pre-creating a transparent texture in the shape of a lightning bolt and rendering it on a rectangular plane. Vertex animation texture solutions use offline 3D software to create highly complex lightning chain shapes and bake the dynamic effects into the texture to achieve real-time rendering.
[0004] However, the inventors have discovered that there are at least the following technical problems in the related art: the lightning shape of the drawing mapping solution has a low degree of customizability; and the vertex animation mapping solution has a large memory usage and performance overhead. Summary of the Invention
[0005] One purpose of the present application is to provide a method, device, medium and product for generating a three-dimensional lightning chain, at least to solve the technical problems of low customization of lightning shapes in drawing mapping solutions and high memory usage and performance overhead of vertex animation mapping solutions.
[0006] To achieve the above objectives, some embodiments of the present application provide the following aspects:
[0007] In a first aspect, some embodiments of the present application also provide a method for generating a three-dimensional lightning chain, the method comprising: determining a main chain structure based on three-dimensional endpoint coordinates and a fractal simulation algorithm; determining a branch chain structure based on the main chain structure; and generating the three-dimensional lightning chain in real time based on the main chain structure and the branch chain structure; wherein the three-dimensional lightning chain has a dynamically changing three-dimensional lightning morphology.
[0008] In a second aspect, some embodiments of the present application further provide an electronic device comprising: one or more processors; and a memory storing computer program instructions, wherein the computer program instructions, when executed, cause the processor to perform the steps of the method described above.
[0009] In a third aspect, some embodiments of the present application further provide a computer-readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method described above.
[0010] In a fourth aspect, some embodiments of the present application further provide a computer program product, comprising a computer program / instruction, which implements the steps of the above-described method when executed by a processor.
[0011] Compared with the related art, the solution provided by the embodiment of the present application is a new technical solution that is different from the traditional drawing and mapping scheme and vertex animation mapping scheme. In the present application, due to the three-dimensional endpoint coordinates and fractal simulation algorithm, a main chain structure that conforms to physical randomness can be generated, which avoids the problem of immutable morphology in the drawing and mapping scheme, and lays the foundation for flexible adjustment of the lightning core path; due to the spatial distribution characteristics of the main chain structure, a hierarchical branch structure can be dynamically derived. Therefore, without relying on a large amount of preset animation data, the visual complexity and realism can be significantly enhanced, and the degree of customization can be improved; and because the three-dimensional data of the main chain and the branch are fused in real time according to the main chain structure and the branch structure to drive the dynamic rendering engine, the morphologically changing lightning chain simulation can be achieved at a low computing cost, avoiding the high overhead disadvantages of the vertex animation mapping scheme. In addition, since the present application supports real-time procedural generation and rendering, without the need for offline software data conversion, while ensuring realistic visual effects, it can strictly control memory usage, maintain high frame rate rendering, and ensure smooth operation of scenes such as games. It can be seen that through the close causal relationship between each link, this application constructs a complete process from infrastructure construction to dynamic effect presentation, which can not only solve the technical problems in traditional solutions, such as the low degree of customizability of lightning shapes in drawing mapping solutions and the large memory usage and performance overhead of vertex animation mapping solutions, but also achieve high realism, flexibility and visual expressiveness of lightning chain generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] One or more embodiments are exemplarily illustrated by pictures in the corresponding drawings. These exemplifications do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0013] Figure 1 An exemplary schematic diagram of a system for generating a three-dimensional lightning chain provided in some embodiments of the present application;
[0014] Figure 2 An exemplary flow chart of a method for generating a three-dimensional lightning chain provided in some embodiments of the present application;
[0015] Figure 3 An exemplary structural diagram of an electronic device provided for some embodiments of the present application. DETAILED DESCRIPTION
[0016] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0017] The following terms are used in this document.
[0018] The main chain, the physical backbone of Lightning.
[0019] Branches are physical branches extending from the main chain.
[0020] Main chain structure, which describes the mathematical expression of the main chain, such as vertex coordinates, topological connections, curvature parameters, etc.
[0021] Branch structure, which describes the mathematical expression of the branch, such as the start / end point coordinates, path point sequence, morphological parameters, etc.
[0022] The factory pattern defines an interface for creating objects in the parent class, but defers the logic of actually creating the object to the subclass, allowing the subclass to decide which specific object type to instantiate.
[0023] The composite pattern combines objects into a tree structure to represent a "part-whole" hierarchy, so that users can use single objects and composite objects consistently.
[0024] The template method pattern defines the skeleton of an algorithm (i.e., template method) in an abstract class and extends the specific implementation of some steps to subclasses.
[0025] The state machine pattern allows an object to change its behavior accordingly when its internal state changes, making it look like the object has modified its class from the outside.
[0026] First embodiment
[0027] The first embodiment of the present application relates to a method for generating a three-dimensional lightning chain. The method can be applied to a system for generating a three-dimensional lightning chain. For example, the system may include an endpoint module, a line module, and a branch module. Figure 1As shown, the endpoint module may include a shape unit and a sampling unit; the line module may include a line shape unit, a random update unit and a constraint unit; and the branch module may include a branch endpoint unit.
[0028] Specifically, the endpoint module provides basic point data for the Lightning Chain. The shape unit defines basic geometric shapes such as points, disks, and hemispheres, which serve as the morphological source for Lightning Chain endpoints. The sampling unit performs surface or volume sampling on these shapes and randomly generates specific sampling point coordinates using a uniform or Gaussian distribution, providing key endpoint data for subsequent Lightning Chain construction. For example, the endpoint module can be constructed using the factory pattern. The factory pattern separates the interface from the implementation, centralizing the creation logic for Lightning Chain endpoint geometry, effectively improving system scalability and maintainability. Clients can obtain endpoint instances through the factory class without having to worry about the specific generation logic, significantly simplifying code logic. When adding new geometric shapes, developers simply create a new concrete factory class and implement the abstract interface, extending functionality without modifying existing code. This mechanism is compatible with both basic shapes like points, planes, and spheres, as well as complex custom models. This ensures that adding new geometric shapes requires only extending the factory implementation without impacting the main process. This decouples code structure from functional expansion, effectively adapting to diverse special effects production needs.
[0029] Specifically, the line module is primarily used to construct the lightning chain line structure. The line shape unit is used to determine the basic shape of the lightning chain line, such as a straight line, broken line, or Bezier curve. The random update unit can dynamically change the line shape through a fixed, smooth, or hybrid update algorithm combined with recursive offsets. The constraint unit can impose constraints such as overall range, Gaussian distribution deformation, or custom curves on the line to ensure that the line conforms to preset rules during the change process.
[0030] Specifically, the branch module is used to generate the branch structure of the lightning chain. The branch endpoint unit is based on the main chain structure. It can select points on the main chain or associate three-dimensional spatial shapes, main chain endpoint shapes, etc. to determine the starting and ending coordinates of the branch, and then construct a branch that matches the main chain, enriching the overall form of the lightning chain.
[0031] As can be seen, this system utilizes a modular design pattern, breaking down the lightning chain effect into multiple scalable modules such as endpoints, lines, and branches. Combined with a real-time computing and rendering system, this fundamentally addresses the technical challenges of traditional lightning effects, which lack real-time performance and richness. This design allows developers to flexibly adapt the lightning chain form requirements of different game scenarios by quickly adding or adjusting modules. The system also provides intuitive and easy-to-use editing tools, significantly simplifying the lightning chain effect production process and helping developers more efficiently create high-quality, complex lightning effects.
[0032] like Figure 2 As shown, the method may include the following steps:
[0033] Step S101, determining the main chain structure according to the three-dimensional endpoint coordinates and the fractal simulation algorithm;
[0034] Step S102, determining a branched chain structure according to the main chain structure;
[0035] Step S103: generating the three-dimensional lightning chain in real time according to the main chain structure and the branch chain structure; wherein the three-dimensional lightning chain has a dynamically changing three-dimensional lightning shape.
[0036] The following describes each of the above steps in detail.
[0037] For step S101, illustratively, the three-dimensional endpoint coordinates include three-dimensional starting point coordinates and three-dimensional end point coordinates. The three-dimensional endpoint coordinates can be used as the input of the fractal simulation algorithm, and the fractal simulation algorithm generates a complex broken line or curve structure with self-similarity between the three-dimensional starting point coordinates and the three-dimensional end point coordinates. It can be understood that the fractal simulation algorithm continuously adds randomly offset sub-segments to the existing line segments in a recursive or iterative manner to simulate the irregular path of lightning when it propagates in the air, and obtains the main chain structure. Exemplarily, the main chain structure may include but is not limited to: vertex coordinates, topological connection relationships, and curvature parameters. Among them, the vertex coordinates are used to characterize the three-dimensional coordinates of key points on the main chain, the topological connection relationship is used to characterize the connection order and logic between vertices, and the curvature parameter is used to characterize the curvature data of each segment of the main chain.
[0038] For step S102, illustratively, the fractal simulation algorithm can be applied again based on the main chain structure to grow secondary paths outward from the main chain as branches. The growth direction, length and complexity of the branches are usually random. It can be understood that the branch structure itself can further recursively generate smaller sub-branches to form a hierarchical branch network. Exemplarily, the branch structure may include but is not limited to: starting point coordinates / end point coordinates, path point sequence, and morphological parameters. Among them, the starting point coordinates / end point coordinates are used to characterize the three-dimensional positions of the two end points of the branch, and the path point sequence is used to characterize the coordinate set of the key points in the middle of the branch to determine the direction of the branch. The morphological parameters may include length, curvature, distribution density and other data that control the appearance of the branch.
[0039] For step S103, for example, the mathematical expressions of vertex coordinates and topological connection relationships contained in the main chain structure can be integrated with the starting / end point coordinates, path point sequence, and other data in the branch structure and input into a three-dimensional rendering engine. By assigning material properties to the main chain and branches and combining them with time parameter drive, dynamic effects such as the flashing frequency, brightness changes, and shape fluctuations of the lightning chain can be calculated and rendered in real time. For example, by utilizing the iterative characteristics of the fractal simulation algorithm, the tortuous shape of the lightning chain can produce slight random changes, or the luminous intensity of the lightning chain can be adjusted according to a preset rhythm, thereby presenting a lightning shape with a dynamically changing effect in three-dimensional space, achieving the transformation from static structural data to realistic and dynamic three-dimensional lightning chain special effects.
[0040] It's important to note that, compared to the flat effect of a two-dimensional chain lightning, each vertex of the three-dimensional chain lightning in this embodiment is uniquely defined by its X, Y, and Z coordinate components. This allows the chain lightning to freely extend, twist, and intersect within the three-dimensional space defined by its length, width, and height, thereby simulating the complex trajectory of natural lightning in a three-dimensional environment. This allows the three-dimensional chain lightning to flexibly navigate complex terrain and objects in gaming scenarios, such as zigzagging along walls and pillars in a maze.
[0041] In addition, to achieve high-performance simulation of a single lightning bolt, parallel computing technology can be used to implement the fractal simulation algorithm logic, which can simultaneously process the simulation calculations of multiple lightning chains, maintaining high operating performance while ensuring rendering effects. Moreover, the fractal simulation algorithm supports dynamic detail level control, which can automatically adjust the number of vertices of the lightning chain according to the game's image quality requirements: reducing the number of points in low-quality mode to reduce performance consumption, and increasing the number of points in high-quality mode to improve detail performance. In the rendering process, the line rendering system creates vertex buffers and index buffers in real time, and submits the data for rendering, ensuring that the lightning chain special effects are presented smoothly and quickly in the game.
[0042] Understandably, in traditional lightning special effects production, if a drawing texture solution is adopted, artists will artistically draw directly on a two-dimensional texture. This makes the lightning effect fixed in shape, difficult to flexibly adjust according to actual needs, and has a low degree of customizability. If a vertex animation texture solution is adopted, all vertex animation information produced offline needs to be stored in a single texture, and the texture numerical accuracy requirements are high. Compression processing is generally not allowed, resulting in large memory usage and performance overhead.
[0043] It is not difficult to find that compared with the relevant technology, the solution provided by the embodiment of the present application is a new technical solution that is different from the traditional drawing and mapping solution and the vertex animation mapping solution. In the present application, due to the three-dimensional endpoint coordinates and fractal simulation algorithm, a main chain structure that conforms to physical randomness can be generated, which avoids the problem of immutable morphology in the drawing and mapping solution, and lays the foundation for flexible adjustment of the lightning core path; because a hierarchical branch structure can be dynamically derived based on the spatial distribution characteristics of the main chain structure, the visual complexity and realism can be significantly enhanced and the degree of customization can be improved without relying on a large amount of preset animation data; and because the three-dimensional data of the main chain and the branch are fused in real time according to the main chain structure and the branch structure to drive the dynamic rendering engine, the morphologically changing lightning chain simulation can be achieved at a low computing cost, avoiding the high overhead disadvantages of the vertex animation mapping solution. In addition, since the present application supports real-time programmatic generation and rendering without the need for offline software data conversion, while ensuring realistic visual effects, it can strictly control memory usage, maintain high frame rate rendering, and ensure smooth operation of scenes such as games. It can be seen that through the close causal relationship between each link, this application constructs a complete process from infrastructure construction to dynamic effect presentation, which can not only solve the technical problems in traditional solutions, such as the low degree of customizability of lightning shapes in drawing mapping solutions and the large memory usage and performance overhead of vertex animation mapping solutions, but also achieve high realism, flexibility and visual expressiveness of lightning chain generation.
[0044] Second embodiment
[0045] The second embodiment of the present application relates to a method for generating a three-dimensional lightning chain. The second embodiment is an improvement on the first embodiment. Specifically, the improvement is that: in this embodiment, a method for determining three-dimensional endpoint coordinates is provided.
[0046] Specifically, in some embodiments, this step can be implemented by the endpoint module of the system. The method for determining the three-dimensional endpoint coordinates may include the following steps:
[0047] Step S201, determining the geometric shape of a given endpoint;
[0048] Step S202 : determining the three-dimensional endpoint coordinates according to the geometric shape, a preset sampling method, and a preset sampling algorithm.
[0049] The following describes each of the above steps in detail.
[0050] Regarding step S201, illustratively, the geometric shape of the required lightning chain endpoint can be flexibly specified through the shape unit in the endpoint module.
[0051] Optionally, in some embodiments, the geometric shape includes at least one of the following: a point, a plane, a hemisphere, a sphere, and a custom shape. The point provides fixed coordinates for defining the starting and ending positions of the lightning chain; the plane supports random sampling of endpoints within a two-dimensional plane area, and the area shape (such as a rectangle, circle, etc.) can be flexibly set through parameters. When set to a circle, random points within a radius range can be generated on the plane, similar to a "disc"; the hemisphere and sphere refer to generating endpoints based on three-dimensional surface characteristics. The hemisphere is sampled on the hemisphere surface by limiting the angle, and the sphere uses the spherical coordinate system formula to obtain the coordinates of the entire spherical surface; the custom shape generates endpoints of specific shapes by parsing external model files or parametric design to meet the personalized needs of complex models or non-standard geometries.
[0052] Regarding step S202, this step can be implemented, for example, by the sampling unit. The sampling methods may include, but are not limited to, surface sampling and volume sampling. Surface sampling is used to indicate the selection of sampling points on the surface of a geometric shape (e.g., the outer shell of a sphere or a plane surface), while volume sampling is used to indicate the selection of sampling points within the interior space of a geometric shape (e.g., the interior of a solid sphere or a cube).
[0053] Exemplarily, the preset sampling algorithm may be a random sampling algorithm, such as, but not limited to, uniform distribution, Gaussian distribution, etc. Uniform distribution makes sampling points appear with equal probability in space, while Gaussian distribution makes sampling points concentrated in a specific area.
[0054] Specifically, the sampling space range can be determined based on the geometric shape, and the sampling method can be used to determine whether coordinate points are generated on the surface or within the internal volume of the geometric body. The specific three-dimensional coordinates can then be calculated using a preset sampling algorithm. For example, for the "sphere-surface-Gaussian distribution" combination, the system can generate sampling points on the sphere's surface, centered on the center of the sphere and decaying toward the poles. For the "cube-volume-uniform distribution" combination, the system can generate sampling points randomly and with equal density within the cube.
[0055] As can be seen, this embodiment encapsulates the shape unit and sampling unit as independent components, decoupling the sampling logic from the geometric shape. For example, for spherical endpoints, surface uniform sampling or surface Gaussian sampling can be dynamically switched; for spherical endpoints, volume uniform sampling can be used. In some examples, the shape unit can be used to customize the start and end shapes of the lightning chain. Combined with the sampling unit, complex morphological effects can be achieved, such as lightning moving between different shapes.
[0056] In this embodiment, the sampling unit can define a unified sampling interface. By defining a unified sampling interface, seamless switching and replacement of different sampling algorithms can be achieved. This design makes the system highly scalable. When a new sampling strategy such as Poisson distribution is needed, relevant personnel only need to write a new strategy class and implement the interface function without modifying the original code. In this way, through simple parameter configuration, the sampling behavior can be quickly adjusted, significantly improving the flexibility and efficiency of the special effects production process, allowing the system to easily adapt to diverse creative needs.
[0057] It is not difficult to find that in the embodiment of the present application, the geometric shape of the given endpoint is first clarified to avoid coordinate deviations caused by shape ambiguity; then, based on the determined geometric shape, the three-dimensional endpoint coordinates are determined in combination with the preset sampling method and algorithm, achieving a high degree of flexibility and adaptability. Through this strategy of separating shape determination from sampling calculation, the accuracy of coordinate calculation can be guaranteed, and when faced with diverse special effects requirements, the system only needs to adjust the sampling method and algorithm without changing the shape determination logic, significantly improving the efficiency and scalability of three-dimensional endpoint coordinate determination, creating favorable conditions for the diversified presentation of special effects such as three-dimensional lightning chains.
[0058] Third embodiment
[0059] The third embodiment of this application relates to a method for generating a three-dimensional lightning chain. This third embodiment improves upon the first embodiment, specifically by providing a specific implementation method for determining the main chain structure based on three-dimensional endpoint coordinates and a fractal simulation algorithm.
[0060] Specifically, the main chain structure is determined according to the three-dimensional endpoint coordinates and the fractal simulation algorithm, that is, step S101, can further include the following steps:
[0061] Step S1011, determining the initial shape of the main chain according to the three-dimensional endpoint coordinates and the preset basic lines;
[0062] Step S1012: determining the main chain structure according to the initial form and the fractal simulation algorithm.
[0063] The following describes each of the above steps in detail.
[0064] For step S1011, exemplarily, this step can be implemented by the line shape unit in the line module. The preset basic lines in the line shape unit may include at least one of the following: a straight line, a broken line, and a Bezier curve. In this way, the line shape unit can provide a variety of basic lines, which is conducive to meeting the complex and changeable dynamic effect requirements of the lightning chain. If the basic line is a straight line, the three-dimensional endpoint coordinates can be directly connected to form a straight line path to obtain the initial shape of the main chain; if the basic line is a broken line, random vertices can be inserted between the endpoints to generate a broken line path composed of multiple straight lines, simulating the tortuous characteristics of natural lightning, and obtaining the initial shape of the main chain; if the basic line is a Bezier curve, the endpoints can be used as control points, combined with intermediate parameters such as curvature and control point position to generate a smooth curve path to obtain the initial shape of the main chain.
[0065] As can be seen, the initial shape of the main chain is constructed from the three-dimensional endpoint coordinates and preset basic lines. This process transforms abstract spatial coordinates into visual geometric lines, clarifying the starting position, end position, and basic direction of the main chain. In this step, relevant personnel can choose different types of basic lines according to actual needs. This choice can directly affect the shape and style of the final lightning chain. For example, if a straight line is selected as the basic line, the generated lightning chain main chain will have a rigid and sharp shape; if a Bezier curve is selected, a smoother and softer shape can be created.
[0066] Optionally, in some embodiments, the line shape unit can be constructed using the combination pattern and the factory pattern. The factory pattern is used to uniformly manage the creation of basic lines, encapsulating the creation logic of lines such as straight lines and Bezier curves. The client only needs to call the interface to obtain the line instance without having to worry about the specific implementation; the combination pattern is used to build a composite structure of basic lines, supporting the combination of simple lines and complex lines, and maintaining a unified operation interface to ensure that the line module is clearly hierarchical and flexible. With the cooperation of the two, if a new basic line type (such as a spiral line) is needed, it is only necessary to use the factory pattern to expand the line creation logic and include the new line as a composite structure component in the combination pattern without changing the existing code framework. In this way, it is easy to meet the diverse needs of lightning chain forms. Whether it is a simple straight lightning or a complex curve branch combination, it can be quickly implemented through configuration and expansion, significantly improving the flexibility and efficiency of special effects design.
[0067] Regarding step S1012, illustratively, based on the initial form, the line segments or curve segments corresponding to the initial form are split and offset layer by layer through the recursive processing logic of the fractal simulation algorithm. This allows the initial form to evolve from a simple form into a three-dimensional fractal form that includes multi-level jitter, branching, or complex undulations. For example, during each iterative segment subdivision, an offset calculation can be performed on each vertex of the three-dimensional lightning chain based on the three-dimensional space vector. The direction and modulus characteristics of the vector are used to control the direction and amplitude of the offset, so that the lightning chain exhibits natural forms such as irregular bends and jitters in three-dimensional space.
[0068] Optionally, in some embodiments, the main chain structure is determined according to the initial form and the fractal simulation algorithm, that is, step S1012 may specifically include: determining the main chain structure according to the initial form, the fractal simulation algorithm and a preset update strategy; wherein the preset update strategy is used to determine the dynamic adjustment rules of the initial form.
[0069] Exemplarily, this step can be implemented by the random update unit in the line module. The update strategy can include at least one of the following: jump update, smooth update, and mixed update. In this way, the random update unit can provide multiple update strategies, which is conducive to meeting the requirements of complex and variable lightning chain dynamic effects. In other words, the initial form can be dynamically fractal processed by combining the initial form, the recursive logic of the fractal simulation algorithm, and the preset update strategy. Different update strategies can drive the initial form to generate different main chain structures.
[0070] Among them, the jump update is to make the initial form produce a sudden offset or branch during the fractal process, such as violent jitter, sharp-angle turning and other changes, thereby shaping a fractal structure with clear edges and corners and a sharp style; the smooth update can adopt a continuous and gradual offset rule to smoothly adjust the vertices along the tangent direction of the curve, so that the fractal form maintains a rounded and smooth curve feature and presents a soft and natural visual effect; the mixed update is to combine the jump and smooth modes and flexibly apply them according to different path requirements. For example, smooth offset is used on the main path to maintain overall continuity, and jump offset is used on the branch path to increase detail changes, ultimately generating a complex fractal form with both sudden details and overall smoothness.
[0071] Optionally, in some embodiments, the template method pattern can be used to construct the random update unit. Specifically, when the template method pattern is used to construct the random update unit, an abstract base class can be designed first to build a unified update framework. The base class defines standard steps such as initialization, update calculation, and result output through the template method, solidifies common logic such as data verification and status recording, and reserves abstract methods to provide personalized implementation interfaces for different update strategies such as jump and smoothing. In addition, the random update unit can also support controlling the update frequency and path details respectively by adjusting the update interval and subdivision parameters, so as to achieve a balance between special effects visual effects and system performance. This design cleverly uses the template method pattern to standardize the update process, which can not only ensure the consistency of the execution of different strategies, but also quickly expand complex update strategies by adding new subclasses, significantly improving the maintainability and scalability of the system.
[0072] It should be noted that this embodiment may also be an improvement based on the second embodiment.
[0073] It is not difficult to see that in the embodiments of the present application, by determining the initial form of the main chain based on the three-dimensional endpoint coordinates and preset basic lines, abstract spatial coordinate information can be converted into intuitive geometric lines, clarifying the starting and ending positions and basic direction of the main chain. At the same time, the choice of different types of basic lines directly affects the initial form style of the main chain, providing a precise morphological foundation for subsequent fractal simulation. Based on this determined initial form, a fractal simulation algorithm is applied for further processing. The fractal simulation algorithm utilizes self-similarity and different update strategies to generate details layer by layer on the initial form, resulting in natural twists, branches, and other changes in the main chain structure. With this initial form as a starting point, the fractal simulation algorithm can efficiently and accurately create a main chain structure that conforms to physical laws and has a realistic feel. This step-by-step determination of the main chain structure not only ensures the accuracy of the basic form, but also, through fractal simulation, imbues the main chain structure with rich details and dynamic changes, achieving the transformation from simple geometric lines to a complex and realistic main chain structure, further enhancing the authenticity and visual expression of the three-dimensional lightning chain main chain structure.
[0074] Fourth embodiment
[0075] The fourth embodiment of this application relates to a method for generating a three-dimensional lightning chain. The fourth embodiment is an improvement on the third embodiment, specifically providing a specific implementation method for determining the main chain structure based on the initial form and the fractal simulation algorithm.
[0076] In some embodiments, the fractal simulation algorithm may be, for example, an escape time algorithm, a diffusion-limited aggregation algorithm, etc. In this embodiment, the fractal simulation algorithm is a recursive midpoint displacement algorithm; determining the main chain structure based on the initial morphology and the fractal simulation algorithm, i.e., step S1012, may further include:
[0077] Step S1012A, determining the current line segment to be processed according to the initial shape;
[0078] Step S1012B, repeatedly perform the following fractal operations until the iteration termination condition is met: determine the midpoint between the starting point and the end point of the current line segment to be processed; according to the preset offset parameters, spatially offset the midpoint to generate an offset vertex; split the current line segment to be processed into a first sub-segment and a second sub-segment; the first sub-segment represents the distance from the starting point to the offset vertex, and the second sub-segment represents the distance from the offset vertex to the end point; use the first sub-segment and the second sub-segment as the new current line segment to be processed.
[0079] Step S1012C: determining a main chain structure according to the offset vertex, the starting point, and the end point.
[0080] For step S1012A, illustratively, the current line segment to be processed can be determined based on the starting point and end point of the initial form. If the initial form is a single straight line segment, the straight line segment can be directly used as the current line segment to be processed; if the initial form is a broken line or a complex form composed of multiple line segments, each component line segment (such as a broken line segment or a line segment after curve subdivision) can be selected in sequence as the current line segment to be processed. It can be understood that in space, whether it is a straight line, a broken line, or a curve, it is composed of a series of vertices or sampling points with known positions. The starting and ending endpoints of the straight line, broken line, or curve can be marked as A and B, and the corresponding current line segment to be processed can be represented by AB.
[0081] For step S1012B, illustratively, the midpoint between the starting point and the end point of the current line segment to be processed can be first determined, and then the midpoint can be spatially offset according to preset offset parameters, such as offset direction, distance range, etc., to generate a new offset vertex. Further, the current line segment to be processed can be split into two segments, the first sub-segment is the sub-segment from the starting point to the offset vertex, and the second sub-segment is the sub-segment from the offset vertex to the end point; then these two newly generated sub-segments are used as the current line segment to be processed in the next step, and the above-mentioned offset and splitting operations are repeated again. Exemplarily, the number of points offset each time can be increased by powers of 2 (1 point for the first time, 2, 4, 8 points in succession...), so that the line segment is continuously refined and self-similar fractal details are generated until the iteration termination condition is met.
[0082] The preset offset parameter and the termination condition may be provided by the random update module. For example, the termination condition may be: the length of the current line segment to be processed is less than a preset threshold, the number of recursions reaches an upper limit, etc., which is not specifically limited in this embodiment.
[0083] Optionally, in some embodiments, different update strategies may correspond to different iteration termination conditions. In this way, the recursive midpoint displacement algorithm can automatically match the corresponding iteration termination conditions according to different update strategies, thereby achieving flexible control of the fractal process.
[0084] For step S1012C, illustratively, when the iteration termination condition is met, all generated offset vertices can be connected to the start and end points of the initial line segment in sequence according to the operation order, and a continuous path is formed by orderly connecting these vertices. This path is the main chain structure after fractalization.
[0085] For example, if the initial form is a straight line segment AB in three-dimensional space with starting coordinates A(0,0,0) and ending coordinates B(10,0,0), the straight line segment AB can be used as the current segment to be processed. Then, a fractal operation is performed on the straight line segment AB: the midpoint M(5,0,0) is found, and the midpoint is spatially offset according to a preset offset parameter, such as a random offset of 0-2 units along the y-axis to generate an offset vertex. In this way, M is offset to C(5,1,0). The straight line segment AB is split into a first sub-segment AC and a second sub-segment CB, and the recursion is continued with the first and second sub-segments as the new current segments to be processed. When the iteration termination condition is met, such as the lengths of all sub-segments are less than the termination threshold (such as 1 unit), all vertices can be connected in sequence (A→C→...→B) to obtain the main chain structure.
[0086] It should be noted that this embodiment may also be an improvement based on the first embodiment and / or the second embodiment.
[0087] It is not difficult to find that in the embodiment of the present application, since the current line segment to be processed is determined from the initial form and the midpoint offset and line segment splitting are performed layer by layer, new offset vertices can be generated in each layer of recursion based on the preset offset parameters, so that the simple initial line segment gradually evolves into a complex structure containing multi-level self-similar details; and because the recursive depth and the degree of segment refinement are controlled by the iterative termination condition, an expected fractal main chain structure can be generated within a reasonable computational complexity, realizing dynamic evolution from the basic form to one with fractal characteristics, meeting the simulation requirements of lightning, and improving the detail richness and visual realism of the main chain structure.
[0088] Fifth embodiment
[0089] The fifth embodiment of this application relates to a method for generating a three-dimensional lightning chain. This fifth embodiment is an improvement on the fourth embodiment. Specifically, while the fourth embodiment can directly determine the main chain structure based on the offset vertex, the starting point, and the end point, this embodiment further optimizes the method for determining the main chain structure.
[0090] Specifically, determining the main chain structure according to the offset vertex, the starting point, and the end point, that is, step S1012C may include:
[0091] Step C1, determining a jitter line segment according to the offset vertex, the starting point, and the end point;
[0092] Step C2, determining an offset vector according to the jittered line segment and the current line segment to be processed determined based on the initial shape;
[0093] Step C3: determining the main chain structure according to the current line segment to be processed and the offset vector.
[0094] For step C1, exemplarily, after the fractal recursive process is completed, all generated offset vertices can be connected to the starting point and end point of the initial line segment in sequence according to the order of operations to form the jittering line segment. It should be noted that in the fourth embodiment, the jittering line segment is directly used as the main chain structure after the fractal, while in this embodiment, the jittering line segment is only an intermediate product and needs to be subsequently processed through steps C2 and C3 to obtain the main chain structure after the fractal. Taking an initial line segment in three-dimensional space as an example, the starting point coordinates of the initial line segment are A(0,0,0) and the end point coordinates are B(10,0,0). The offset vertices C(3,2,0), D(6,-1,0) and E(8,1.5,0) are generated by the recursive midpoint displacement algorithm. The starting point A, the offset vertices C, D, E and the end point B are connected in sequence according to the order of operations, and the resulting line segment A→C→D→E→B is the jittering line segment. Compared with the initial line segment AB, the jittering line segment produces an up-and-down "jittering" effect in space, presenting fractal details.
[0095] For step C2, illustratively, the spatial offset direction and distance of each corresponding point on the jittering segment relative to the same position point of the original segment can be calculated by comparing the jittering segment with the original segment in the initial form (the current segment to be processed), thereby determining the offset vector of each point. The offset vector is used to characterize the specific change amount of each position point in the fractal process, reflecting the characteristic change from the initial form to the jittering form. For example, the offset value of any point on the jittering segment relative to the original segment can be quantified. Continuing with the example in step C1: by comparing the jittering segment with the original segment AB, the corresponding points are determined according to the ratio of the segment length: the corresponding points at 30%, 60%, and 80% positions on the original segment AB are A'(3,0,0), B'(6,0,0), and C'(8,0,0), respectively.
[0096] Furthermore, we can calculate the offset vectors of each point on the jittered segment relative to the corresponding point on the original segment. Here, the offset vector of point C (3, 2, 0) relative to A' (3, 0, 0) is (0, 2, 0), the offset vector of point D (6, -1, 0) relative to B' (6, 0, 0) is (0, -1, 0), and the offset vector of point E (8, 1.5, 0) relative to C' (8, 0, 0) is (0, 1.5, 0). (0, 2, 0) represents an offset of 2 units in the Y-axis direction, (0, -1, 0) represents an offset of 1 unit in the negative Y-axis direction, and (0, 1.5, 0) represents an offset of 1.5 units in the positive Y-axis direction.
[0097] For step C3, illustratively, the offset vector can be applied to the corresponding position points of the initial form, so that the positions of the points in the initial form are adjusted according to the direction and distance indicated by the offset vector, thereby generating a new main chain structure that incorporates fractal details. Continuing with the example in step C2, it is known that the endpoint coordinates of the initial line segment AB are A(0,0,0) and B(10,0,0), and the jittering line segment generated by fractal recursion is A→C(3,2,0)→D(6,-1,0)→E(8,1.5,0)→B, and the offset vector of the point C at the 30% position on the jittering line segment relative to the corresponding point of the original line segment AB has been calculated to be (0,2,0). Assume that the initial form is a broken line A→P1(3,0,0)→B, where point P1 is located at the 30% position of line segment AB. When determining the main chain structure, we can first find point C at the same proportional position on the jitter segment based on the relative position of point P1 on the original line segment AB (30%). The corresponding offset vector is (0,2,0). Then, we superimpose the offset vector (0,2,0) on the original coordinates of point P1 to obtain the new vertex coordinates P1' = (3,0,0) + (0,2,0) = (3,2,0). Furthermore, we connect A (0,0,0), P1' (3,2,0) and B (10,0,0) in sequence to form a new fractal line A → P1' → B. Compared to the original line, the new fractal line is offset by 2 units upward at the position of point P1, showing a more obvious jitter effect and showing the changes in details after the fractal.
[0098] Optionally, in some embodiments, determining the offset vector according to the jittered line segment and the current line segment to be processed determined based on the initial form, that is, step C2 may include:
[0099] Step C21, determining a target point on the jittering line segment;
[0100] Step C22: determining a matching point on the current line segment to be processed based on the path length ratio of the target point in the jittered line segment; wherein the path length ratio of the matching point in the current line segment to be processed is equal to the path length ratio of the target point in the jittered line segment;
[0101] Step C23: determining the offset vector according to the target point and the matching point.
[0102] For step C21, illustratively, a target point for calculating the offset vector can be selected on the jittering line segment. The target point can be any point on the jittering line segment, an offset vertex generated during the recursive process, or a sampling point on the line connecting vertices.
[0103] For step C22, illustratively, the ratio of the path length of the target point from the starting point to the point in the jittering segment to the total length of the entire jittering segment can be calculated first. Then, on the current segment to be processed (such as the original segment) determined based on the initial form, the corresponding position is found according to the same ratio to determine the matching point. For example, if the target point is at a position 30% from the starting point in the jittering segment, then the matching point is determined at a position 30% of the current segment to be processed to ensure that the relative position ratios of the two in their respective segments are consistent.
[0104] For step C23, for example, the coordinate difference between the target point and the matching point in three-dimensional space can be calculated to obtain an offset vector containing direction and distance information. The offset vector is used to describe the offset of the target point relative to the matching point, that is, the displacement direction and distance from the matching point to the target point in space. It reflects the morphological change characteristics of the position during the fractal process.
[0105] For example, assuming the initial line segment is a straight line connecting A(0,0,0) and B(10,0,0), fractal recursion yields the jittered line segment A→C(3,2,0)→D(6,-1,0)→E(8,1.5,0)→B. In step C21, point C(3,2,0) on the jittered line segment is selected as the target point. In step C22, the path length of point C in the jittered line segment is calculated to account for approximately 30% (the relative position from A to C). Based on this, point A′(3,0,0) at the 30% position on the original line segment AB is found as the matching point. In step C23, the offset vector (0,2,0) is calculated by calculating the coordinate difference between the target point C(3,2,0) and the matching point A′(3,0,0). This offset vector indicates that the target point on the jittered line segment is offset by 2 units in the y-axis direction from the corresponding position on the original line segment.
[0106] It should be noted that the superposition of offset vectors is based on length ratios, not perpendicular projections. Specifically, based on the relative position ratios of each vertex on the original line, an offset vector corresponding to the proportional position is found on the jittered segment and superimposed onto the coordinates of the corresponding vertex on the original line. This ensures that the resulting fractal main chain structure uses the original line as its underlying path, preserving the original line's topological structure while also creating a fractal jitter effect through offset superposition.
[0107] Optionally, in some embodiments, determining the main chain structure according to the current line segment to be processed and the offset vector, that is, step C3, may include:
[0108] Step C31, determining a jitter point based on the matching point and the offset vector;
[0109] Step C32: determining the main chain structure according to the jitter points.
[0110] For step C31, illustratively, after obtaining the matching points and corresponding offset vectors on the current line segment to be processed, each matching point can be considered a base position, and the position of the point can be adjusted in space based on the corresponding offset vector. The coordinate values of the offset vector can be superimposed with the coordinate values of the matching point to obtain a new position point, which is the jitter point.
[0111] Regarding step C32, illustratively, after all the jitter points are acquired, they can be connected sequentially in a certain order. Because the jitter points are generated based on the current line segment to be processed and the offset vector, the order in which they are connected typically corresponds to the order of the points on the original line segment. By sequentially connecting all the jitter points, a complete line is constructed, which serves as the main chain structure after the fractal.
[0112] For example, assuming the current line segment to be processed is AB (A(0,0,0) to B(10,0,0)), matching points A′(3,0,0) (corresponding to target point C(3,2,0)) and B′(6,0,0) (corresponding to target point D(6,-1,0)) have been determined in step C2, with offset vectors (0,2,0) and (0,-1,0), respectively. In step C31, matching point A′ is superimposed on the offset vector (0,2,0) to obtain the jitter point C′(3,0,0)+(0,2,0)=(3,2,0); similarly, matching point B′ is superimposed on the offset vector (0,-1,0) to obtain the jitter point D′(6,0,0)+(0,-1,0)=(6,-1,0). In step C32, the starting point A(0,0,0), the jitter point C′(3,2,0), D′(6,-1,0) and the end point B(10,0,0) are connected in the order of the original line segments to form the fractal main chain structure A→(3,2,0)→(6,-1,0)→B.
[0113] It can be seen that the offset vector generated by the recursive midpoint displacement algorithm can be superimposed on the three lines (straight line, broken line, Bezier curve) according to the above-mentioned length ratio matching rules. The final output is a path based on the original line, superimposed with fractal jitter details, forming a shape similar to a "lightning chain". Among them, corresponding to the straight line, due to the superposition of zero offset or a small random offset, a slightly jittered straight line (or still a straight line) appears. Corresponding to the broken line, a jitter offset can be introduced at the midpoint of each line segment on the basis of the original inflection point to form a fractal broken line with denser jagged teeth. Corresponding to the Bezier curve, superimposing an offset at the curve control point or sampling point can make the smooth curve produce self-similar jitter fluctuations, maintaining the overall direction of the curve while increasing the complexity of the details.
[0114] It should be noted that in this embodiment, the offset processing for straight lines is the same as that for curves and polylines, following the unified logic of superimposing offset vectors. However, the offset vector value superimposed on straight lines is zero, resulting in no visual position change. This design differs fundamentally from the traditional algorithm in the fourth embodiment: the traditional algorithm directly generates the main chain structure through recursive offsets, and different line types are processed independently. In contrast, this embodiment unifies the offset processing for all lines into an overlay operation. A recursive midpoint displacement algorithm is first used to generate offset vectors for the jittered line segments, which are then extracted as reusable jitter features. These features are then superimposed onto the original curve or polyline based on positional correspondence. This allows the target line to exhibit the complex form of fractal jitter while maintaining its original path. Furthermore, to ensure the accuracy of the offset position, the system also employs length proportional mapping to avoid errors caused by geometric projection, ensuring that all three line types, straight lines, curves, and polylines, can generate a natural and realistic fractal jitter effect based on their inherent path characteristics.
[0115] It should be noted that this embodiment may also be an improvement based on any one or more of the first to third embodiments.
[0116] It is not difficult to find that in the embodiment of the present application, by determining the jittering line segment according to the offset vertex, starting point and end point, a specific morphological reference can be provided for the subsequent offset calculation, the abstract vertex coordinates can be converted into line segments with actual shapes, the direction and amplitude range of the jitter can be clarified, and the foundation for accurately controlling the fractal jitter of the main chain is laid. On this basis, the offset vector is determined according to the jittering line segment and the current line segment to be processed. Since there is a specific jittering line segment as a basis, the offset and direction of each position can be accurately calculated. When determining the main chain structure based on the current line segment to be processed and the offset vector, because the first two steps have provided accurate line segment morphology and offset parameters, the offset vector can be accurately superimposed on the current line segment to be processed, so that the main chain can generate a natural fractal jitter effect while maintaining the original path direction. In this embodiment, through the causal progressive relationship, from the initial construction of the jitter shape to the precise calculation of the offset parameters, and then to the generation of the final main chain structure, it is possible to ensure the accuracy and controllability of the main chain shape changes, and to achieve diversified fractal effects by flexibly adjusting the offset vector, thereby generating a complex main chain structure that meets different needs, significantly improving the realism and visual expressiveness of the three-dimensional lightning chain special effects.
[0117] Sixth embodiment
[0118] The sixth embodiment of this application relates to a method for generating a three-dimensional lightning chain. This sixth embodiment is an improvement on the first embodiment, specifically providing a specific implementation method for determining the main chain structure based on the three-dimensional endpoint coordinates and the fractal simulation algorithm.
[0119] Specifically, in some embodiments, determining the main chain structure based on the three-dimensional endpoint coordinates and the fractal simulation algorithm includes: determining the main chain structure based on the three-dimensional endpoint coordinates, the fractal simulation algorithm and preset constraint rules; the constraint rules are used to perform differentiated constraints on the main chain structure.
[0120] Exemplarily, this step can be implemented using the constraint unit in the line module. These constraints can be used to apply targeted constraints to properties such as the length, curvature, and extension direction of the main chain. For example, using Gaussian constraints to add random fluctuations to specific segments, or using custom curve constraints to shape a specific shape, can modify the original main chain structure to meet the requirements of the special effect design.
[0121] Furthermore, the branch chain structure can be determined according to the main chain structure, and the three-dimensional lightning chain can be generated in real time according to the main chain structure and the branch chain structure.
[0122] Optionally, in some embodiments, the constraint rules may include at least one of the following: an overall constraint, a Gaussian constraint, and a custom curve constraint.
[0123] The overall constraints are used to limit the global properties of the main chain, allowing the lightning chain special effects to better adapt to the scene requirements. For example, by adjusting the total length of the main chain, it can be adapted to the specific scene space, avoiding being too long or too short to affect the visual effect. By constraining the starting and ending coordinates of the main chain, the position of the lightning chain can be precisely located in three-dimensional space, ensuring that the special effects appear in the correct area. The overall extension direction of the main chain in space can also be controlled to ensure that the direction of the lightning chain conforms to the basic layout plan of the special effects design.
[0124] The Gaussian constraint is used to add natural randomness and subtle variation to the lightning chain effect. Based on a Gaussian distribution algorithm, the Gaussian constraint assigns a random offset to each vertex on the lightning chain's main chain, creating an irregular curvature. By adjusting parameters like the mean and variance of the Gaussian function, researchers can flexibly control the amplitude and frequency of random fluctuations. For example, increasing the variance can make the lightning chain's bends more exaggerated, while decreasing the mean can adjust the overall offset direction.
[0125] The custom curve constraint allows users to shape the lightning chain's form. Within this constraint, users can match the vertices of the lightning chain's main chain to a pre-set parametric curve. By adjusting the control points of the custom curve or modifying the parameters of the curve function, the main chain's curvature, inflection points, and overall extension can be flexibly and precisely altered. This custom curve constraint cleverly blends the precision of human design with the randomness of natural fractals, creating unique lightning chain effects.
[0126] Optionally, in some embodiments, the constraint unit can be constructed using a template method pattern. Specifically, an abstract class can be defined to build a special effects generation process framework covering initialization, segment processing, dynamic rendering, and other steps. The specific control logic for each lightning segment, such as length change, angle adjustment, and shape distortion, is encapsulated as an abstract method. Subclasses can then implement customized implementations based on specific special effects requirements. This ensures standardized processing while giving developers the ability to fine-tune segment-by-segment control. Furthermore, different types of constraints, such as global constraints, Gaussian constraints, and custom curve constraints, can be designed as components with a unified interface. These components can be used individually, for example, using only Gaussian constraints to achieve a random curvature effect on a lightning chain, or combined in a tree-like structure. For example, global constraints can first determine the basic length and spatial position of a lightning chain, then Gaussian constraints can be used to add natural, random fluctuation details, and finally, custom curve constraints can be used to shape the curvature of a specific arc. This hierarchical "part-whole" combination model allows developers to not only quickly reuse individual constraint functions but also flexibly adjust constraint parameters and priorities to create a rich and diverse range of complex dynamic special effects.
[0127] It should be noted that in practical applications, if the requirements for the lightning chain's shape are relatively simple, even without the constraint unit, the main chain structure generated solely by the fractal simulation algorithm can meet basic special effects requirements. In this embodiment, the constraint unit can implement differentiated control based on the different positions of the curve, making the special effect more expressive. For example, using Gaussian constraints or custom curve constraints, the shape of each part of the lightning chain can be flexibly adjusted: the ends of the curve closely follow the original path, maintaining a stable basic shape, while the middle section is significantly offset, creating a dynamic, jittering broken line effect. This refined control method not only allows the lightning chain to meet design requirements but also creates a more realistic and varied visual effect. For example, the "lightning flowing along a curve" special effect can be animated by dynamically adjusting the weights of the constraint range. For example, by gradually decreasing the left constraint weight from 1 to 0 and then increasing it from 0 to 1, the lightning chain's shape can be gradually transitioned from a stable state perfectly aligned with the original curve to a dynamic effect with jittering in the middle and converging at the ends, creating the visual effect of "energy flowing and diffusing along the curve."
[0128] It should be noted that this embodiment may also be an improvement based on any one or more of the second to fifth embodiments.
[0129] It is not difficult to find that in the embodiment of the present application, in the process of determining the main chain structure through three-dimensional endpoint coordinates and fractal simulation algorithm, preset constraint rules are further introduced to perform differentiated constraints on the main chain structure, which can accurately adjust the morphological characteristics of the main chain according to actual needs.
[0130] Furthermore, because the main chain structure has been morphologically optimized through constraint rules, when branches are subsequently generated based on the main chain structure, the distribution, length, and angle of the branches can better match the characteristics of the main chain, avoiding confusion in the branch generation logic due to deviations in the main chain's morphology. Thus, when a three-dimensional lightning chain is generated in real time based on the constrained main and branch chain structures, since both the main and branch chains can be adjusted according to the constraint rules, the connection between the two will be more natural and smooth. The overall shape can retain the natural randomness of fractal simulation while meeting the requirements of special effects design for structural stability and other aspects, thereby enhancing the realism and controllability of the three-dimensional lightning chain and making it more flexible to adapt to the special effects requirements of different scenarios.
[0131] Seventh embodiment
[0132] The seventh embodiment of the present application relates to a method for generating a three-dimensional lightning chain. The seventh embodiment is an improvement on the first embodiment. The specific improvement is that: in this embodiment, a specific implementation method for determining the branch chain structure based on the main chain structure is provided.
[0133] Specifically, in some embodiments, determining the branched chain structure according to the main chain structure, i.e., step S102, may include:
[0134] Step S1021, determining the three-dimensional endpoint coordinates of the branch chain according to the random point on the main chain structure, the shape in the three-dimensional space, and the shape of any endpoint of the main chain structure;
[0135] Step S1022: determining the branch structure according to the three-dimensional endpoint coordinates of the branch.
[0136] Regarding step S1021, this step can be implemented, for example, by the branching unit. The branching unit can select any two combinations from three types of elements: a random point on the main chain structure, a shape in the three-dimensional space, and a shape of any endpoint of the main chain structure as the endpoint of the branch, thereby determining the three-dimensional endpoint coordinates of the branch.
[0137] For example, it can be a combination of a random point on the main chain and a three-dimensional shape. For example, a vertex on the main chain is randomly selected as the starting point of the branch chain, and a target shape (such as a sphere or cone) is specified in three-dimensional space. The center point or surface feature point of the shape is used as the end point of the branch chain, and the specific coordinates of the two end points are determined through coordinate mapping or geometric calculation.
[0138] For example, it can be a combination of a random point on the main chain and a shape of an endpoint on the main chain. For example, starting from a random point on the main chain, referencing the existing shape feature of an endpoint on the main chain, and using the geometric center or edge point of the shape as the end point coordinate.
[0139] For example, it can be a combination of a three-dimensional shape and a main chain endpoint shape. For example, the starting point is a feature point of a preset shape in three-dimensional space (such as a cube vertex) and the end point is a feature point of the main chain endpoint shape (such as the coordinates of the spike tip at the main chain endpoint).
[0140] Optionally, in some embodiments, a state machine pattern can be used to construct a branch module. Among them, different states and switching combination logic between states can be defined to achieve flexible generation of branch forms. Specifically, "random point connection", "arbitrary shape connection in space" and "shape connection at both ends of the main chain" can be set as different states of the branch module, and relevant personnel can dynamically select two or more states for combination according to needs. Taking the combination of random points and both ends of the main chain as an example, first randomly select a vertex on the main chain as the starting point of the branch, and then specify a preset shape (such as a spherical endpoint) at one end of the main chain as the end point. The state machine can automatically calculate the path between the two points and create a branch connecting the two according to the logical rules of the selected state combination. This design enables the branch module to flexibly generate a variety of connection forms through the abstraction and combination of states, meet the diverse branch generation needs in special effects design, and improve development efficiency and the flexibility of special effects performance.
[0141] Regarding step S1022, illustratively, the branch structure may be determined based on the three-dimensional endpoint coordinates of the branch.
[0142] It is worth emphasizing that this step can use the method provided in the second embodiment to determine the three-dimensional endpoint coordinates of the branch chain. In addition, the method provided in any one or more of the second to fifth embodiments can be used to determine the branch chain structure.
[0143] Optionally, in some embodiments, determining the three-dimensional endpoint coordinates of the branch chain according to the random point on the main chain structure, the shape in the three-dimensional space, and the shape of any endpoint of the main chain structure, that is, step S1021 may include:
[0144] The three-dimensional endpoint coordinates are determined based on preset setting information and random points on the main chain structure, the shape in the three-dimensional space, and the shape of any endpoint in the main chain structure; wherein the setting information is used to control the distribution and morphology of the branch chain.
[0145] Optionally, in some embodiments, the setting information may include at least one of the following: endpoint types of branches, ratios of branches of different types, and independent parameters of branches.
[0146] For example, combined Figure 1 As shown, the system can filter the basic elements in the shape unit according to the preset endpoint type. For random points on the main chain, vertices that meet geometric conditions (such as jitter points with curvature greater than a threshold) can be randomly selected from the main chain structure and used as the starting point or end point; for spatial shape feature points, feature coordinates (such as points uniformly sampled on the surface of the geometric body, the center of the bottom circle, etc.) can be extracted from preset three-dimensional geometric bodies (such as spheres, cylinders, etc.); and the main chain endpoint shape can directly reference the morphological features of the two ends of the main chain (such as the coordinates of the cone tip at the starting point and the diffuse edge point at the end point). In this way, the system can accurately obtain the required basic elements for different endpoint types.
[0147] For example, the system can dynamically select the combination method in a probabilistic manner according to the configured ratio of different endpoint combinations (for example, 60% for the combination of main chain random points to spatial shapes, and 40% for the combination of main chain endpoints to spatial shapes). When the ratio of the combination of "main chain random points → spatial shapes" is high, a radial branching effect can be generated; when the ratio of the combination of "main chain endpoints → spatial shapes" is high, the sense of connection between the endpoints and the environment can be strengthened. Moreover, the ratio can be dynamically adjusted with the help of time parameters to achieve a smooth transition of branch morphology, such as gradually changing from centralized branches to scattered branches, so that the lightning chain special effects present different visual effects at different stages.
[0148] For example, the introduction of independent parameters in the process of calculating the endpoint coordinates can achieve precise control of the branch morphology. The independent parameters may include length constraints, angle constraints, offset controls, and time parameters. Among them, the length constraint can calculate the endpoint coordinates through the distance formula to ensure that the length of the branch is strictly limited to the set range, avoiding abnormal shapes that are too long or too short; the angle constraint can use the vector cross product to calculate the angle between the branch and the main chain, and limit the angle to a specified angle range, so that the branch distribution is more in line with physical laws or design expectations; the offset control can impose a random offset on the calculated endpoint coordinates to simulate the uncertainty in the natural environment and enhance the naturalness and realism of the branch; the time parameter can bind the update interval of the endpoint coordinates to the animation frame, so that the branch exhibits dynamic growth, contraction or fluctuation effects.
[0149] Furthermore, each branch can be independently configured with rendering parameters, including subdivision level, rendering effect, and dynamic parameters. Subdivision level controls the number of iterations of the fractal algorithm, which in turn affects the precision of the branch. Rendering effect parameters include line width, color gradient, luminous intensity, and particle attachment density, which can create a rich and diverse visual appearance for the branch. Dynamic parameters include lifecycle (duration), flashing frequency, and time-varying morphological patterns, allowing each branch to exhibit unique dynamic behavior, making the entire lightning chain special effect more vivid and personalized.
[0150] Furthermore, the system supports the simultaneous creation of multiple different branch types, automatically generating branches in designated areas or at random locations on the main chain according to preset distribution rules (such as density, angle, and length range). For example, you can simultaneously enable "high-density random distribution" for forked branches and "symmetrical distribution along the main chain's midpoint" for arc-shaped branches. By flexibly combining branch types and distribution rules, the lightning chain's branching effects present a natural and varied visual hierarchy.
[0151] In addition, to ensure the stable operation of the lightning chain branch special effects, the system can also build a full-process management mechanism to carry out fine-grained control over the entire life cycle of the branch from creation, operation to destruction: in the creation stage, the endpoint type, morphological parameters and distribution ratio of the branch are configured through preset rules to ensure that the initial state meets the design requirements; during operation, the rendering effect, update frequency and other parameters of each branch are monitored and dynamically adjusted in real time to ensure the smooth presentation of special effects; when the branch completes the display or no longer meets the scene requirements, the system can trigger the destruction mechanism in time to release occupied resources, avoid memory redundancy and performance loss, and thus achieve efficient and stable operation of special effects.
[0152] It should be noted that this embodiment may also be an improvement based on any one or more of the second to sixth embodiments.
[0153] It is not difficult to find that in the embodiment of the present application, by determining the three-dimensional endpoint coordinates of the branch according to the random points on the main chain structure, the shape in three-dimensional space and the shape of any endpoint of the main chain, a multivariate and accurate position reference can be provided for the generation of the branch. When the branch structure is generated based on these coordinates, it can ensure that the branch is naturally connected and spatially coordinated with the main chain, and the branch can present a rich trend and form in three-dimensional space. This step-by-step construction method can not only ensure the logical correlation between the branch and the main chain, but also support the efficient generation of diverse branch forms by flexibly selecting the endpoint type and shape characteristics, meeting the special effects design requirements for the complexity and realism of the lightning chain branches. In addition, relevant personnel can also freely set the form, number and distribution of the branch (such as high-density random distribution or symmetrical distribution along the main chain) to achieve a highly personalized lightning branch effect, and easily support complex and multi-form special effects presentation requirements, such as simulating lightning emission between objects of different shapes, emitting multi-level branches in the air, and the dynamic effect of the main chain and the branch freely interlaced.
[0154] Based on the above embodiments, it can be seen that, regardless of the main chain structure or the branch chain structure, the generation process of a single lightning chain is achieved through the collaboration of multiple modules: first, the endpoint module extracts the coordinates of two endpoints from a specified shape (including a point, plane, sphere or custom model) according to a preset sampling algorithm (such as uniform distribution, Gaussian distribution) to determine the starting and ending positions of the lightning chain; then, these two endpoints are passed to the line unit, and with the help of random update strategies (such as jump, smoothing, and hybrid modes) and recursive midpoint displacement algorithms, the line segments are recursively subdivided and randomly offset to simulate the initial form of the lightning chain with tortuous features; then, the constraint unit artistically adjusts the initial form, and refines the form by applying rules such as length constraints, angle restrictions or custom curve distortions to generate vertex data that meets the design requirements; finally, the line rendering system receives the vertex list, creates vertex buffers and index buffers in real time, and completes shading, projection and other operations through the graphics rendering pipeline to convert the vertex data into a visual lightning chain special effect to ensure its smooth display in the game scene.
[0155] Furthermore, the collaborative generation mechanism of the main chain and branches achieves the construction of a complex lightning network through a layered design. The specific process is as follows: First, the main chain is created according to the single chain generation process, covering endpoint sampling, line simulation, constraint adjustment, and rendering output. After the main chain is generated, the system can initiate branch creation according to the preset configuration: based on the branch type (such as the connecting branch from the main chain to the spatial shape, the main chain's own branch chain), the endpoint type (such as the main chain random point, the spatial sphere surface point), the generation ratio (such as a certain type of branch accounts for 30%), and independent parameters (such as update frequency, thickness, length range, etc.) are defined. The branch lifecycle management module controls the generation timing (such as a 0.1 second delay after the main chain rendering is completed). The shape unit and sampling unit are used to obtain the coordinates of the branch endpoints from a specified shape (such as the main chain geometry or a custom model). The system then submits the branch parameters and endpoint data in batches to the line shape unit. The branch shape is generated using a recursive midpoint displacement algorithm and a random update strategy. After adjustment by the constraint unit, it is visualized together with the main chain by the rendering system. This "main chain first, branch chain generated on demand, and parametric control" model achieves the coordination of the main chain and branch chains in form, dynamics and vision, forming a hierarchical main chain-branch chain network to meet the diverse needs from single chain to multi-branch complex special effects.
[0156] The step division of the above various methods is only for the purpose of clear description. During implementation, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this application; adding insignificant modifications or introducing insignificant designs to the algorithm or process without changing the core design of the algorithm and process are all within the scope of protection of this application.
[0157] Eighth embodiment
[0158] Some embodiments of the present application also provide an electronic device. The electronic device may be equipped with the three-dimensional lightning chain generation system. The system may include an endpoint module, a line module, and a branch module. The endpoint module may include a shape unit and a sampling unit; the line module may include a line shape unit, a random update unit, and a constraint unit; and the branch module may include a branch endpoint unit.
[0159] The electronic device may be various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, etc. The electronic device may also be various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices.
[0160] The electronic device includes: one or more processors; and a memory storing computer program instructions, wherein the computer program instructions, when executed, enable the processor to perform the steps of the method provided in any one or more of the above embodiments. Figure 3 An exemplary structural diagram of the electronic device is disclosed. The electronic device includes: one or more processors 1101, a memory 1102, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations. Among them, the components shown in this article, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0161] The electronic device may further include an input device 1103 and an output device 1104. The processor 1101, the memory 1102, the input device 1103 and the output device 1104 may be connected via a bus or other means, with the bus connection being used as an example in the figure.
[0162] The input device 1103 can receive input digital or character information and generate key signal input related to user settings and function control of the electronic device, such as input devices such as a touch screen, a keypad, a mouse, a trackpad, a touch pad, an indicator stick, one or more mouse buttons, a trackball, and a joystick. The output device 1104 may include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor). The display device may include, but is not limited to, a liquid crystal display, a light emitting diode display, and a plasma display. In some embodiments, the display device may be a touch screen.
[0163] To provide interaction with a user, the electronic device may be a computer. The computer may include a display device (e.g., a cathode ray tube or LCD monitor) for displaying information to the user, and a keyboard and pointing device (e.g., a mouse) through which the user can provide input to the computer. Other types of devices may also be used to provide interaction with the user. For example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback), and input from the user may be received in any form (e.g., voice input or tactile input).
[0164] In the embodiments of the present application, a computer program / instruction is stored on a computer-readable medium. When executed by a processor, the computer program / instruction implements the steps of the method provided in any one or more of the above embodiments. The computer-readable medium may be included in the electronic device described in the above embodiments, or it may exist independently and not be incorporated into the device. The computer-readable medium carries one or more computer-readable instructions.
[0165] The memory 1102 can be used as a non-transitory computer-readable storage medium to store non-transitory software programs, non-transitory computer executable programs, and modules. The processor 1101 executes the non-transitory software programs, instructions, and modules stored in the memory 1102 to execute various functional applications and data processing of the server, thereby implementing the program instructions / modules corresponding to the method provided in any one or more of the above embodiments of the present application.
[0166] The memory 1102 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device, etc. In addition, the memory 1102 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 1102 may optionally include a memory remotely located relative to the processor 1101, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0167] It should be noted that the computer-readable medium described in this application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above. Computer-readable media may be, for example, but not limited to: electrical, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or components, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device.
[0168] Computer-readable media includes both permanent and non-permanent, removable and non-removable media, and can be implemented using any method or technology for information storage. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory, static random access memory, dynamic random access memory, other types of random access memory, read-only memory, electrically erasable programmable read-only memory, flash memory or other memory technology, compact discs, digital versatile discs or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0169] Computer program code for performing the operations of the present application can be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as C or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate 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 a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network or a wide area network, or can be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0170] In the above-described embodiment, can realize wholly or in part by software, hardware, firmware or its arbitrary combination.For example, can adopt application-specific integrated circuit, general-purpose computer or any other similar hardware device to realize.In certain embodiments, the software program of the present application can be carried out to realize above steps or function by processor.Similarly, the software program of the present application (comprising relevant data structure) can be stored in computer-readable recording medium, for example, RAM memory, magnetic or optical drive or floppy disk and similar device.In addition, some steps or functions of the present application can adopt hardware to realize, for example, as the circuit that cooperates with processor to perform each step or function.
[0171] The computer program product provided by the embodiment of the present application includes one or more computer programs / instructions, and when the computer program / instructions are executed by the processor, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instruction can be stored in a computer-readable storage medium, or transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) mode to another website, a computer, a server or a data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center that includes one or more available media integrations. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state hard disk) etc.
[0172] The flowcharts or block diagrams in the accompanying drawings illustrate the possible architectures, functions and operations of the devices, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment or part of code, and the module, program segment or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, as well as the combination of boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-specific system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0173] The scope of this application is defined by the appended claims rather than the foregoing description and is therefore intended to encompass within this application all changes that come within the meaning and range of equivalents of the claims. Any reference signs in the claims should not be construed as limiting the claims to which they relate. In addition, 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 stated in a device claim may also be implemented by one unit or device through software or hardware. Words such as "first" and "second" are only used to distinguish the description and do not indicate any particular order, nor should they be understood as indicating or implying relative importance.
[0174] The above descriptions are merely specific embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art may easily propose variations or substitutions within the technical scope disclosed in the present application, and such variations or substitutions shall be encompassed within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the scope of protection of the claims, and the above descriptions shall be regarded as exemplary and non-limiting.
Claims
1. A method for generating a three-dimensional lightning chain, characterized in that: The method comprises: Determine the main chain structure based on three-dimensional endpoint coordinates and fractal simulation algorithm; Determine the branched chain structure according to the main chain structure; The three-dimensional lightning chain is generated in real time according to the main chain structure and the branch chain structure; wherein the three-dimensional lightning chain has a dynamically changing three-dimensional lightning shape.
2. The method according to claim 1, characterized in that The method for determining the three-dimensional endpoint coordinates includes: Determine the geometry of a given endpoint; The three-dimensional endpoint coordinates are determined according to the geometric shape, a preset sampling method and a preset sampling algorithm.
3. The method according to claim 2, characterized in that The geometric shape includes at least one of the following: a point, a plane, a hemisphere, a sphere, and a custom shape; The sampling method includes at least one of the following: surface sampling, volume sampling; The sampling algorithm includes at least one of the following: uniform distribution and Gaussian distribution.
4. The method according to claim 1, wherein Determining the main chain structure according to the three-dimensional endpoint coordinates and the fractal simulation algorithm includes: Determining the initial shape of the main chain according to the three-dimensional endpoint coordinates and the preset basic lines; The main chain structure is determined according to the initial morphology and the fractal simulation algorithm.
5. The method according to claim 4, characterized in that Determining the main chain structure according to the initial form and the fractal simulation algorithm includes: The main chain structure is determined according to the initial form, the fractal simulation algorithm and a preset update strategy; wherein the preset update strategy is used to determine the dynamic adjustment rules of the initial form.
6. The method according to claim 4, characterized in that The fractal simulation algorithm is specifically a recursive midpoint displacement algorithm; and determining the main chain structure according to the initial form and the fractal simulation algorithm includes: Determine the current line segment to be processed according to the initial form; Repeat the following fractal operation until the iteration termination condition is met: determine the midpoint between the starting point and the end point of the current line segment to be processed; perform spatial offset on the midpoint according to a preset offset parameter to generate an offset vertex; split the current line segment to be processed into a first sub-segment and a second sub-segment; the first sub-segment represents the distance from the starting point to the offset vertex, and the second sub-segment represents the distance from the offset vertex to the end point; use the first sub-segment and the second sub-segment as the new current line segment to be processed; A main chain structure is determined according to the offset vertex, the starting point, and the end point.
7. The method according to claim 6, characterized in that Determining the main chain structure according to the offset vertex, the starting point, and the end point includes: Determine a jitter line segment according to the offset vertex, the starting point, and the end point; Determine an offset vector according to the jittered line segment and a current line segment to be processed determined based on the initial form; A main chain structure is determined according to the current line segment to be processed and the offset vector.
8. The method according to claim 7, characterized in that Determining the offset vector according to the jittered line segment and the current line segment to be processed determined based on the initial form includes: Determining a target point on the jittering line segment; Determine a matching point on the current line segment to be processed based on the path length ratio of the target point in the jittered line segment; wherein the path length ratio of the matching point in the current line segment to be processed is equal to the path length ratio of the target point in the jittered line segment; The offset vector is determined according to the target point and the matching point.
9. The method according to claim 8, characterized in that The determining of the main chain structure according to the current line segment to be processed and the offset vector includes: Determining a jitter point according to the matching point and the offset vector; The main chain structure is determined based on the jitter points.
10. The method according to claim 1, characterized in that Determining the main chain structure according to the three-dimensional endpoint coordinates and the fractal simulation algorithm includes: The main chain structure is determined according to the three-dimensional endpoint coordinates, the fractal simulation algorithm and preset constraint rules; the constraint rules are used to perform differential constraints on the main chain structure.
11. The method according to any one of claims 1 to 10, characterized in that Determining the branched chain structure according to the main chain structure includes: Determining the three-dimensional endpoint coordinates of the branch chain according to the random point on the main chain structure, the shape in the three-dimensional space, and the shape of any endpoint in the main chain structure; The branch structure is determined according to the three-dimensional endpoint coordinates of the branch.
12. The method according to claim 11, characterized in that Determining the three-dimensional endpoint coordinates of the branch chain according to the random point on the main chain structure, the shape in the three-dimensional space, and the shape of any endpoint of the main chain structure includes: The three-dimensional endpoint coordinates are determined based on preset setting information and random points on the main chain structure, the shape in the three-dimensional space, and the shape of any endpoint in the main chain structure; wherein the setting information is used to control the distribution and morphology of the branch chain.
13. An electronic device, characterized in that: The electronic device comprises: one or more processors; and A memory storing computer program instructions, which, when executed, cause the processor to perform the steps of the method according to any one of claims 1 to 12.
14. A computer readable medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.