Dynamic special effect rendering method and device based on particle grid, equipment and medium
By constructing a particle grid and computing the coordinates and connection relationships of particles in particle special effects technology, the problem of insufficient flexibility of particle special effects in the existing technology is solved, and efficient and realistic dynamic special effects rendering is achieved.
Patent Information
- Application Number
- CN202411665967.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The existing particle special-effect technology has limitations on the connection and organization between particles, resulting in poor creativity and flexibility of special-effects and the inability to truly simulate physical interactions between particles.
By building a particle grid and obtaining the coordinates of the grid nodes, an orderly and controllable spatial framework is provided for the distribution and movement of particles. Determine the correspondence between the special effect particles and the grid nodes according to the special effect requirements, and flexibly adjust the distribution and behavior of the particles. Calculate the coordinates and connection relationships of particles in parallel to improve calculation efficiency and update the state of particles in real time. Determine the rendering method of particles and flexibly adjust the appearance and effect of particles according to different time points and states.
It realizes efficient and realistic dynamic special effects rendering, making the special effects performance more vivid and improving the flexibility and diversity of particle special effects.
Smart Images

Figure CN119784910A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a particle grid-based dynamic special effects rendering method, device, equipment and medium. Background Art
[0002] Particle effects technology is a computer graphics technology used to simulate and render a large number of small particles to create natural phenomena such as smoke, fire, explosions, rain and snow, and other visual effects. This technology is widely used in movies, games, simulation software and visual effects production.
[0003] Current particle effects technology has certain limitations in the connection and organization between particles. Traditional particle effects are achieved through pre-defined connection methods, which limits the creativity and flexibility of special effects. In addition, the existing technology is relatively simple in simulating the interaction between particles and cannot truly simulate the physical interaction between particles, making particle effects relatively rigid, with a single visual effect and poor flexibility.
[0004] Therefore, how to improve the flexibility of particle special effects has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The present application provides a particle grid-based dynamic special effects rendering method, device, equipment and medium, aiming to improve the flexibility of particle special effects.
[0006] In a first aspect, the present application provides a particle grid-based dynamic special effects rendering method, the particle grid-based dynamic special effects rendering method comprising the following steps:
[0007] Constructing a particle grid, and obtaining the grid coordinates of at least one grid node in the particle grid in the particle grid coordinate system;
[0008] Based on special effect requirements, determining a corresponding relationship between at least one special effect particle and each of the grid nodes in the particle grid;
[0009] Based on the corresponding relationship and the network coordinates of each of the grid nodes, the particle coordinates corresponding to each of the special effect particles at at least one rendering moment and the particle connection relationship corresponding to each of the special effect particles at each of the particle coordinates are calculated in parallel;
[0010] Determining a particle rendering mode corresponding to each of the special effect particles at each of the rendering moments based on the particle coordinates corresponding to each of the special effect particles at each of the rendering moments and the particle connection relationship corresponding to each of the particle coordinates;
[0011] Based on the particle rendering technology and the particle rendering mode corresponding to each of the special effect particles at each of the rendering moments, each of the special effect particles is rendered to achieve dynamic special effect rendering.
[0012] In a second aspect, the present application further provides a particle grid-based dynamic special effects rendering device, the particle grid-based dynamic special effects rendering device comprising:
[0013] A particle grid construction module is used to construct a particle grid and obtain the grid coordinates of at least one grid node in the particle grid in the particle grid coordinate system;
[0014] A corresponding relationship determination module, used to determine the corresponding relationship between at least one special effect particle and each of the grid nodes in the particle grid based on special effect requirements;
[0015] A particle coordinate calculation module, for calculating in parallel the particle coordinates corresponding to each of the special effect particles at at least one rendering moment, and the particle connection relationship corresponding to each of the special effect particles at each of the particle coordinates, based on the corresponding relationship and the network coordinates of each of the grid nodes;
[0016] A rendering mode determination module, used to determine the particle rendering mode corresponding to each of the special effect particles at each of the rendering moments based on the particle coordinates corresponding to each of the special effect particles at each of the rendering moments and the particle connection relationship corresponding to each of the particle coordinates;
[0017] The particle special effect rendering module is used to render each of the special effect particles based on the particle rendering technology and the particle rendering mode corresponding to each of the special effect particles at each rendering time to achieve dynamic special effect rendering.
[0018] In a third aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the particle grid-based dynamic special effects rendering method as described above are implemented.
[0019] In a fourth aspect, the present application also provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the above-mentioned particle grid-based dynamic special effects rendering method are implemented.
[0020] The present application provides a method, device, computer equipment and storage medium for rendering dynamic special effects based on particle grids. The method of the present application can provide a basic spatial framework for particle special effects by constructing a particle grid and obtaining the coordinates of the grid nodes, so that the distribution and movement of particles are more orderly and controllable. By determining the correspondence between special effect particles and grid nodes according to special effect requirements, the distribution and behavior of particles can be flexibly adjusted to make the special effects more in line with design requirements. By calculating the coordinates and connection relationships of particles in parallel, the computing efficiency can be improved, and the state of particles can be updated in real time, making the special effects more dynamic and smooth. By determining the rendering method of particles, the appearance and effect of particles can be flexibly adjusted according to different time points and states, making the special effects richer and more diverse. By using particle rendering technology to render particles, efficient and realistic dynamic special effects can be achieved, making the special effects more vivid and improving the flexibility of particle special effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 A schematic diagram of a flow chart of a first embodiment of a particle grid-based dynamic special effects rendering method provided in the present application;
[0023] Figure 2 A schematic flow chart of a second embodiment of a particle grid-based dynamic special effects rendering method provided in this application;
[0024] Figure 3 It is a structural schematic diagram of a first embodiment of a dynamic special effects rendering device based on particle grid provided by the present application;
[0025] Figure 4 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application.
[0026] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0028] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0029] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0030] Please refer to Figure 1 , Figure 1 A schematic flow chart of a first embodiment of a particle grid-based dynamic special effects rendering method provided in the present application.
[0031] like Figure 1 As shown, the particle grid-based dynamic special effects rendering method includes steps S101 to S105.
[0032] S101, constructing a particle grid, and obtaining the grid coordinates of at least one grid node in the particle grid in the particle grid coordinate system;
[0033] In one embodiment, in a particle special effect scene, a particle grid is first established, which includes a series of grid nodes. These nodes can be set to squares, triangles, or other shapes as required. Through a coordinate system, each node can be represented by a coordinate position. The particle grid can be used to simulate and render complex physical phenomena, such as smoke, flames, water flow, etc.
[0034] Furthermore, at least one preset special effect shape is obtained; based on at least one group of the grid nodes corresponding to the special effect shape, the grid coordinates of the special effect shape in the particle grid coordinate system and the particle connection relationship between each of the special effect particles are obtained.
[0035] Specifically, when constructing a particle grid, you first need to determine the size of the grid, that is, the width and height of the particle grid; then, determine the shape of the grid nodes, which can be square, triangle, or other shapes. Establish a coordinate system, usually two-dimensional or three-dimensional, to locate the grid nodes and determine the location of the origin (0,0), which can be the center of the particle grid or a corner point.
[0036] In one embodiment, the position of each node is calculated based on the size and shape of the grid.
[0037] For example, for a square grid, the coordinates of each node can be calculated by simple row and column indexing. For a triangle or other shapes, a geometric algorithm can be used to determine the node position.
[0038] In one embodiment, for each node, its coordinates in the particle mesh coordinate system are calculated.
[0039] For example, for a square grid, the coordinates of the nodes can be expressed as (i*cell width ,j*cell height ), where i and j are the row and column indices of the node, cell width and cell height is the width and height of each grid unit. Through the coordinate system, each node can be represented by a coordinate position. For example, in two-dimensional space, the coordinates of the node can be (x, y). In particle effects scenes, these grid nodes can be used to simulate particle behaviors, such as particle generation, movement, collision, and disappearance.
[0040] Generally, each node can contain particle properties, such as speed, color, life cycle, etc.
[0041] S102, based on special effect requirements, determining a corresponding relationship between at least one special effect particle and each of the grid nodes in the particle grid;
[0042] Exemplarily, the special effect requirements may include the type and behavior of the special effect, such as smoke, fire, explosion, etc. It may also include the physical properties of the special effect, such as diffusion speed, temperature, density, etc.
[0043] Furthermore, based on the special effect requirements, particle attributes of at least one of the special effect particles are configured; based on the particle attributes, a preset number of the special effect particles are generated; based on the distribution information of the special effect particles in the particle grid, the corresponding relationship is established between the special effect particles and the grid node closest to them.
[0044] The particle properties include initial position, moving speed, particle size, etc.
[0045] In one embodiment, according to the special effect requirements, the particle grid is initialized, including the size, node shape and spacing of the grid. The boundary conditions of the grid are determined, such as periodic boundaries, reflection boundaries, etc. The initial properties of the special effect particles are defined, such as position, speed, color, size, life cycle, etc.
[0046] In one embodiment, in a particle special effect, a certain number of particles are generated by a particle generator and randomly distributed on the grid nodes. During the particle generation process, according to the special effect requirements, the properties of the particles, such as initial position, speed, mass, etc., can be set. At the same time, during the particle generation process, the particles are connected with particles on adjacent nodes to form a connection relationship in the grid.
[0047] Specifically, the position of the special effect particle is mapped to the node of the particle grid by converting the continuous spatial coordinates of the particle into discrete grid node indices. For each particle, the nearest grid node is found, or the particle is assigned to a specific grid node according to some rule (such as the direction based on the particle velocity).
[0048] Exemplarily, for each particle, an interpolation method or the like may be used to determine the weight of the particle between two or more grid nodes, and then calculate the correspondence between the particle and the grid node. This may involve. Alternatively, a mathematical formula or algorithm (such as nearest neighbor search, quadtree, spatial hashing, etc.) may be used to determine the correspondence between the particle and the grid node.
[0049] S103, based on the corresponding relationship and the network coordinates of each of the grid nodes, calculating in parallel the particle coordinates corresponding to each of the special effect particles at at least one rendering moment, and the particle connection relationship corresponding to each of the special effect particles at each of the particle coordinates;
[0050] In one embodiment, since the position and connection relationship of the particles are dynamically changing, the position and connection relationship of the particles can be adjusted according to the special effect requirements. By dynamically adjusting the position of the particles, the movement, rotation and other behaviors of the particles can be simulated. For example, the position of the particles can be updated according to the speed and time difference of the particles.
[0051] In one embodiment, necessary data may be prepared for each particle, including position, velocity, acceleration, color, size, rotation, etc. These data are dynamically updated according to the life cycle and behavior rules of the particles. At each rendering moment, the interaction between particles, such as collision, connection relationship, etc., is considered, and the position of the particle is updated according to physical rules (such as gravity, wind speed, etc.).
[0052] For example, the parallel computing capability of the GPU can be used to process each grid node in the particle grid. Since the GPU is good at processing a large number of small parallel tasks, we can distribute the calculation of particle coordinates to multiple cores of the GPU. For each grid node, according to its network coordinates, mathematical transformation is implemented, such as using matrix multiplication to process coordinate transformation, to calculate the particle coordinates in the particle grid coordinate system.
[0053] In addition, the connection between particles can be adjusted according to the special effect requirements. For example, the distance and speed between particles can be used to determine whether to disconnect or re-establish the connection. By dynamically adjusting the position and connection of particles, more realistic and complex particle behaviors can be simulated, increasing the realism and variability of special effects.
[0054] For example, the connection relationship between particles can be determined according to the physical rules of particles and special effect requirements. For example, data structures such as spatial hashing or quadtrees can be used to quickly find adjacent particles. For each particle, its relative position and distance to surrounding particles can be calculated by calculating the distance and angle between particles to determine whether they should be connected.
[0055] In one embodiment, in a particle system, once a collision is detected, the particle velocity vector can be calculated and adjusted according to physical rules to respond to the collision. For example, the elastic coefficient can be used to adjust the velocity of the particle after the collision to simulate different physical behaviors. Further, when the state of the special effect particle changes (such as movement), the state of the particle, such as speed, position, etc., can be updated according to the corresponding relationship between the particle and the grid node. Apply physical rules and special effect requirements, such as fluid dynamics, particle collision, etc., to update the behavior of the particle.
[0056] In one embodiment, in order to improve the efficiency of neighbor particle search, a parallel sorting algorithm can be used to reduce the number of elements to be sorted and improve the overall computing performance. For example, by performing Z index sorting on grid cells instead of sorting all particles, repeated sorting operations can be avoided and computing overhead can be saved.
[0057] S104, determining a particle rendering mode corresponding to each of the special effect particles at each of the rendering moments based on the particle coordinates corresponding to each of the special effect particles at each of the rendering moments and the particle connection relationship corresponding to each of the particle coordinates;
[0058] In one embodiment, in particle special effects, the behavior and appearance of particles need to be calculated and rendered through calculation and rendering technology. With the help of advanced calculation and rendering technology, the behavior and appearance of a large number of particles can be efficiently calculated and rendered.
[0059] In terms of computing, parallel computing technology, such as graphics processor-based computing technology, can be used to distribute the calculation of particle behavior to multiple computing units to improve computing efficiency. For example, technologies such as CUDA or OpenCL can be used to utilize the parallel computing capabilities of multi-core processors and graphics processors to calculate and update the positions and connection relationships of particles in parallel.
[0060] In terms of rendering, advanced rendering techniques, such as volume rendering or fluid simulation, can be used to render the appearance of particles. For example, volume rendering techniques can be used to render particles with lighting, shadows, materials and other effects to enhance the visual effects of special effects. Through the application of computing and rendering techniques, more accurate and realistic particle effects can be achieved.
[0061] In one embodiment, the particle rendering mode corresponding to each special effect particle at each rendering time is determined based on the particle coordinates and particle connection relationship of the special effect particles at each rendering time, including different shapes composed of special effect particles corresponding to different rendering times, and the rendering states of special effect particles that compose the same shape at different rendering times.
[0062] For example, if the special effect requirement is to render the special effect of flame burning in particle space, then first determine the number of special effect particles required to form the flame shape, and construct the shape and distribution of the flame by setting the position coordinates of each special effect particle in the particle grid. Then, simulate the flow and diffusion of the flame based on the connection relationship between the flame special effect particles. According to the actual special effect requirements of flame flow and diffusion, you can use translucent particle materials, combined with color gradients (such as from yellow to red) and noise textures to simulate the irregular edges of the flame, and use particle blending modes to achieve the luminous effect of the flame.
[0063] For example, suppose the special effect requirement is to simulate the diffusion and dispersion of smoke. Then, based on the connection relationship of smoke particles, the continuity and density change of smoke can be simulated. Then, based on the characteristics of smoke expansion and dispersion, the special effect rendering method is determined as follows: using translucent particle materials, combined with color gradient (from white to gray) and blur effects to simulate the soft edges of smoke. Use particle blending modes (such as Alpha Blending) to achieve the transparency effect of smoke.
[0064] For example, if the special effect requirement is to simulate an explosion, and there are shock waves and fragment distribution in the explosion process, then the connection between the explosion particles can be used to simulate the diffusion of the explosion and the interaction of the fragments. The special effect rendering method can be determined by using a particle material with highlight and luminous effects, combined with a color gradient (from white to black) and an explosion texture to simulate the strong light and shock waves of the explosion. Use a particle blending mode to achieve the luminous effect of the explosion.
[0065] In this way, according to the special effect requirements, the particle coordinates and particle connection relationship of the special effect particles at different rendering times are determined to simulate the special effect effects in the special effect requirements, and then according to the special effect effects that need to be achieved, the rendering method of the special effect particles at different rendering times is determined. For example, during the explosion process, the particles need to move at high speed, and the color will gradually fade from high brightness to low, and other special effects.
[0066] S105 , based on the particle rendering technology and the particle rendering mode corresponding to each of the special effect particles at each of the rendering moments, rendering each of the special effect particles to achieve dynamic special effect rendering.
[0067] Generally, particle rendering techniques include point sprite rendering, geometry rendering, and instanced rendering. Point sprite rendering is suitable for simple particle effects, such as sparks or raindrops. Geometry rendering can be used to create more complex particle shapes, such as flames and smoke. Instanced rendering is an efficient technique that can render a large number of identical particles at one time, reducing the number of rendering calls. You can use one or more particle rendering techniques to render special effect particles according to actual needs.
[0068] In one embodiment, according to the requirements of particle special effects, the initial speed, size, rotation, color and other properties of the particles are set. At the same time, the emission rate and burst state of the particles are controlled by the Emission property.
[0069] For example, the rendering direction of the particles can be adjusted according to the direction the particle billboard faces. For example, in Unity, the particle orientation can be controlled by setting Render Alignment, such as View (facing the camera plane), World (aligned with the world axis), etc.
[0070] For example, to add visual effects to particles, materials and shaders can be applied. Materials define the appearance of particles, such as color, texture, and transparency, while shaders define the lighting and rendering effects of particles, such as luminescence, reflection, and refraction. These effects can change dynamically based on the properties of the particles and the scene environment, and the color of the particles can be dynamically adjusted through code to increase the diversity and realism of special effects.
[0071] For example, the shape and size of the emitter can be set through the Shape property, such as Sphere, Cone, Box, etc., to meet different special effect requirements.
[0072] For example, the rendering method of special effect particles can be dynamically adjusted according to the changes in the scene. For example, when the particles are close to the camera, the details and complexity of the particles can be increased to improve the visual effect; when the particles are far away from the camera, the details can be reduced to save computing resources.
[0073] For example, you can set the interaction between particles and the collision panel, such as Dampen, Bounce and Lifetime Loss, as well as Sub Emitters to control the collision and reproduction behavior of particles.
[0074] Optionally, particle rendering can be sorted based on the particle's depth information to achieve the correct depth test and rendering order. For transparent or semi-transparent particles, a blending mode can be used and rendered based on the particle sorting.
[0075] In one embodiment, various rendering techniques may be applied, such as particle shadows, particle halos, particle reflections, etc., to enhance the realism of special effects. Post-processing effects, such as blurring, color correction, etc., may be used to further enhance the visual effects.
[0076] In one embodiment, the particle effects can be adjusted based on feedback by monitoring rendering effects and performance, and particle system parameters such as emission rate, particle lifespan, particle size, etc. can be optimized to achieve the best visual effect and performance balance.
[0077] The present embodiment provides a method for rendering dynamic special effects based on a particle grid. The method of the present application constructs a particle grid and obtains the coordinates of the grid nodes, so that the distribution and movement of the particles are more orderly and controllable. By determining the correspondence between the special effect particles and the grid nodes according to the special effect requirements, the distribution and behavior of the particles can be flexibly adjusted so that the special effects are more in line with the design requirements. By calculating the coordinates and connection relationships of the particles in parallel, the computing efficiency can be improved, and the state of the particles can be updated in real time, making the special effects more dynamic and smooth. By determining the rendering method of the particles, the appearance and effect of the particles can be flexibly adjusted according to different time points and states, making the special effects richer and more diverse. By using particle rendering technology to render the particles, efficient and realistic dynamic special effects can be achieved, making the special effects more vivid and improving the flexibility of particle special effects.
[0078] Please refer to Figure 2 , Figure 2 A schematic flow chart of a second embodiment of a particle grid-based dynamic special effects rendering method provided in the present application.
[0079] In this embodiment, Figure 2 As shown, based on the above Figure 1 In the illustrated embodiment, step S103 further includes:
[0080] S201, based on the corresponding relationship and the network coordinates of each of the grid nodes, calculating the particle coordinates corresponding to each of the special effect particles at at least one rendering moment, and obtaining the moving speed and moving direction of the special effect particles;
[0081] In one embodiment, the position of the particle can be updated according to the initial position, velocity and acceleration of the particle, as well as the external force (such as gravity, wind force) received. This process is usually performed in each rendering frame to ensure that the dynamic changes of the particle can be reflected in the rendering result in real time.
[0082] For example, the speed of a particle can be calculated by dividing the change in its position by the time interval (Delta Time). The direction is the direction of the particle's velocity vector. In Unity, you can control the initial speed of a particle by setting the particle's Start Speed parameter, and control the speed change of a particle during its life cycle by using the Velocity Over LifeTime and Limit Velocity Over LifeTime parameters.
[0083] In one embodiment, in certain special effects, particles may interact with each other, such as connection, collision, etc. These relationships will affect the movement trajectory and speed of particles. For example, using vortex velocity can simulate the effect of particles rotating around a center point. At this time, the relative position between the particle and the center point can be calculated, and the speed and direction of the particle can be updated accordingly.
[0084] S202, calculating the next particle coordinates of the special effect particle at the next rendering moment based on the moving speed, the moving direction, and the current particle coordinates of the special effect particle at the current rendering moment;
[0085] In one embodiment, the current particle coordinates refer to the position of the special effect particle in the particle space at the current rendering time. The moving speed indicates the moving speed of the special effect particle, which can be a vector, and each component vector indicates the speed on the corresponding axis. For example, in three-dimensional space, the moving speed of the special effect particle in the directions of the three axes X, Y, and Z can be included. The moving direction can be a unit vector, indicating the direction of particle movement, which determines the moving path of the particle.
[0086] For example, considering the distance the particle moves in a given time, the velocity vector can be multiplied by the time interval (usually the time difference between two frames, called Delta Time) to calculate the next particle coordinates. If the particle's moving direction is changing, the velocity vector needs to be decomposed into components consistent with the moving direction, which can be achieved through dot products and cross products to ensure that the velocity vector is aligned with the particle's moving direction.
[0087] For example, in some cases, such as explosion effects, vortex effects, etc., the closer the speed of the special effect particles is to the center position, the faster the speed is, and the particle speed changes greatly. At this time, an interpolation method can be used to smooth the movement of the particles, such as linear interpolation, quadratic interpolation, or cubic interpolation.
[0088] S203 . Determine a particle connection relationship of each of the special effect particles at the next rendering moment based on the next particle coordinates of each of the special effect particles at the next rendering moment.
[0089] Understandably, in a particle effects system, the connection relationship between special effect particles is crucial for simulating complex physical phenomena (such as flames, water flow, smoke, etc.). The connection relationship between particles can help simulate the coherence in physical phenomena. For example, in flames, particles show the continuity and dynamic changes of flames through connection relationships; in water flow, the connection relationship simulates the coherent flow and wave form of water flow. Through the connection between particles, richer and more detailed visual effects can be created. For example, particles in smoke form the outline and flow path of smoke through connection relationships, which enhances the realism of the visual effects.
[0090] Furthermore, based on the next particle coordinates of each of the special effect particles at the next rendering moment, the relative distance of each of the special effect particles at the next rendering moment is calculated; for the special effect particles whose relative distance is less than or equal to the preset relative distance, the particle connection relationship is constructed.
[0091] In one embodiment, the predicted coordinates of each particle at the next rendering moment are calculated based on the current coordinates, speed and moving direction of the particle. The Euclidean distance between any two particles is calculated using a distance formula.
[0092] For example, for two special effect particles P1 (x1, y1, z1) and P2 (x2, y2, z2) in the particle space, the distance between them can be expressed as:
[0093]
[0094] In one embodiment, a preset relative distance threshold Δd may be set to determine whether particles are close enough to form a connection relationship.
[0095] For each pair of particles, if their relative distance at the next rendering moment is less than or equal to Δd, they are considered to be connected, which is used to simulate physical interactions between particles, such as adhesion, attraction or repulsion.
[0096] Furthermore, when the special effect particle pair has the particle connection relationship at the current rendering moment, and when the relative distance corresponding to the next rendering moment is greater than the preset relative distance, the particle connection relationship is disconnected at the next rendering moment.
[0097] For the particle connections that already exist at the current rendering moment, if the relative distance at the next rendering moment is greater than Δd, it is considered that the connections between these particles should be disconnected, which is used to simulate the physical phenomenon of particles being separated due to movement.
[0098] In one embodiment, since the particle system may contain a large number of particles, calculating the distances between all pairs of particles may result in a huge amount of calculation. Therefore, a space partitioning technique (such as a quadtree, an octree, or a grid) is used to reduce the distance pairs that need to be calculated. At the same time, using technologies such as CUDA or OpenCL, the parallel computing capabilities of multi-core processors and graphics processors are utilized to calculate and update the positions and connection relationships of particles in parallel, thereby improving efficiency.
[0099] This embodiment calculates the positions and connection relationships of special effect particles at different rendering times, dynamically simulates and renders the complex interactions between particles, thereby creating realistic visual effects. While being suitable for static special effect scenes, it can also adapt to dynamically changing environments, such as particle behavior under the influence of wind, explosions or other external forces.
[0100] See also Figure 3 , Figure 3 It is a structural schematic diagram of a first embodiment of a particle grid-based dynamic special effects rendering device provided in the present application, and the particle grid-based dynamic special effects rendering device is used to execute the aforementioned particle grid-based dynamic special effects rendering method.
[0101] like Figure 3 As shown, the particle grid-based dynamic special effect rendering device 300 includes: a particle grid construction module 301, a corresponding relationship determination module 302, a particle coordinate calculation module 303, a rendering mode determination module 304 and a particle special effect rendering module 305.
[0102] A particle grid construction module 301 is used to construct a particle grid and obtain the grid coordinates of at least one grid node in the particle grid in the particle grid coordinate system;
[0103] A correspondence determination module 302, used to determine the correspondence between at least one special effect particle and each of the grid nodes in the particle grid based on special effect requirements;
[0104] A particle coordinate calculation module 303 is used to calculate in parallel the particle coordinates corresponding to each of the special effect particles at at least one rendering moment and the particle connection relationship corresponding to each of the special effect particles at each of the particle coordinates based on the corresponding relationship and the network coordinates of each of the grid nodes;
[0105] A rendering mode determining module 304 is used to determine a particle rendering mode corresponding to each of the special effect particles at each of the rendering moments based on the particle coordinates corresponding to each of the special effect particles at each of the rendering moments and the particle connection relationship corresponding to each of the particle coordinates;
[0106] The particle special effect rendering module 305 is used to render each of the special effect particles based on the particle rendering technology and the particle rendering mode corresponding to each of the special effect particles at each rendering time to achieve dynamic special effect rendering.
[0107] In one embodiment, the particle coordinate calculation module 303 includes:
[0108] A particle movement parameter calculation unit, used to calculate the particle coordinates corresponding to each of the special effect particles at at least one rendering moment based on the corresponding relationship and the network coordinates of each of the grid nodes, and obtain the movement speed and movement direction of the special effect particles;
[0109] A next particle coordinate calculation unit, used to calculate the next particle coordinates of the special effect particle at the next rendering moment based on the moving speed, the moving direction and the current particle coordinates of the special effect particle at the current rendering moment;
[0110] The particle connection relationship calculation unit is used to determine the particle connection relationship of each special effect particle at the next rendering moment based on the next particle coordinates of each special effect particle at the next rendering moment.
[0111] In one embodiment, the particle connection relationship calculation unit includes:
[0112] A relative distance calculation subunit, used for calculating the relative distance of each of the special effect particles at the next rendering moment based on the next particle coordinates of each of the special effect particles at the next rendering moment;
[0113] The connection relationship construction subunit is used to construct the particle connection relationship for the special effect particles whose relative distance is less than or equal to the preset relative distance.
[0114] In one embodiment, the particle connection relationship calculation unit further includes:
[0115] The connection relationship disconnection subunit is used to disconnect the particle connection relationship at the next rendering moment when the special effect particle pair has the particle connection relationship at the current rendering moment and the relative distance corresponding to the next rendering moment is greater than the preset relative distance.
[0116] In one embodiment, the corresponding relationship determination module 302 includes:
[0117] A particle attribute configuration unit, configured to configure a particle attribute of at least one of the special effect particles based on the special effect requirement;
[0118] A particle generation unit, used for generating a preset number of the special effect particles based on the particle attributes;
[0119] The corresponding relationship establishing unit is used to establish the corresponding relationship between the special effect particle and the grid node closest to it based on the distribution information of the special effect particle in the particle grid.
[0120] In one embodiment, the particle attributes include initial position, moving speed, and particle size.
[0121] In one embodiment, the particle grid-based dynamic special effect rendering device 300 further includes a special effect shape coordinate generation module, including:
[0122] A special effect shape acquisition unit, used to acquire at least one preset special effect shape;
[0123] The special effect shape coordinate obtaining unit is used to obtain the grid coordinates of the special effect shape in the particle grid coordinate system and the particle connection relationship between the special effect particles based on at least one group of the grid nodes corresponding to the special effect shape.
[0124] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned particle grid-based dynamic special effects rendering method embodiment, and will not be repeated here.
[0125] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 4 Runs on the computer device shown.
[0126] See also Figure 4 , Figure 4 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.
[0127] See also Figure 4 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0128] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any particle grid-based dynamic special effect rendering method.
[0129] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0130] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any particle grid-based dynamic special effect rendering method.
[0131] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0132] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0133] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0134] Constructing a particle grid, and obtaining the grid coordinates of at least one grid node in the particle grid in the particle grid coordinate system;
[0135] Based on special effect requirements, determining a corresponding relationship between at least one special effect particle and each of the grid nodes in the particle grid;
[0136] Based on the corresponding relationship and the network coordinates of each of the grid nodes, the particle coordinates corresponding to each of the special effect particles at at least one rendering moment and the particle connection relationship corresponding to each of the special effect particles at each of the particle coordinates are calculated in parallel;
[0137] Determining a particle rendering mode corresponding to each of the special effect particles at each of the rendering moments based on the particle coordinates corresponding to each of the special effect particles at each of the rendering moments and the particle connection relationship corresponding to each of the particle coordinates;
[0138] Based on the particle rendering technology and the particle rendering mode corresponding to each of the special effect particles at each of the rendering moments, each of the special effect particles is rendered to achieve dynamic special effect rendering.
[0139] In one embodiment, the processor, when implementing the particle coordinates corresponding to each of the special effect particles at at least one rendering moment and the particle connection relationship corresponding to each of the special effect particles at each of the particle coordinates based on the corresponding relationship and the network coordinates of each of the grid nodes, is used to implement:
[0140] Based on the corresponding relationship and the network coordinates of each of the grid nodes, the particle coordinates corresponding to each of the special effect particles at at least one rendering moment are calculated to obtain the moving speed and moving direction of the special effect particles;
[0141] Calculating next particle coordinates of the special effect particle at a next rendering moment based on the moving speed, the moving direction, and the current particle coordinates of the special effect particle at a current rendering moment;
[0142] Based on the next particle coordinates of each of the special effect particles at the next rendering moment, the particle connection relationship of each of the special effect particles at the next rendering moment is determined.
[0143] In one embodiment, when the processor determines the particle connection relationship of each special effect particle at the next rendering moment based on the next particle coordinates of each special effect particle at the next rendering moment, it is used to implement:
[0144] Calculating the relative distance of each of the special effect particles at the next rendering moment based on the next particle coordinates of each of the special effect particles at the next rendering moment;
[0145] For the special effect particles whose relative distance is less than or equal to the preset relative distance, the particle connection relationship is constructed.
[0146] In one embodiment, after the processor calculates the relative distance of each of the special effect particles at the next rendering moment based on the next particle coordinates of each of the special effect particles at the next rendering moment, it is further configured to implement:
[0147] When the special effect particle pair has the particle connection relationship at the current rendering moment, and when the relative distance corresponding to the next rendering moment is greater than the preset relative distance, the particle connection relationship is disconnected at the next rendering moment.
[0148] In one embodiment, when the processor determines the correspondence between at least one special effect particle and each of the grid nodes in the particle grid based on the special effect requirement, it is configured to implement:
[0149] Based on the special effect requirement, configuring a particle attribute of at least one of the special effect particles;
[0150] Based on the particle attributes, generating a preset number of the special effect particles;
[0151] Based on the distribution information of the special effect particles in the particle grid, the corresponding relationship is established between the special effect particles and the grid nodes closest to them.
[0152] In one embodiment, the particle properties include initial position, moving speed, and particle size.
[0153] In one embodiment, after implementing the constructing of the particle grid and obtaining the grid coordinates of at least one grid node in the particle grid in the particle grid coordinate system, the processor is further configured to implement:
[0154] Obtain at least one preset special effect shape;
[0155] Based on at least one group of the grid nodes corresponding to the special effect shape, the grid coordinates of the special effect shape in the particle grid coordinate system and the particle connection relationship between the special effect particles are obtained.
[0156] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any particle grid-based dynamic special effects rendering method provided in the embodiment of the present application.
[0157] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0158] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A dynamic special effects rendering method based on particle grid, characterized in that: The method comprises: Constructing a particle grid, and obtaining the grid coordinates of at least one grid node in the particle grid in the particle grid coordinate system; Based on special effect requirements, determining a corresponding relationship between at least one special effect particle and each of the grid nodes in the particle grid; Based on the corresponding relationship and the network coordinates of each of the grid nodes, the particle coordinates corresponding to each of the special effect particles at at least one rendering moment and the particle connection relationship corresponding to each of the special effect particles at each of the particle coordinates are calculated in parallel; Determining a particle rendering mode corresponding to each of the special effect particles at each of the rendering moments based on the particle coordinates corresponding to each of the special effect particles at each of the rendering moments and the particle connection relationship corresponding to each of the particle coordinates; Based on the particle rendering technology and the particle rendering mode corresponding to each of the special effect particles at each of the rendering moments, each of the special effect particles is rendered to achieve dynamic special effect rendering.
2. The particle grid-based dynamic special effects rendering method according to claim 1, characterized in that: The step of calculating, based on the corresponding relationship and the network coordinates of each of the grid nodes, the particle coordinates corresponding to each of the special effect particles at at least one rendering moment, and the particle connection relationship corresponding to each of the special effect particles at each of the particle coordinates in parallel includes: Based on the corresponding relationship and the network coordinates of each of the grid nodes, the particle coordinates corresponding to each of the special effect particles at at least one rendering moment are calculated to obtain the moving speed and moving direction of the special effect particles; Calculating next particle coordinates of the special effect particle at a next rendering moment based on the moving speed, the moving direction, and the current particle coordinates of the special effect particle at a current rendering moment; Based on the next particle coordinates of each of the special effect particles at the next rendering moment, the particle connection relationship of each of the special effect particles at the next rendering moment is determined.
3. The particle grid-based dynamic special effects rendering method according to claim 2, characterized in that: The determining of the particle connection relationship of each of the special effect particles at the next rendering moment based on the next particle coordinates of each of the special effect particles at the next rendering moment comprises: Calculating the relative distance of each of the special effect particles at the next rendering moment based on the next particle coordinates of each of the special effect particles at the next rendering moment; For special effect particles whose relative distance is less than or equal to the preset relative distance, the particle connection relationship is established.
4. The particle grid-based dynamic special effects rendering method according to claim 3, characterized in that: After calculating the relative distance of each of the special effect particles at the next rendering moment based on the next particle coordinates of each of the special effect particles at the next rendering moment, the method further includes: When the special effect particle pair has the particle connection relationship at the current rendering moment, and when the relative distance corresponding to the next rendering moment is greater than the preset relative distance, the particle connection relationship is disconnected at the next rendering moment.
5. The particle grid-based dynamic special effects rendering method according to claim 1, characterized in that: The determining, based on the special effect requirement, a corresponding relationship between at least one special effect particle and each of the grid nodes in the particle grid comprises: Based on the special effect requirement, configuring a particle attribute of at least one of the special effect particles; Based on the particle attributes, generating a preset number of the special effect particles; Based on the distribution information of the special effect particles in the particle grid, the corresponding relationship is established between the special effect particles and the grid nodes closest to them.
6. The particle grid-based dynamic special effects rendering method according to claim 5, characterized in that: The particle properties include initial position, moving speed and particle size.
7. The particle grid-based dynamic special effects rendering method according to claim 1, characterized in that: After constructing the particle grid and obtaining the grid coordinates of at least one grid node in the particle grid in the particle grid coordinate system, the method further includes: Obtain at least one preset special effect shape; Based on at least one group of the grid nodes corresponding to the special effect shape, the grid coordinates of the special effect shape in the particle grid coordinate system and the particle connection relationship between the special effect particles are obtained.
8. A dynamic special effects rendering device based on particle grid, characterized in that: The particle grid-based dynamic special effects rendering device comprises: A particle grid construction module is used to construct a particle grid and obtain the grid coordinates of at least one grid node in the particle grid in the particle grid coordinate system; A corresponding relationship determination module, used to determine the corresponding relationship between at least one special effect particle and each of the grid nodes in the particle grid based on special effect requirements; A particle coordinate calculation module, for calculating in parallel the particle coordinates corresponding to each of the special effect particles at at least one rendering moment, and the particle connection relationship corresponding to each of the special effect particles at each of the particle coordinates, based on the corresponding relationship and the network coordinates of each of the grid nodes; A rendering mode determination module, used to determine the particle rendering mode corresponding to each of the special effect particles at each of the rendering moments based on the particle coordinates corresponding to each of the special effect particles at each of the rendering moments and the particle connection relationship corresponding to each of the particle coordinates; The particle special effect rendering module is used to render each of the special effect particles based on the particle rendering technology and the particle rendering mode corresponding to each of the special effect particles at each rendering time to achieve dynamic special effect rendering.
9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the particle grid-based dynamic special effects rendering method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the particle grid-based dynamic special effects rendering method as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Smoke modeling method in large-scene environment
CN109977431A
Particle special effect rendering method, device and equipment and storage medium
CN112652044A
Physical special effect rendering method and apparatus, computer device, and storage medium
US20230290032A1
Cited By
Simulation method of semiconductor device, electronic equipment and computer readable storage medium
CN121279043A