Flame simulation method based on self-luminous smooth particle system and dynamic multi-resolution grid and terminal
By combining a self-luminous smooth particle system with a dynamic multi-resolution mesh for flame simulation, the problems of realism and controllability in flame simulation are solved, achieving realism and controllability in flame simulation and enhancing the sense of layering and brightness differences in flames.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- UNIV OF ELECTRONICS SCI & TECH OF CHINA
- Filing Date
- 2023-10-31
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies cannot achieve both realism and controllability in flame simulation. Particle-based flame generation is difficult to control in terms of shape and properties, while mesh-based flame generation lacks realism.
A flame simulation method combining a self-illuminating smooth particle system and a dynamic multi-resolution mesh is adopted. By initializing the dynamic multi-resolution mesh structure, particles are created and the velocity field is updated. Combined with the lighting conditions of the self-illuminating smooth particle system, deferred rendering is performed to simulate the evolution of flames.
The simulation achieves realism and controllability of flames. By combining a self-luminous particle system and a dynamic multi-resolution grid, the simulation enhances the sense of depth and brightness differences of flames, thereby improving the realism and controllability of flame simulation.
Smart Images

Figure CN117422014B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer simulation technology, and in particular to a flame simulation method and terminal based on a self-illuminating smooth particle system and a dynamic multi-resolution grid. Background Technology
[0002] With the continuous development of the special effects and gaming industries, computer simulation technology has flourished. Flame simulation refers to using computer graphics and physics simulation techniques to simulate and present realistic flame effects. The goal of this simulation is to create effects in computer-generated images or visual effects that resemble real-world flames, achieving a captivating visual experience.
[0003] In non-real-time flame generation techniques, both the realism and controllability of the flames require high standards. Currently, there are two main approaches to flame simulation: particle-based and mesh-based. Particle-based flame generation can more realistically simulate the movement of flames in real life, but it struggles to control the shape and properties of the flame, making it unsuitable for applications requiring precise computational fluid dynamics. Mesh-based flame generation is more efficient and easier to control the flame's state, but its fidelity is significantly reduced due to the assumption of continuity, which ignores the discrete nature of the flame. In summary, existing technologies cannot achieve a balance between realism and controllability in flame simulation. Summary of the Invention
[0004] The purpose of this invention is to overcome the problems of the prior art and provide a flame simulation method and terminal based on a self-luminous smooth particle system and a dynamic multi-resolution grid.
[0005] The objective of this invention is achieved through the following technical solution: a flame simulation method based on a self-illuminating smooth particle system and a dynamic multi-resolution grid, the method comprising the following steps:
[0006] Determine the fluid domain of the flame to be simulated and initialize the dynamic multi-resolution mesh structure;
[0007] Create particles in the mesh to track the fluid's position and velocity;
[0008] Calculate the illumination of the entire self-illuminating smooth particle system based on the initial position of the particles.
[0009] Within each time step, the particle positions are updated based on the velocity field information to simulate the motion of each point in the fluid;
[0010] Based on the updated particle positions, the velocity information is redistributed to the grid to associate the particle velocities with the corresponding grid cells, thereby updating the velocity field;
[0011] The velocity field is corrected to ensure that it meets the continuity condition;
[0012] Update the lighting conditions of the self-illuminating smooth particle system;
[0013] Delayed rendering of particles;
[0014] Repeat all the steps above to simulate the evolution of the fluid.
[0015] In one example, the initialization of the dynamic multi-resolution mesh structure includes:
[0016] Define a dynamic multi-resolution mesh structure, including the number of mesh blocks, sub-blocks and mesh cells, as well as the resolution settings of adjacent mesh hierarchies;
[0017] Set the mapping relationship between grid blocks and grid cells: map the three-dimensional coordinates of the grid blocks to indices I in memory using a hash algorithm. b For index I b The conversion process is performed to obtain the index I of the sub-blocks in the first-level grid block. s Then, the memory index I of the corresponding grid cell is obtained through querying. c This facilitates the placement of initial particle information into the corresponding grid cell based on the grid cell's memory index during particle creation.
[0018] In one example, the initialization of the dynamic multi-resolution mesh structure further includes a particle initialization step, comprising:
[0019] The dynamic multi-resolution mesh structure is divided into multiple regions with different resolutions based on the distance between particle emission points, and then the particles are divided based on the velocity field.
[0020] Based on the location of the particles within the flame distribution, the particles are filled into the corresponding grid cells, thus ensuring that the particles remain within grid cells with continuously changing resolution throughout the entire particle movement process.
[0021] In one example, particle velocity updates include:
[0022] The change in fluid density is described using the ideal fluid state equation;
[0023] The fluid density is updated based on the continuity equation of fluid pressure using the Navier-Stokes equations, thereby obtaining the particle acceleration;
[0024] The particle's new velocity field is updated based on its acceleration.
[0025] In one example, the method further includes an illumination adjustment step for the self-illuminating smoothing particle system, comprising:
[0026] Each particle in the self-luminous smooth particle system is considered as a point light source;
[0027] Divide all light sources into several clusters, and merge all light sources in each cluster into a single light source;
[0028] Multiple light sources in each cluster are clustered to obtain multiple light source groups;
[0029] Multiple light sources are merged to make each cluster a bright spot. Finally, the final brightness of each cluster is adjusted by the sum of the L2 norms of all the brightness in the cluster and the L2 norm of the central brightness.
[0030] In one example, after clustering multiple light sources in each cluster, if the size of a cluster exceeds a threshold, a large cluster is divided into two smaller clusters using a sampling method. The sampling method is as follows:
[0031]
[0032] Where t represents the number of samplings; ε and δ are both hyperparameters; n represents the amount of data; d represents the aggregation dimension; and D(p; q) represents the information divergence.
[0033] In one example, the deferred rendering is chunked deferred rendering, including:
[0034] The flame is divided into three layers, each with the same light coloring;
[0035] Each layer of flame is divided into several pieces;
[0036] Calculate the minimum and maximum depth for each block;
[0037] Based on the light source groups obtained from clustering, an intersection test is performed on each light source and the block;
[0038] Each block pixel is colored based on the intersecting light sources and depth.
[0039] It should be further noted that the technical features corresponding to the above examples can be combined or replaced to form new technical solutions.
[0040] The present invention also includes a storage medium storing computer instructions that, when executed, perform the steps of the flame simulation method based on a self-illuminating smooth particle system and a dynamic multi-resolution grid, which is formed by any one or more of the above examples.
[0041] The present invention also includes a terminal comprising a memory and a processor, the memory storing computer instructions executable on the processor, the processor executing the steps of the flame simulation method based on a self-illuminating smooth particle system and a dynamic multi-resolution grid formed by any or more of the above examples when executing the computer instructions.
[0042] Compared with the prior art, the beneficial effects of the present invention are:
[0043] 1. In one example, this invention proposes a flame generation model that combines a self-emissive particle system and a dynamically constrained mesh. After particle advection, the velocity information is redistributed to the mesh based on the new particle positions, thereby ensuring the realism of the flame simulation. At the same time, the particle filling is constrained based on a dynamic multi-resolution mesh structure, and the density of each layer of flame can be simulated based on different resolutions, further ensuring the realism of the flame simulation. In addition, the combination of a self-emissive particle system and a multi-resolution dynamic mesh image ensures the controllability of the flame simulation by allowing different resolutions to be used to render different layers of flame during rendering, including mesh layer division, light source aggregation, calculation of different layers of flame density, and rendering different layers of flame during rendering.
[0044] 2. In one example, the present invention divides the dynamic multi-resolution grid based on the distance between particle emission points and fills the particles according to the flame distribution position (inner flame, outer flame, or flame core), so that the particles are in the grid cells with constantly changing resolution, thereby increasing the sense of hierarchy in the flame simulation and ensuring the realism of the flame simulation.
[0045] 3. In one example, for flames, which are compressible fluids, density is not conserved. Existing large-scale fluid simulation methods for multidimensional discrete networks such as waves cannot adapt to the simulation of flame fluids with variable densities. Therefore, this invention is based on the Navier-Stokes equations and uses the ideal fluid state equation to describe the change in fluid density, thereby realizing the update of the particle velocity field and ensuring the controllability of flame simulation.
[0046] 4. In one example, the present invention performs block-based delayed rendering of different layers of flame, which can highlight the difference in brightness at different locations of the flame and improve the realism of the flame simulation. Attached Figure Description
[0047] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings, which are used to provide a further understanding of the present application and constitute a part of the present application. The same reference numerals are used in these drawings to denote the same or similar parts. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application.
[0048] Figure 1This is a flowchart of a simulation method in an example of the present invention. Detailed Implementation
[0049] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0050] In the description of this invention, it should be noted that the directions or positional relationships indicated by terms such as "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer" are based on the directions or positional relationships shown in the accompanying drawings. They are used only for the convenience of describing this invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention. Furthermore, the use of ordinal numbers (e.g., "first and second," "first to fourth," etc.) is for distinguishing objects and is not limited to this order, and should not be construed as indicating or implying relative importance.
[0051] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to mechanical connections or electrical connections; they can refer to direct connections or indirect connections through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0052] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0053] In one example, such as Figure 1 As shown, the flame simulation method based on a self-luminous smooth particle system and a dynamic multi-resolution grid includes the following steps:
[0054] S1: Determine the fluid domain of the flame to be simulated and initialize the dynamic multi-resolution mesh structure. Initializing the dynamic multi-resolution mesh structure includes initializing the mesh structure and initializing the multi-mesh structure. Initializing the mesh structure is mainly used to set the resolution of each mesh layer, the number of mesh blocks and mesh cells in each mesh layer, etc. Each mesh cell contains fluid information, such as velocity, pressure, and density. Initializing the multi-mesh structure is mainly used to set the mapping relationship between mesh blocks and mesh cells (cells). It should be further noted that the mesh structure of this invention combines the Eulerian method and the Lagrangian method, allowing the simultaneous consideration of the meshed Eulerian method and the particle-level Lagrangian method in the simulation, thereby better capturing the global behavior and small-scale details of the fluid. In addition, by recording the error between the numerical solution and the true solution during the simulation on the discrete mesh, and calculating the gradient through the residual module, the mesh update is better achieved, ensuring that the original meshed information and particle-level information are effectively preserved and combined during the fusion process, thereby improving the accuracy and efficiency of fluid simulation.
[0055] S2: Create particles in the mesh to track the position and velocity of the fluid. Specifically, initialize the particle information in memory and put the initialized particle information into the corresponding mesh cell using the memory index of the mesh cell. The initial position of the particles is usually distributed according to the initial conditions of the fluid.
[0056] S3: Based on the initial positions of the particles, calculate the illumination of the entire self-illuminating smooth particle system (hereinafter referred to as the particle system). Specifically, a clustering algorithm can be used to calculate the illumination of the entire particle system. Further, after obtaining the particle positions through the particle system, the particle velocity information is assigned to its adjacent grid cells based on the particle positions. This typically involves spatially interpolating the particle velocities to determine their contribution within the grid cell. The velocity information of all particles within each grid cell is accumulated to obtain the total velocity of that grid cell. This reflects the average velocity of the fluid in that region. Finally, this accumulated velocity information is updated in the velocity field of the grid cells for use in subsequent calculations, ensuring that the velocity field on the grid reflects the actual motion of the fluid at each time step of the simulation.
[0057] S4: Within each time step, the particle position is updated based on the velocity field information to simulate the motion of each point in the fluid, thereby tracking the movement of fluid particles;
[0058] S5: Based on the updated particle positions, the velocity information is redistributed to the grid to associate the particle velocities with the corresponding grid cells, thereby updating the velocity field;
[0059] S6: The velocity field is corrected by solving the pressure Poisson equation to ensure that the velocity field satisfies the continuity condition. Specifically, when the solution to the pressure Poisson equation is obtained, the pressure value can be used to correct the velocity field by subtracting the gradient (pressure gradient) on the velocity field to ensure that the velocity field satisfies the continuity condition throughout the fluid domain, that is, the velocity divergence is zero. This step is iterated multiple times to ensure the convergence and accuracy of the velocity field.
[0060] S7: Update the lighting conditions of the particle system;
[0061] S8: Delayed rendering of particles;
[0062] S9: Repeat all the above steps within one time step to simulate the evolution of the flame and obtain the simulated flame morphology at different time points.
[0063] In this example, for the simulation of incompressible fluids such as flames, it is necessary to simulate different densities at different levels. Furthermore, when updating the particle velocity field, the velocity update must also vary depending on the particle's current position at different levels. This invention proposes a flame generation model combining a self-luminous particle system and a dynamically constrained mesh. After particle advection, the model can redistribute velocity information to the mesh based on the new particle positions, thus ensuring the realism of the flame simulation. Simultaneously, by constraining particle filling based on a dynamic multi-resolution mesh structure, the model can simulate the flame density at each layer based on different resolutions, further guaranteeing the realism of the flame simulation.
[0064] In one example, the dynamic multi-resolution mesh structure is initialized:
[0065] S121: Define a dynamic multi-resolution mesh structure, including the number of mesh blocks (hereinafter referred to as blocks), sub-blocks, and mesh cells, as well as the resolution settings of adjacent mesh hierarchies. Specifically, first, define a multi-layer mesh structure for a sparse mesh, where each block consists of 23 sub-blocks, and each sub-block consists of 23 cells. The resolution difference between two adjacent levels in the mesh hierarchy is a factor of two. Therefore, in a multi-level mesh structure, the space volume occupied by a mesh block at mesh level GL is the same as the space volume of a sub-mesh block at the next lower mesh level GL+1.
[0066] S122: Setting the mapping relationship between grid blocks and grid cells: The index of the first-level grid block (Ib) of the target grid block in the hash table is converted to obtain the index (Is) of the sub-block in the first-level grid block. Then, the memory index (Ic) of the corresponding grid cell is obtained, which facilitates the placement of initial particle information into the corresponding grid cell according to the index (Ic) when the particle is created. Specifically, the index conversion formula is as follows:
[0067] S1221: Use an arbitrary hash algorithm to map the three-dimensional coordinates (P') of the grid to an index (Ib) in memory;
[0068] S1222: Calculate the index of the next level sub-block:
[0069]
[0070] S1223: Maps the memory index of the last cell.
[0071]
[0072] Where x, y, and z represent the coordinate values of the X-axis, Y-axis, and Z-axis, respectively.
[0073] This example employs a sparse page grid design that emphasizes the balance between memory and performance, allowing for efficient representation of large-scale data while optimizing memory access patterns for faster data access during computation. Furthermore, sparse page grids typically utilize a Morton index-like approach for fast data lookup and access, performing particularly well in multi-resolution storage and adaptability. Therefore, this invention uses sparse page network pairs instead of ordinary network structures; that is, the dynamic multi-resolution grid of this invention is also built upon a sparse page grid.
[0074] In one example, the initialization of the mesh structure is followed by a particle initialization step, including:
[0075] S123: The mesh structure is divided into multiple regions of different resolutions based on the distance between particle emission points, and then the particles are further divided based on the velocity field. The expression for the division based on the distance between particle emission points is:
[0076]
[0077]
[0078]
[0079] Where s0, s1, and s2 represent the inner flame, outer flame, and flame core of the flame, respectively, and s0 + s1 + s2 = P; P is the maximum diameter of the flame and the maximum distance the particle travels throughout its life cycle.
[0080] S124: During particle filling, the particles are filled into the corresponding grid cells according to their flame distribution position (inner flame, outer flame, or flame core), so that the particles are in grid cells with constantly changing resolution throughout the entire particle movement process.
[0081] This invention differs from the meshes used in incompressible fluid simulations in its mesh construction. To make the flame appear more layered, a dynamic multi-resolution mesh is employed. Unlike ordinary MAC meshes, the dynamic multi-resolution mesh is divided into multiple regions with different resolutions, and the mesh resolution varies depending on the specific distribution of the inner flame, outer flame, and flame core. In this example, the dynamic multi-resolution mesh is divided based on the distance of the particle emission point, and particle filling is achieved according to the particle's location within the flame distribution (inner flame, outer flame, or flame core). This ensures that the particles are situated within mesh cells with continuously changing resolution, thereby increasing the layering of the flame simulation and ensuring its realism.
[0082] In one example, the method also includes a particle velocity update step, which updates the velocity field information by updating the particle velocities, including:
[0083] The change in fluid density is described using the ideal fluid state equation;
[0084] The fluid density is updated based on the continuity equation of fluid pressure using the Navier-Stokes equations, thereby obtaining the particle acceleration;
[0085] The particle's new velocity field is updated based on its acceleration.
[0086] Specifically, the compressible fluid properties of flames differ from those of common incompressible fluids in the process of solving the Navier-Stokes equations for particles, as follows:
[0087] First, there is the simplified Naiver-Stokes equation, which consists of two parts: the momentum equation and the continuity equation.
[0088]
[0089]
[0090] Where ρ represents the density of the fluid; t represents time; The vector represents the fluid velocity; p represents the fluid pressure; μ represents the viscosity coefficient. This represents the acceleration due to gravity. For incompressible fluids, the fluid density is conserved, therefore... Right now For a compressible fluid like a flame, density is not conserved and changes accordingly with pressure and temperature. To simplify calculations, this invention sets these pressure and temperature values as constants. This invention uses the ideal fluid state equation to describe the change in flame density, expressed as:
[0091] ρ=P / (R*T)
[0092] Where P represents the fluid pressure; R is a specific fluid constant; and T represents the fluid temperature. For the calculation of pressure P, this invention employs the Redlich-Kwong equation.
[0093] P=(RT / (Vb))-(a / (T^(1 / 2)*V*(V+b)))
[0094] Where V represents the volume of the fluid; a and b are variable parameters, used to describe the attractive force between particles and the gas volume, respectively. Therefore, the expression for the fluid density of a flame becomes:
[0095]
[0096] Here, both volume and attractive force are time-varying variables; the expression for particle acceleration is derived from this fluid density expression:
[0097]
[0098] Finally, the new velocity field of the particle is updated based on the calculated acceleration 'a', expressed as:
[0099] v = v0 + at
[0100] Where v0 represents the initial velocity of the particle.
[0101] In this example, for flames, a compressible fluid, density is not conserved. Existing large-scale fluid simulation methods for multidimensional discrete networks such as waves cannot adapt to the simulation of flame fluid with variable density. Therefore, this invention is based on the Navier-Stokes equations and uses the ideal fluid state equation to describe the change in fluid density, thereby realizing the update of the particle velocity field and ensuring the controllability of the flame simulation.
[0102] In one example, the method also includes a step for adjusting the illumination of the particle system, corresponding to a step for calculating the illumination of a self-illuminating smoothed particle system, including:
[0103] S31: Treat each particle in the particle system as a point light source; for a point light source, its illumination model can be described as:
[0104]
[0105] Among them, I a It is the intensity of ambient light; I l It is the strong source of the point light source; L is the simple vector from the pixel to the light source; N is the normal vector of the pixel; H is the half vector; n s is the gloss level of the specular model; k is a constant c used to simulate material properties.
[0106] S32: Divide all light sources into several clusters, and merge all light sources in each cluster into a single light source; specifically, before segmentation, it is necessary to determine the segmentation method with the lowest cost (clustering loss), and calculate the total cost of clustering:
[0107]
[0108] Where i and j represent different cluster C indexes; k and m represent the upper and lower bounds of the summation calculation; and p represents the luminous point.
[0109] S33: Cluster the multiple light sources in each cluster. Specifically, use random sampling clustering to aggregate multiple light sources into one light source, resulting in multiple light source groups. Specifically, first calculate the difference d(pi,pj) between two light-emitting points. The probability of selecting a point from a pile to join a cluster is the sum of the differences between it and other light-emitting points. Through this probabilistic random method, multiple light-emitting points are divided into different clusters, and then aggregated to obtain multiple light source groups (target clusters).
[0110] S34: After obtaining the average number of light source groups, the multiple light source groups are merged, making each cluster a bright spot. Finally, the final brightness of each cluster is adjusted by the sum of the 2-norm of all the light in the cluster and the 2-norm of the central light. Specifically, the final brightness of this cluster is determined by adding the 2-norm of the light in all the light in the cluster and then dividing by the 2-norm of the central light. In this invention, the illumination update step of the particle system is conceptually the same as the illumination calculation step of the self-luminous smoothing particle system described above.
[0111] In one example, after clustering multiple light sources in each cluster, if the size of a cluster exceeds a threshold (the threshold can be set manually or based on historical experience), a sampling method is used to divide a large cluster into two smaller clusters. The sampling method is as follows:
[0112]
[0113] Where t represents the number of samplings; ε and δ are both hyperparameters; n represents the amount of data; d represents the aggregation dimension; D(p; q) represents the information divergence, D(p; q) = plog(p / q) + (1-p)log(1-p)(1-q).
[0114] In one example, to highlight the brightness differences at different locations of the flame and make the flame more realistic, the entire flame is divided into layers, and block-based deferred rendering is performed on different layers. Block-based deferred rendering includes the following sub-steps:
[0115] S81: Divide the flame into three layers (inner flame, outer flame, flame core), and apply the same light coloring to each layer;
[0116] S82: Divide each layer of flame into several blocks, each block having 16x16 pixels;
[0117] S83: Calculate the minimum and maximum depth of each block; specifically, the CPU thread processes the blocks and calculates the depth value of each block, which represents the depth of the nearest and farthest objects in each block from the camera.
[0118] S84: Based on the light source groups obtained from clustering, perform an intersection test between each light source and the block; the clustering algorithm can specifically be the k-means algorithm.
[0119] S85: Color each block pixel based on intersecting light sources and depth.
[0120] This example first renders the normal information and color of the flame particles into the geometry buffer. After the geometry buffer is full, the information stored in the buffer is extracted, and each component of the particle (particle information) is rendered onto the screen separately. Then, light shading is performed. According to the different resolutions of different layers, lighting calculations are performed on each pixel. Since the particles in this invention are self-illuminating particles, there are many point light sources, and particles at different resolution levels will also affect each other. Therefore, the k-means algorithm is used to aggregate the light sources.
[0121] Combining the above examples, we obtain the preferred simulation method of the present invention, which includes the following steps:
[0122] S1': Determine the fluid domain of the flame to be simulated and initialize the dynamic multi-resolution mesh structure;
[0123] S2': Creates particles in the mesh to track the fluid position and velocity;
[0124] S3': Based on the initial position of the particles, a clustering algorithm is used to calculate the illumination of the entire self-illuminating smooth particle system (hereinafter referred to as the particle system);
[0125] S4': Update particle velocity. Within each time step, update particle position based on velocity field information to simulate the motion of points in the fluid and thus track the movement of fluid particles.
[0126] S5': Based on the updated particle positions, the velocity information is redistributed to the grid to associate the particle velocities with the corresponding grid cells, thereby updating the velocity field;
[0127] S6': The velocity field is corrected by solving the pressure Poisson equation to ensure that the velocity field meets the continuity condition; the projection process involves calculating the pressure gradient on the grid, and the correction process can make the velocity field more accurate.
[0128] S7': Update the lighting conditions of the particle system;
[0129] S8': Perform block-based delayed rendering of particles;
[0130] S9': Repeat all the above steps within a time step to simulate the evolution of the flame.
[0131] This invention combines a self-luminous particle system with a dynamically constrained mesh flame generation model. After particle advection, velocity information is redistributed to the mesh based on the new particle positions to ensure the realism of the flame simulation. At the same time, the particle filling is constrained based on a dynamic multi-resolution mesh structure, and the density of each layer of flame can be simulated based on different resolutions, further ensuring the realism of the flame simulation.
[0132] This embodiment provides a storage medium that has the same inventive concept as the flame simulation method based on a self-illuminating smooth particle system and a dynamic multi-resolution grid formed by any or more of the above examples, and stores computer instructions thereon. When the computer instructions are executed, they perform the steps of the flame simulation method based on a self-illuminating smooth particle system and a dynamic multi-resolution grid formed by any or more of the above examples.
[0133] Based on this understanding, the technical solution of this embodiment, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0134] This application also includes a terminal having the same inventive concept as any or a combination of examples corresponding to the above-described flame simulation method based on a self-illuminating smooth particle system and a dynamic multi-resolution grid, comprising a memory and a processor. The memory stores computer instructions executable on the processor, which, when executing the computer instructions, performs the steps of the above-described flame simulation method based on a self-illuminating smooth particle system and a dynamic multi-resolution grid. The processor may be a single-core or multi-core central processing unit or a specific integrated circuit, or one or more integrated circuits configured to implement the present invention.
[0135] In one example, the terminal, i.e., the electronic device, is manifested in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: at least one processing unit (processor) mentioned above, at least one storage unit mentioned above, and a bus connecting different system components (including storage units and processing units).
[0136] The storage unit stores program code that can be executed by the processing unit, causing the processing unit to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit can perform the above-described flame simulation method based on a self-illuminating smooth particle system and a dynamic multi-resolution grid.
[0137] The storage unit may include a readable medium in the form of a volatile storage unit, such as a random access memory (RAM) 3201 and / or a cache storage unit, and may further include a read-only memory (ROM).
[0138] The storage unit may also include a program / utility having a set (at least one) of program modules, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0139] A bus can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus that uses any of the various bus structures.
[0140] The electronic device can also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (e.g., routers, modems, etc.). This communication can be performed via input / output (I / O) interfaces. Furthermore, the electronic device can communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter. The network adapter communicates with other modules of the electronic device via a bus. It should be understood that other hardware and / or software modules can be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0141] Through the above description, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to this exemplary embodiment can be embodied in the form of a software product, which can be stored on a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the method of the exemplary embodiment of this application.
[0142] The above detailed embodiments are a description of the present invention. It should not be considered that the specific embodiments of the present invention are limited to these descriptions. For those skilled in the art, several simple deductions and substitutions can be made without departing from the concept of the present invention, and all of these should be considered to fall within the protection scope of the present invention.
Claims
1. A flame simulation method based on a self-luminous smooth particle system and a dynamic multi-resolution grid, characterized in that: Includes the following steps: Determine the fluid domain of the flame to be simulated and initialize the dynamic multi-resolution mesh structure; Create particles in the mesh to track the fluid's position and velocity; Calculate the illumination of the entire self-illuminating smooth particle system based on the initial position of the particles. Within each time step, the particle positions are updated based on the velocity field information to simulate the motion of each point in the fluid; Based on the updated particle positions, the velocity information is redistributed to the grid to associate the particle velocities with the corresponding grid cells, thereby updating the velocity field; The velocity field is corrected to ensure that it meets the continuity condition; Update the lighting conditions of the self-illuminating smooth particle system; Delayed rendering of particles; Repeat all the above steps to simulate the evolution of the fluid; The initialization of the dynamic multi-resolution mesh structure includes: Define a dynamic multi-resolution mesh structure, including the number of mesh blocks, sub-blocks and mesh cells, as well as the resolution settings of adjacent mesh hierarchies; Set the mapping relationship between grid blocks and grid cells: map the three-dimensional coordinates of the grid blocks to indices I in memory using a hash algorithm. b For index I b The conversion process is performed to obtain the index I of the sub-blocks in the first-level grid block. s Then, the memory index I of the corresponding grid cell is obtained through querying. c This facilitates the placement of initial particle information into the corresponding grid cell based on the grid cell's memory index during particle creation; The initialization of the dynamic multi-resolution mesh structure is followed by a particle initialization step, including: The dynamic multi-resolution mesh structure is divided into multiple regions with different resolutions based on the distance between particle emission points, and then the particles are divided based on the velocity field. Based on the location of the particles within the flame distribution, the particles are filled into the corresponding grid cells, thus ensuring that the particles remain within grid cells with continuously changing resolution throughout the entire particle movement process.
2. The flame simulation method based on a self-luminous smooth particle system and a dynamic multi-resolution grid according to claim 1, characterized in that: Particle velocity updates include: The change in fluid density is described using the ideal fluid state equation; The fluid density is updated based on the continuity equation of fluid pressure using the Navier-Stokes equations, thereby obtaining the particle acceleration; The particle's new velocity field is updated based on its acceleration.
3. The flame simulation method based on a self-luminous smooth particle system and a dynamic multi-resolution grid according to claim 1, characterized in that: The method further includes a step for adjusting the illumination intensity of the self-luminous smoothing particle system, comprising: Each particle in the self-luminous smooth particle system is considered as a point light source; Divide all light sources into several clusters, and merge all light sources in each cluster into a single light source; Multiple light sources in each cluster are clustered to obtain multiple light source groups; Multiple light sources are merged to make each cluster a bright spot. Finally, the final brightness of each cluster is adjusted by the sum of the L2 norms of all the brightness in the cluster and the L2 norm of the central brightness.
4. The flame simulation method based on a self-luminous smooth particle system and a dynamic multi-resolution grid according to claim 3, characterized in that: After clustering multiple light sources in each cluster, if the size of a cluster exceeds a threshold, a large cluster is divided into two smaller clusters using a sampling method. The sampling method is as follows: ; Where t represents the number of samples; , All are hyperparameters; Indicates the amount of data; d represents the aggregation dimension; (p;q) represents information divergence.
5. The flame simulation method based on a self-luminous smooth particle system and a dynamic multi-resolution grid according to claim 3, characterized in that: The deferred rendering is a chunked deferred rendering, including: The flame is divided into three layers, each with the same light coloring; Each layer of flame is divided into several pieces; Calculate the minimum and maximum depth for each block; Based on the light source groups obtained from clustering, an intersection test is performed on each light source and the block; Each block pixel is colored based on the intersecting light sources and depth.
6. A terminal comprising a memory and a processor, wherein the memory stores computer instructions executable on the processor, characterized in that: When the processor executes the computer instructions, it performs the steps of the flame simulation method based on a self-illuminating smooth particle system and a dynamic multi-resolution grid as described in any one of claims 1-5.