Three-dimensional environment smoke effect generation and rendering method based on particle system

By designing particle systems in the Unity engine, introducing force fields and vortex currents, and using volumetric lighting models and texture-based shading methods, combined with LOD and GPU acceleration, the low rendering efficiency and poor visual effects of smoke effect in the existing technology are solved. Problem, achieving efficient and realistic smoke effect generation and rendering.

CN119399352APending Publication Date: 2025-02-07四川易方智慧科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411372082.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In the prior art, the huge number of smoke particles leads to heavy burden of calculation and rendering, the dynamic performance of the particle system is limited, and it is impossible to truly simulate the complex changes of smoke in different environments. The light and shadow effects of smoke are not processed carefully enough, and there is a lack of realistic visual effects.

Method used

Through the particle system design in the Unity engine, force fields and vortex current are introduced, and particle shading and lighting use volume lighting models and texture-based shading methods are improved, and LOD and GPU acceleration methods are adopted to improve the real-time rendering efficiency of smoke effects.

Benefits of technology

It significantly improves the quality and rendering efficiency of smoke effects in three-dimensional environments, realizes efficient and realistic smoke effects generation and rendering, solves the main shortcomings in the existing technology, and provides better fields such as games, movies and virtual reality. Solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119399352A_ABST
    Figure CN119399352A_ABST
Patent Text Reader

Abstract

The invention discloses a three-dimensional environment smoke effect generation and rendering method based on a particle system. The method comprises the following steps: S1, designing the particle system; setting a generation rate, an initial speed and a life parameter of the particles; step S2, smog form control; a force field and an eddy current are introduced; S3, particle coloring and illumination are improved; s4, real-time rendering optimization is carried out; and LOD and GPU acceleration methods are adopted, so that the real-time rendering efficiency of the smoke effect is improved. Through a series of technical innovation and optimization, the quality and rendering efficiency of the smoke effect in the three-dimensional environment are remarkably improved. Through dynamic LOD, complex dynamic simulation, a volume illumination model, GPU acceleration and mathematical calculation formulas of nonlinear factors, efficient, vivid and low-cost smog effect generation and rendering are achieved, main defects in the prior art are overcome, and a better solution is provided for the fields of games, movies, virtual reality and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image data processing, and specifically relates to a three-dimensional environment smoke effect generation and rendering method based on a particle system. Background Art

[0002] With the development of computer graphics, smoke effects are increasingly used in movies, games, virtual reality and other fields. Realistic smoke effects can significantly enhance the visual experience and immersion, and therefore have become an important part of many 3D applications. Traditional smoke generation methods mainly rely on particle systems and volume rendering technology.

[0003] Particle system: Particle system is a technology commonly used to simulate natural phenomena such as smoke, fire, explosion, etc. It simulates the movement and change of fluid or gas by generating a large number of tiny particles and updating the position, color and transparency of the particles according to a series of physical rules. Particle system has high flexibility and can better simulate the dynamic effect of smoke.

[0004] Volume rendering technology: Volume rendering technology is a method of achieving smoke effects by rendering three-dimensional voxel (volume pixel) data. Unlike particle systems, volume rendering technology can more carefully express the internal structure and lighting effects of smoke, but its calculation amount is very large and difficult to implement efficiently in real-time applications.

[0005] Existing particle systems simulate the diffusion and movement of smoke by generating a large number of particles. However, these methods have the following shortcomings: the large number of smoke particles leads to heavy calculation and rendering burdens, the dynamic performance of the particle system is limited and cannot truly simulate the complex changes of smoke in different environments, and the light and shadow effects of smoke are not processed in detail, lacking realistic visual effects. Summary of the invention

[0006] The purpose of the present invention is to provide a method for generating and rendering three-dimensional environment smoke effects based on a particle system, so as to solve the problems in the prior art proposed in the background technology, that is, the number of smoke particles is huge, resulting in heavy calculation and rendering burdens, the dynamic performance of the particle system is limited, and it is impossible to truly simulate the complex changes of smoke in different environments, the light and shadow effects of the smoke are not processed in a detailed manner, and there is a lack of realistic visual effects.

[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0008] A method for generating and rendering a three-dimensional environment smoke effect based on a particle system comprises the following steps:

[0009] Step S1, particle system design: generate smoke effect through the particle system in the Unity engine, and set the particle generation rate, initial speed and life parameters;

[0010] Step S2, smoke shape control: introducing force field and vortex to make the smoke shape more natural;

[0011] Step S3, improving particle shading and lighting; using a volumetric lighting model and a texture-based shading method to enhance the details and lighting effects of the smoke;

[0012] Step S4, real-time rendering optimization: using LOD and GPU acceleration methods to improve the real-time rendering efficiency of the smoke effect.

[0013] According to the above technical solution, in step S1, the particle system design includes obtaining particle system components, initializing a particle array, and obtaining a main camera.

[0014] According to the above technical solution, obtaining the particle system component is specifically as follows:

[0015] First, get the particle system component from the current game object; by calling GetComponent <particlesystem>(), find and reference the game object's particle system;

[0016] Check whether the particle system component is successfully obtained; if the particle system component is not found, an error message will be output in the console and execution will stop;

[0017] Initializing the particle array is as follows: after obtaining the particle system component, initialize a particle array; the size of the particle array is set to the maximum number of particles in the particle system main module; the array will be used to store particle information in the particle system;

[0018] To obtain the main camera, you need to use Camera.main to obtain a reference to the main camera. Then, you need to check whether the main camera is successfully obtained. If the main camera is not found, an error message will be output in the console.

[0019] According to the above technical solution, in step S2, the introduced force field includes wind force, and the wind force is introduced specifically as follows:

[0020] Normalize the wind direction vector: define a parameter windDirection to indicate the direction of the wind; use .normalized to normalize the windDirection vector to make it a unit vector with a length of 1, indicating the direction of the wind regardless of its magnitude;

[0021] Calculate wind strength and direction: define a parameter windStrength to represent wind strength; multiply the standardized wind direction vector by wind strength windStrength, expressed as follows:

[0022] windDirection.normalized*windStrength

[0023] By multiplying, a new vector is obtained, the direction of which is consistent with windDirection and the magnitude is windStrength;

[0024] Return wind vector: Returns the calculated wind vector, which represents the wind force acting on the particle at the current position.

[0025] According to the above technical solution, in step S2, introducing eddy currents includes controlling eddy current parameters, fixing eddy current centers, determining external force field influences, and eddy current simulations.

[0026] According to the above technical solution, the control of vortex parameters is specifically as follows: two public floating-point variables vortexRadius and vortexStrength are defined to control the radius and strength of the vortex respectively, wherein; vortexRadius is initialized to 5.0f, indicating the range of the vortex effect; vortexStrength is initialized to 10.0f, indicating the strength or influence of the vortex;

[0027] The fixed vortex center is specifically as follows: a three-dimensional vector vortexCenter is defined to indicate the center position of the vortex; vortexCenter is initialized to (0,0,0), which is the origin of the world coordinate system; it is used to indicate that the vortex center is fixed at the origin position of the scene;

[0028] The specific method of determining the influence of the external force field is as follows: define two public variables windDirection and windStrength, which are used to control the direction and strength of the wind respectively; windDirection is a three-dimensional vector initialized to (1,0,0), indicating that the wind acts along the positive direction of the x-axis; windStrength is a floating-point variable initialized to 0.5f, indicating the strength or influence of the wind.

[0029] According to the above technical solution, in step S2, after the eddy current is introduced, the eddy current needs to be simulated. The eddy current simulation is specifically as follows:

[0030] Function definition: define a CalculateVortexForce function, which accepts a three-dimensional vector position as a parameter and returns a three-dimensional vector representing the vortex force on the particle at that position;

[0031] Calculate the direction vector: First, calculate the direction vector from the vortex center (vortexCenter) to the current position of the particle (position); specifically: Calculate the position difference vector: calculate the difference vector between the current position of the particle (position) and the vortex center (vortexCenter) through position-vortexCenter; this difference vector represents the direction and distance from the vortex center to the current position of the particle;

[0032] Normalize the vector: Use .normalized to normalize the difference vector. The normalization operation converts the vector into a unit vector, that is, the length of the vector is 1, but the direction remains unchanged. The resulting unit vector direction represents the direction of the particle's current position relative to the center of the vortex, but does not consider the size of the distance.

[0033] Introduce nonlinear factors: Calculate the distance between the particle position and the vortex center, and use distance = (position-vortexCenter).magnitude to calculate the length of the vector; as shown in the following formula:

[0034] Calculate the eddy force: Calculate the direction and magnitude of the eddy force through the cross product. The specific implementation is to calculate the cross product of the direction vector and the vertical upward unit vector through Vector3.Cross(direction,Vector3.up) to obtain a vector perpendicular to these two vectors. Multiply the cross product result with the calculated force to obtain the final eddy force vortexForce.

[0035] Return vortex force: Returns the calculated vortex force vortexForce.

[0036] According to the above technical solution, the distance and nonlinear factor are calculated as follows:

[0037] Calculate the distance between the particle and the vortex center: calculate the difference vector between the particle's current position (position) and the vortex center (vortexCenter) through position-vortexCenter; use .magnitude to calculate the length of the difference vector, that is, the straight-line distance between the particle and the vortex center;

[0038] Calculate the magnitude of the eddy force: Calculate the ratio of distance to vortex radius (vortexRadius), that is, distance / vortexRadius; use Mathf.Pow to calculate the square of this ratio, that is, (distance / vortexRadius)^2, as a nonlinear factor; multiply the nonlinear factor by the vortex strength (vortexStrength) to get the final eddy force.

[0039] According to the above technical solution, calculating the eddy current force also includes:

[0040] Calculate the cross product: Calculate the cross product of direction and Vector3.up vectors through the Vector3.Cross method; direction is the direction vector of the particle's current position relative to the center of the vortex; Vector3.up is a unit vector pointing vertically upward (0,1,0); the cross product calculation obtains a vector perpendicular to direction and Vector3.up, and the direction of this vector is consistent with the direction of rotation of the vortex;

[0041] Calculate the magnitude and direction of the vortex force: multiply the calculated direction vector by the previously calculated force magnitude forceMagnitude; the resulting vector vortexForce contains both the direction and magnitude of the vortex force.

[0042] According to the above technical solution, in step S3, improving particle coloring and lighting is specifically as follows:

[0043] In the fragment shader frag, the following operations are performed: sample the texture color tex; calculate the distance of the fragment position in the screen space distance to adjust the color; return the result of multiplying the texture color and the vertex color, and combine it with the nonlinear factor to get the final color.

[0044] Compared with the prior art, the present invention has the following beneficial effects:

[0045] The present invention significantly improves the quality and rendering efficiency of smoke effects in three-dimensional environments through a series of technical innovations and optimizations. Through dynamic LOD, complex dynamic simulation, volumetric lighting model, GPU acceleration and mathematical calculation formulas of nonlinear factors, the present invention achieves efficient, realistic and low-cost smoke effect generation and rendering, solves the main deficiencies in the prior art, and provides better solutions for games, movies and virtual reality. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A schematic diagram of the generation and rendering process of the present invention. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] Embodiment 1

[0049] like Figure 1 As shown, a method for generating and rendering a three-dimensional environment smoke effect based on a particle system includes the following steps:

[0050] Step S1, particle system design: generate smoke effect through the particle system in the Unity engine, and set the particle generation rate, initial speed and life parameters;

[0051] Step S2, smoke shape control: introducing force field and vortex to make the smoke shape more natural;

[0052] Step S3, improving particle shading and lighting; using a volumetric lighting model and a texture-based shading method to enhance the details and lighting effects of the smoke;

[0053] Step S4, real-time rendering optimization: using LOD and GPU acceleration methods to improve the real-time rendering efficiency of the smoke effect.

[0054] The present invention significantly improves the quality and rendering efficiency of smoke effects in three-dimensional environments through a series of technical innovations and optimizations. Through dynamic LOD, complex dynamic simulation, volumetric lighting model, GPU acceleration and mathematical calculation formulas of nonlinear factors, the present invention achieves efficient, realistic and low-cost smoke effect generation and rendering, solves the main deficiencies in the prior art, and provides better solutions for games, movies and virtual reality.

[0055] Embodiment 2

[0056] This example provides a specific implementation method.

[0057] 1. Particle system design;

[0058] Generate smoke effects through the particle system in the Unity engine, and set parameters such as particle generation rate, initial speed, and lifespan.

[0059] Get the particle system component;

[0060] First, get the particle system component from the current game object. By calling GetComponent <particlesystem>() method, attempting to find and reference the object's particle system.

[0061] The code will check whether the particle system component is successfully obtained. If the particle system component is not found, an error message "Particle System component not found!" will be output to the console and the function will stop executing.

[0062] Initialize particle array;

[0063] After successfully obtaining the particle system component, initialize a particle array. The size of the array is set to the maximum number of particles in the particle system main module (particleSystem.main.maxParticles). This array will be used to store particle information in the particle system.

[0064] Get the main camera;

[0065] Next, the code attempts to get the main camera in the scene. Get a reference to the main camera through Camera.main.

[0066] Likewise, the code checks whether the main camera is successfully obtained. If the main camera is not found, an error message "Main Camera not found!" will be output to the console.

[0067] 2. Smoke shape control;

[0068] 2.1 Introduce force fields (such as wind, gravity) and vortex simulation to make the smoke shape more natural.

[0069] Controls swirl parameters.

[0070] Two public floating-point variables vortexRadius and vortexStrength are defined to control the radius and strength of the vortex respectively.

[0071] vortexRadius is initialized to 5.0f, which indicates the range of the vortex effect.

[0072] vortexStrength is initialized to 10.0f and represents the strength or influence of the vortex.

[0073] Fixed vortex center: defines a private three-dimensional vector vortexCenter to indicate the center position of the vortex.

[0074] vortexCenter is initialized to (0,0,0), the origin of the world coordinate system. This means that the vortex center is fixed at the origin of the scene.

[0075] Influence of external force field; two public variables windDirection and windStrength are defined to control the direction and strength of wind respectively.

[0076] windDirection is a three-dimensional vector, initialized to (1,0,0), indicating that the wind acts in the positive direction of the x-axis.

[0077] windStrength is a floating point variable initialized to 0.5f, indicating the strength or influence of the wind.

[0078] 2.2 Improve existing eddy current simulation;

[0079] Function declaration; defines a function named CalculateVortexForce, which accepts a three-dimensional vector position as a parameter and returns a three-dimensional vector representing the vortex force exerted on the particle at that position.

[0080] Calculate the direction vector; first, calculate the direction vector from the vortex center (vortexCenter) to the current position of the particle (position); the specific implementation is to calculate the position difference through position-vortexCenter, and then normalize the vector through .normalized to make it a unit vector, indicating the direction.

[0081] Introduce nonlinear factors; calculate the distance between the particle position and the vortex center, and use distance = (position-vortexCenter).magnitude to calculate the length of the vector.

[0082] A nonlinear factor is introduced to make the calculation of vortex force more complex and realistic. The specific implementation is to calculate the square of the ratio of distance to vortex radius through Mathf.Pow(distance / vortexRadius,2).

[0083] The magnitude of the force is calculated based on this nonlinear factor, and the final magnitude of the force is obtained using forceMagnitude=vortexStrength*nonlinear factor.

[0084] Calculate the eddy force; calculate the direction and magnitude of the eddy force through the cross product. The specific implementation is to calculate the cross product of the direction vector and the vertical upward unit vector through Vector3.Cross(direction,Vector3.up) to obtain a vector perpendicular to these two vectors. Multiply the cross product result with the calculated force magnitude to obtain the final eddy force vortexForce.

[0085] Return vortex force: Returns the calculated vortex force vortexForce.

[0086] 2.2.1 Calculate the direction vector;

[0087] Calculate the position difference vector: Calculate the difference vector between the particle's current position (position) and the vortex center (vortexCenter) through position-vortexCenter. This difference vector represents the direction and distance from the vortex center to the particle's current position.

[0088] Normalize the vector: Use .normalized to normalize the difference vector. The normalization operation converts the vector into a unit vector, that is, the length of the vector is 1, but the direction remains unchanged. The unit vector direction obtained in this way represents the direction of the particle's current position relative to the center of the vortex, but does not take into account the size of the distance.

[0089] Purpose: Calculate the direction vector from the vortex center (vortexCenter) to the current position of the particle (position) and normalize it (i.e. convert it to a unit vector).

[0090] 2.2.2 Calculate distance and nonlinear factor;

[0091] Calculate the distance between the particle and the vortex center: Code: float distance = (position-vortexCenter).magnitude;

[0092] Steps: Calculate the difference vector between the particle's current position (position) and the vortex center (vortexCenter) through position-vortexCenter. Use .magnitude to calculate the length of the difference vector, that is, the straight-line distance between the particle and the vortex center.

[0093] Result: The distance variable stores the distance between the particle and the center of the vortex.

[0094] Calculate the magnitude of the eddy current force:

[0095] Code: float forceMagnitude=vortexStrength*Mathf.Pow(distance / vortexRadius,2);

[0096] Steps: Calculate the ratio of distance to vortex radius (distance / vortexRadius). Use Mathf.Pow to calculate the square of this ratio, (distance / vortexRadius)^2, as a nonlinear factor. Multiply the nonlinear factor by the vortex strength (vortexStrength) to get the final vortex force.

[0097] Purpose: Calculate the distance between the particle position and the eddy center and introduce a nonlinear factor so that the eddy force varies nonlinearly with distance.

[0098] In the prior art: the linear ratio vortexStrength / vortexRadius is usually used to calculate the magnitude of the force.

[0099] In the present invention, by introducing the nonlinear factor Mathf.Pow(distance / vortexRadius,2), the magnitude of the force changes with the distance in a quadratic relationship. This increases the complexity and dynamics of the vortex, making the particle's motion trajectory more realistic and diverse.

[0100] 2.2.3 Calculate eddy current forces;

[0101] Calculate the cross product: Code: Vector3.Cross(direction, Vector3.up).

[0102] Steps: Use the Vector3.Cross method to calculate the cross product of the direction and Vector3.up vectors. direction is the direction vector of the particle's current position relative to the center of the vortex. Vector3.up is a unit vector pointing vertically upward (0,1,0). The cross product calculation obtains a vector perpendicular to direction and Vector3.up, and the direction of this vector is consistent with the direction of rotation of the vortex.

[0103] Result: The calculated vector represents the direction of the eddy current force.

[0104] Calculate the magnitude and direction of the eddy force: Code: Vector3.Cross(direction,Vector3.up)*forceMagnitude;

[0105] Steps: Multiply the calculated direction vector by the previously calculated force magnitude forceMagnitude. The resulting vector vortexForce contains both the direction and magnitude of the vortex force.

[0106] Result: The vortexForce vector represents the vortex force acting on the particle at its current position, including its direction and magnitude.

[0107] Purpose: To calculate the magnitude and direction of eddy current forces.

[0108] In the prior art, the use of linearly proportional force usually results in a relatively simple change in the eddy force, making it difficult to simulate complex fluid motion.

[0109] In the present invention, the nonlinear factor is combined, and the calculated force size is more complex, which can simulate a more dynamically changing eddy current effect.

[0110] Introducing wind power:

[0111] Normalized wind direction vector: code: windDirection.normalized;

[0112] Steps: windDirection is a three-dimensional vector that represents the direction of the wind. Use .normalized to normalize the windDirection vector to make it a unit vector (length 1) that represents the direction of the wind regardless of its magnitude.

[0113] Result: A normalized wind direction vector is obtained, which ensures the wind direction is consistent but does not change the wind magnitude.

[0114] Calculate wind strength and direction: Code: windDirection.normalized*windStrength;

[0115] Steps: Multiply the normalized wind direction vector by the wind strength windStrength.

[0116] windStrength is a floating point number that represents the strength or magnitude of the wind. By multiplying, a new vector is obtained, the direction of which is consistent with windDirection and the magnitude is windStrength.

[0117] Result: The calculated vector represents the wind force on the particle, including its direction and magnitude.

[0118] Return wind vector: code: return windDirection.normalized*windStrength;

[0119] Steps: Return the calculated wind vector, which represents the wind force acting on the particle at the current position.

[0120] Result: The function returns a three-dimensional vector representing the direction and magnitude of the wind.

[0121] 3. Improved particle shading and lighting;

[0122] Use volumetric lighting models and texture-based shading methods to enhance smoke detail and lighting effects.

[0123] Purpose: Defines the fragment shader that calculates the final color of each pixel based on the texture and color.

[0124] Detailed steps: In the fragment shader frag, perform the following operations: Sample the texture color tex. Calculate the distance of the fragment position in screen space. Calculate the nonlinear factor nonLinearFactor to adjust the color. Return the result of multiplying the texture color and the vertex color, and combine it with the nonlinear factor to get the final color.

[0125] 3.1 Advantages of the improved formula:

[0126] The complexity of transparency processing; the improved formula: the nonlinear factor pow(distance,2.0) is introduced to adjust the transparency, so that the transparency changes in a quadratic relationship with the distance. This nonlinear processing can simulate the transparency change of smoke more carefully, making the smoke effect more natural and realistic when superimposed.

[0127] In the prior art: a simple linear multiplication tex*i.color is used, and the transparency processing is relatively simple.

[0128] Advantages of the present invention: The improved formula makes transparency processing more detailed and dynamic through non-linear factors, thereby enhancing visual realism.

[0129] Complexity of dynamic effects:

[0130] Improved formula: pow(distance,2.0) increases the dynamic complexity of the particle effect, simulating a more natural smoke diffusion and change. This processing method makes the smoke show more complex behaviors in dynamic environments, such as vortex and wind movement.

[0131] Existing technology: Only linear calculation is used, which cannot accurately simulate complex dynamic changes.

[0132] Advantages of the present invention: The improved formula can better simulate the complex dynamic changes of smoke in nature and provide higher visual fidelity.

[0133] Detail of light and shadow effects:

[0134] Improved formula: Nonlinear factors introduce more complex lighting changes when calculating lighting effects, making the scattering and absorption of light through smoke more realistic. This meticulous lighting and shadow processing makes the smoke show more realistic effects under different lighting conditions.

[0135] Existing technology: The light and shadow effect processing is relatively simple and cannot accurately simulate complex lighting changes.

[0136] Advantages of the present invention: The improved formula is more detailed and realistic when processing light and shadow effects, thereby improving the overall visual quality.

[0137] 3.2 Existing shaders;

[0138] Problems in existing shaders: Some base shaders may not adequately take transparency into account, causing smoke effects to look unnatural or problems when rendering multi-layer translucent objects (e.g., alpha blending in incorrect order).

[0139] Advantages of the present invention: SmokeShader can better handle translucent effects, so that smoke still maintains a realistic appearance when multiple particles are superimposed.

[0140] 4. Real-time rendering optimization;

[0141] LOD technology and GPU acceleration methods are used to improve the real-time rendering efficiency of smoke effects.

[0142] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0143] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.< / particlesystem> < / particlesystem>

Claims

1. A method for generating and rendering three-dimensional environment smoke effects based on a particle system, characterized in that: The following steps are involved: Step S1, particle system design: generate smoke effect through the particle system in the Unity engine, and set the particle generation rate, initial speed and life parameters; Step S2, smoke shape control: introducing force field and vortex to make the smoke shape more natural; Step S3, improving particle shading and lighting; using a volumetric lighting model and a texture-based shading method to enhance the details and lighting effects of the smoke; Step S4, real-time rendering optimization: using LOD and GPU acceleration methods to improve the real-time rendering efficiency of the smoke effect.

2. The method for generating and rendering three-dimensional environment smoke effects based on a particle system according to claim 1, characterized in that: In step S1, the particle system design includes obtaining particle system components, initializing a particle array, and obtaining a main camera.

3. The method for generating and rendering three-dimensional environment smoke effects based on a particle system according to claim 2, characterized in that: Get the particle system components specifically: First, get the particle system component from the current game object; by calling GetComponent <particlesystem> (), find and reference the game object's particle system;< / particlesystem> Check whether the particle system component is successfully obtained; if the particle system component is not found, an error message will be output in the console and execution will stop; Initializing the particle array is as follows: after obtaining the particle system component, initialize a particle array; the size of the particle array is set to the maximum number of particles in the particle system main module; the array will be used to store particle information in the particle system; To obtain the main camera, you need to use Camera.main to obtain a reference to the main camera. Then, you need to check whether the main camera is successfully obtained. If the main camera is not found, an error message will be output in the console.

4. The method for generating and rendering three-dimensional environment smoke effects based on a particle system according to claim 1, characterized in that: In step S2, the introduced force field includes wind force, and the introduced wind force is specifically: Normalize the wind direction vector: define a parameter windDirection to indicate the direction of the wind; use .normalized to normalize the windDirection vector to make it a unit vector with a length of 1, indicating the direction of the wind regardless of its magnitude; Calculate wind strength and direction: define a parameter windStrength to represent wind strength; multiply the standardized wind direction vector by wind strength windStrength, expressed as follows: windDirection.normalized*windStrength By multiplying, a new vector is obtained, the direction of which is consistent with windDirection and the magnitude is windStrength; Return wind vector: Returns the calculated wind vector, which represents the wind force acting on the particle at the current position.

5. The method for generating and rendering three-dimensional environment smoke effects based on a particle system according to claim 1, characterized in that: In step S2, introducing eddy current includes controlling eddy current parameters, fixing eddy current center, determining external force field influence and eddy current simulation.

6. The method for generating and rendering three-dimensional environment smoke effects based on a particle system according to claim 5, characterized in that: The specific control of vortex parameters is as follows: define two public floating point variables vortexRadius and vortexStrength, which are used to control the radius and strength of the vortex respectively, where; vortexRadius is initialized to 5.0f, indicating the range of the vortex effect; vortexStrength is initialized to 10.0f, indicating the strength or influence of the vortex; The fixed vortex center is specifically as follows: a three-dimensional vector vortexCenter is defined to indicate the center position of the vortex; vortexCenter is initialized to (0,0,0), which is the origin of the world coordinate system; it is used to indicate that the vortex center is fixed at the origin position of the scene; The specific method for determining the influence of the external force field is as follows: define two public variables windDirection and windStrength, which are used to control the direction and strength of the wind respectively; windDirection is a three-dimensional vector initialized to (1,0,0), indicating that the wind acts along the positive direction of the x-axis; windStrength is a floating-point variable initialized to 0.5f, indicating the strength or influence of the wind.

7. The method for generating and rendering three-dimensional environment smoke effects based on a particle system according to claim 6, characterized in that: In step S2, after the eddy current is introduced, the eddy current needs to be simulated. The eddy current simulation is specifically as follows: Function definition: define a CalculateVortexForce function, which accepts a three-dimensional vector position as a parameter and returns a three-dimensional vector representing the vortex force on the particle at that position; Calculate the direction vector: First, calculate the direction vector from the vortex center (vortexCenter) to the current position of the particle (position); specifically: Calculate the position difference vector: calculate the difference vector between the current position of the particle (position) and the vortex center (vortexCenter) through position-vortexCenter; this difference vector represents the direction and distance from the vortex center to the current position of the particle; Normalize the vector: Use .normalized to normalize the difference vector. The normalization operation converts the vector into a unit vector, that is, the length of the vector is 1, but the direction remains unchanged. The resulting unit vector directi on represents the direction of the particle's current position relative to the center of the vortex, but does not consider the size of the distance. Introduce nonlinear factors: Calculate the distance between the particle position and the vortex center, and use distance = (position-vortexCenter).magnitude to calculate the length of the vector; as shown in the following formula: Calculate the eddy force: Calculate the direction and magnitude of the eddy force through the cross product. The specific implementation is to calculate the cross product of the direction vector and the vertical upward unit vector through Vector3.Cross(direction,Vector3.up) to obtain a vector perpendicular to these two vectors. Multiply the cross product result with the calculated force to obtain the final eddy force vortexForce. Return vortex force: Returns the calculated vortex force vortexForce.

8. The method for generating and rendering three-dimensional environment smoke effects based on a particle system according to claim 7, characterized in that: The calculation distance and nonlinear factor are as follows: Calculate the distance between the particle and the vortex center: calculate the difference vector between the particle's current position (position) and the vortex center (vortexCenter) through position-vortexCenter; use .magnitude to calculate the length of the difference vector, that is, the straight-line distance between the particle and the vortex center; Calculate the magnitude of the eddy force: calculate the ratio of distance to vortex radius (vortexRadius), that is, distance / vortexRadius; use Mathf.Pow to calculate the square of this ratio, that is, (distance / vortexRadius)^2, as a nonlinear factor; multiply the nonlinear factor by the vortex strength (vortexStrength) to get the final eddy force.

9. The method for generating and rendering three-dimensional environment smoke effects based on a particle system according to claim 8, characterized in that: Calculation of eddy current forces also includes: Calculate the cross product: Calculate the cross product of direction and Vector3.up vectors through the Vector3.Cross method; direction is the direction vector of the particle's current position relative to the center of the vortex; Vector3.up is a unit vector pointing vertically upward (0,1,0); the cross product calculation obtains a vector perpendicular to direction and Vector3.up, and the direction of this vector is consistent with the direction of rotation of the vortex; Calculate the magnitude and direction of the vortex force: multiply the calculated direction vector by the previously calculated force magnitude forceMagnitude; the resulting vector vortexForce contains both the direction and magnitude of the vortex force.

10. The method for generating and rendering three-dimensional environment smoke effects based on a particle system according to claim 1, characterized in that: In step S3, the particle coloring and lighting are improved as follows: In the fragment shader frag, the following operations are performed: sample the texture color tex; calculate the distance of the fragment position in the screen space distance to adjust the color; return the result of multiplying the texture color and the vertex color, and combine it with the nonlinear factor to get the final color.