Rain and snow rendering method, system and device for three-dimensional scene and medium

By acquiring user perspective and wind speed information, allocating initial position and velocity, and utilizing GPU parallel processing of the rain and snow particle system, combined with noise perturbation and rendering material models, the rendering efficiency and immersion issues of large-scale rain and snow particle systems in WebGL applications are solved, achieving realistic rain and snow effects.

CN121810885APending Publication Date: 2026-04-07GUANGZHOU FRONTOP DIGITAL ORIGINALITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently render large-scale rain and snow particle systems in browser-based WebGL applications, leading to frame rate drops and a lack of natural perturbation in particle movement. This results in rain and snow boundaries appearing when the user's view moves, disrupting the sense of immersion.

Method used

By acquiring user perspective and wind speed and direction information, initial positions and velocities are assigned, particle positions and velocities are updated in parallel, and a noise perturbation function is combined with GPU parallel processing of the particle system. The camera space is dynamically bound, and an appropriate rendering material model is used for dynamic cumulative rendering, and the rendering results are fused.

Benefits of technology

It achieves efficient and realistic simulation of rain and snow movement. The particle system is dynamically bound to the camera, avoiding boundary issues, enhancing the sense of naturalness and randomness, and improving the immersive experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121810885A_ABST
    Figure CN121810885A_ABST
Patent Text Reader

Abstract

The invention discloses a rain and snow rendering method, system and device for a three-dimensional scene and a medium. The method comprises the steps that the real-time position and wind speed and direction information of a user view angle are acquired; distributing an initial position and an initial speed for each particle in the rain and snow particle swarm based on a preset particle number; according to the wind speed and direction information, the initial position, the initial speed and the noise disturbance function, the position and the speed of each particle are updated in parallel, the updated particle position and particle speed are obtained, camera space offset binding is carried out on the particle position based on the real-time position, and the position of a target particle is obtained; and performing rain and snow particle rendering based on the target particle position and the particle speed to obtain a first rendering result, performing dynamic accumulation rendering based on the rendering material model to obtain a second rendering result, and fusing the first rendering result and the second rendering result to obtain a target rendering result. Therefore, the rain and snow movement can be efficiently and vividly simulated in the three-dimensional scene.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of three-dimensional rendering, in particular to a rain and snow rendering method, system, device and medium for a three-dimensional scene. BACKGROUND

[0002] In a three-dimensional scene, especially in a WebGL application based on a browser, simulating realistic rain and snow weather effects is a key link to improve the environmental realism and user immersion. Dynamic rain and snow not only can render a specific atmosphere and climate, but also can interact with the terrain, buildings and lighting in the scene, which is an indispensable element for building high-credibility digital twins, virtual roaming and interactive games and other applications. Therefore, implementing efficient and realistic rain and snow simulation is crucial for promoting the visual expressiveness and user experience of three-dimensional applications on the Web.

[0003] The prior art mainly relies on a traditional particle system based on a CPU to simulate rain and snow. This method traverses and updates the position and state of each particle on the central processor frame by frame, and then transmits the data to the graphics processor for rendering. On the one hand, the serial computation of the CPU and the frequent data transmission make it difficult to support a large-scale particle system. When the number of particles reaches tens of thousands or more, the browser rendering frame rate will drop sharply, which cannot meet the performance requirements of real-time interaction. On the other hand, the motion of the particles is usually a simple uniform falling, which lacks natural disturbances such as wind fields and turbulent flows. The motion trajectory is single, and since the particle system is not dynamically bound to the camera view, the user may move the viewing angle and easily appear the boundary of the rain and snow area, which destroys the immersion. SUMMARY

[0004] The present application provides a rain and snow rendering method, system, device and medium for a three-dimensional scene, which can efficiently and realistically simulate rain and snow motion in a three-dimensional scene.

[0005] An embodiment of the present application provides a rain and snow rendering method for a three-dimensional scene, comprising: obtaining real-time position and wind speed and direction information of a user's viewing angle; allocating initial positions and initial velocities to each particle in a rain and snow particle group based on a preset number of particles; updating the position and velocity of each particle in parallel according to the wind speed and direction information, the initial position, the initial velocity and a noise disturbance function, obtaining updated particle positions and particle velocities, and performing camera space offset binding on the particle positions based on the real-time position, obtaining target particle positions; performing rain and snow particle rendering based on the target particle positions and the particle velocities, obtaining a first rendering result, performing dynamic accumulation rendering based on a rendering material model, obtaining a second rendering result, and fusing the first rendering result and the second rendering result, obtaining a target rendering result.

[0006] This invention provides data support for simulating the complex motions of rain and snow particles, such as drift and turbulence, by acquiring real-time position, wind speed, and wind direction information from the user's perspective. By allocating initial position and initial velocity, it breaks the complete synchronization of particle motion, laying the foundation for a natural and disordered rain and snow distribution. By injecting wind speed and direction information and noise perturbation functions into the update process, the particle motion is upgraded from simple uniformly accelerated falling to a composite motion driven by a directional wind field and influenced by random turbulence, greatly enhancing the naturalness and randomness of the motion. By dynamically associating the particle system with the camera coordinate system, it ensures seamless... Regardless of how the user moves their viewpoint, the rain and snow effects seamlessly and continuously fill the field of view, completely eliminating the boundaries and blank areas of rain and snow bands, thus enhancing realism. Dynamic cumulative rendering based on the rendering material model simulates the accumulation, ripples, and reflections of raindrops after they fall, as well as the accumulation and coverage of snowflakes after they fall, making the weather effects no longer superficial special effects, but truly integrated physical phenomena with the scene. By fusing the first and second rendering results, the visual representation of the scene is unified, forming a complete and self-consistent weather system from sky to ground, ultimately achieving a holistic and realistic simulation. Compared with existing technologies, this application can efficiently and realistically simulate rain and snow movement in a 3D scene.

[0007] Furthermore, the process of assigning initial positions and initial velocities to each particle in the rain and snow particle swarm based on a preset number of particles includes: A fixed-size buffer is pre-allocated in the graphics processor based on a preset number of particles; The particle emission area is determined based on the real-time location, and an initial position is randomly generated for each particle in the rain and snow particle swarm within the particle emission area. A reference falling velocity is set for each particle in the rain and snow particle swarm as an initial velocity. The reference falling velocity includes a first reference falling velocity and a second reference falling velocity. The first reference falling velocity is the initial velocity assigned when simulating rainfall, and the second reference falling velocity is the initial velocity assigned when simulating snowfall.

[0008] By assigning initial positions and initial velocities, the complete synchronicity of particle motion is broken, laying the foundation for the formation of natural, disordered rain and snow distribution.

[0009] Further, the step of updating the position and velocity of each particle in parallel based on the wind speed and direction information, the initial position, the initial velocity, and the noise perturbation function to obtain the updated particle position and particle velocity includes: The incremental impact of the wind field on particle velocity is determined based on the wind speed and direction information, and the incremental disturbance of noise on particle velocity is determined based on the noise disturbance function. The sum of the influence increment and the disturbance increment is added to the initial velocity to obtain the updated particle velocity; The current position of the particle is updated based on the updated particle velocity and time step to obtain the updated particle position.

[0010] By injecting wind speed and direction information and noise disturbance functions into the update process, the particle motion is upgraded from simple uniformly accelerated falling to a composite motion driven by directional wind fields and influenced by random turbulence, which greatly enhances the naturalness and randomness of the motion.

[0011] Further, the step of rendering rain and snow particles based on the target particle position and the particle velocity to obtain a first rendering result includes: Based on the weather type simulated by the rain and snow particle swarm, a corresponding billboard rendering method is selected for each particle, wherein the weather type includes rain and snowfall; Based on the billboard rendering method, the target particle position, the particle velocity, and the camera orientation vector, the vertex coordinates of each particle facet are determined in the vertex shader of the graphics processor, wherein the camera orientation vector is determined based on the real-time position. Based on the vertex coordinates, the particle facets are colored in the fragment shader of the graphics processor, and the first rendering result is output.

[0012] By selecting appropriate billboard rendering methods for rain and snow particles (such as velocity alignment to make raindrops more realistic and normal orientation to make snowflakes more natural) and performing vertex transformation and shading in parallel in the GPU shader, the computational load of a large number of particles is completely transferred to the GPU parallel pipeline while ensuring visual realism. This avoids the serial bottleneck of the CPU and thus efficiently supports the real-time rendering of large-scale particle swarms. This is the key rendering guarantee for achieving "efficient and realistic" simulation.

[0013] Furthermore, the second rendering result includes rain accumulation rendering, wherein the dynamic cumulative rendering based on the rendering material model to obtain the second rendering result includes: Based on physically based rendering materials, the water accumulation intensity of the surface to be rendered is calculated according to the vertical component of the normal of the surface to be rendered, the noise texture sampling value in world coordinates, and the preset global rainfall intensity. Based on the water accumulation intensity, the color, roughness, and metallicity parameters of the surface to be rendered are dynamically adjusted to obtain the adjustment result. The ripple perturbation normal is then mixed into the adjustment result to obtain the second rendering result, wherein the ripple perturbation normal is generated by noise and time factor.

[0014] This dynamic cumulative rendering based on the rendering material model simulates the water accumulation, ripples, and reflections after raindrops fall, as well as the accumulation and covering of snowflakes after they fall. This makes the weather effects no longer superficial special effects, but physical phenomena that are truly integrated into the scene.

[0015] Furthermore, the second rendering result includes snow rendering, wherein the dynamic cumulative rendering based on the rendering material model to obtain the second rendering result includes: Based on physically based rendering materials, the snow coverage rate of the surface to be rendered is calculated according to the vertical component of the normal of the surface to be rendered, the noise texture sampling value in world coordinates, and the preset global snowfall intensity. Based on the snow coverage rate, the original color of the surface to be rendered is dynamically mixed with the snow color to obtain a first processing result, and the roughness and metallicity parameters of the first processing result are interpolated and adjusted to obtain a second processing result. Based on the snow coverage rate, the original surface normal of the second processing result is mixed with the perturbation normal from the snow bump map to obtain the second rendering result.

[0016] This dynamic cumulative rendering based on the rendering material model simulates the water accumulation, ripples, and reflections after raindrops fall, as well as the accumulation and covering of snowflakes after they fall. This makes the weather effects no longer superficial special effects, but physical phenomena that are truly integrated into the scene.

[0017] Furthermore, the step of fusing the first rendering result and the second rendering result to obtain the target rendering result includes: using Alpha blending technology, superimposing the first rendering result as the source color and the second rendering result as the target color to obtain the target rendering result.

[0018] Another embodiment of the present invention provides a rain and snow rendering system for a three-dimensional scene, including: an acquisition module, an allocation module, a processing module and a rendering module; The acquisition module is used to acquire real-time location and wind speed and direction information from the user's perspective; The allocation module is used to assign initial position and initial velocity to each particle in the rain and snow particle swarm based on a preset number of particles. The processing module is used to update the position and velocity of each particle in parallel according to the wind speed and direction information, the initial position, the initial velocity and the noise disturbance function, to obtain the updated particle position and particle velocity, and to perform camera spatial offset binding on the particle position based on the real-time position to obtain the target particle position. The rendering module is used to render rain and snow particles based on the target particle position and the particle velocity to obtain a first rendering result, perform dynamic cumulative rendering based on the rendering material model to obtain a second rendering result, and fuse the first rendering result and the second rendering result to obtain a target rendering result.

[0019] Another embodiment of the present invention provides a terminal device, including: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements the steps of the rain and snow rendering method for a three-dimensional scene as described in the present invention.

[0020] Another embodiment of the present invention also provides a computer-readable storage medium item, including: a stored computer program, which, when the computer program is running, controls the device where the computer-readable storage medium is located to perform steps such as the rain and snow rendering method for a three-dimensional scene of the present invention. Attached Figure Description

[0021] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0022] Figure 1 This is a flowchart illustrating one embodiment of the rain and snow rendering method for a 3D scene provided in this application; Figure 2 This is a flowchart illustrating one embodiment of steps S201 to S203 provided in this application; Figure 3 This is a flowchart illustrating one embodiment of steps S301 to S303 provided in this application; Figure 4 This is a flowchart illustrating one embodiment of steps S401 to S402 provided in this application; Figure 5 This is a flowchart illustrating one embodiment of steps S501 to S503 provided in this application; Figure 6 This is a schematic diagram of one embodiment of the target rendering result provided in this application; Figure 7 This is a schematic diagram of another embodiment of the target rendering result provided in this application; Figure 8 This is a schematic diagram of the structure of one embodiment of the rain and snow rendering system for a 3D scene provided in this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0025] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.

[0026] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0027] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0028] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).

[0029] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.

[0030] In browser-based 3D applications, realistic rain and snow effects are crucial for enhancing immersion. However, existing technologies largely rely on CPU particle systems, which have significant limitations: CPU serial computation and frequent data transfer lead to performance bottlenecks, making it difficult to support real-time rendering of tens of thousands of particles; at the same time, particle movement is merely simple falling, lacking natural disturbances such as wind fields and turbulence, and is not dynamically bound to the camera's field of view, making it easy for rain and snow boundaries to appear when the viewpoint is moved, severely damaging the immersive experience.

[0031] See Figure 1 To efficiently and realistically simulate rain and snow movement in a three-dimensional scene, an embodiment of the present invention provides a method for rendering rain and snow in a three-dimensional scene, including steps S101 to S10,4. Step S101: Obtain real-time location and wind speed and direction information from the user's perspective; In some embodiments, the user's real-time position is directly derived from the camera object in the browser's 3D scene (such as the Three.js framework based on WebGL). During each frame rendering loop, the system extracts the camera's 3D coordinates in the world coordinate system from the camera model's view matrix in real time via a graphics API. These coordinates represent the user's observation point position in the virtual scene and are the sole basis for subsequent particle emission area localization and camera spatial offset binding. Simultaneously, wind speed and direction information, as physical parameters controlling the macroscopic motion of rain and snow particles, are preset by the system or dynamically provided by upper-layer application logic (such as a weather system module). Wind direction is typically defined by a horizontal direction vector or a global wind angle θ, and its vector form can be expressed as... Wind speed is a scalar value. These two sets of parameters are used to control the intensity of the wind field. Together, they constitute a complete wind speed and direction vector field. When the GPU updates the particle state, the system reads these parameters in real time and substitutes them into the particle kinematics calculation model, thereby dynamically driving the rain and snow particles to produce drifting motions that conform to natural laws.

[0032] Step S102: Based on the preset number of particles, assign initial position and initial velocity to each particle in the rain and snow particle swarm; In some embodiments, step S102 includes: pre-allocating a fixed-size buffer in the graphics processor based on a preset number of particles; determining a particle emission area based on the real-time position, and randomly generating a corresponding initial position for each particle in the rain and snow particle swarm within the particle emission area; setting a reference falling speed as an initial speed for each particle in the rain and snow particle swarm, wherein the reference falling speed includes a first reference falling speed and a second reference falling speed, the first reference falling speed being the initial speed allocated when simulating rainfall, and the second reference falling speed being the initial speed allocated when simulating snowfall.

[0033] In some embodiments, the number of particles is fixed during emitter initialization and used as a pre-allocation for the GPU buffer. This fixed value is also the benchmark for subsequent adjustment via "rain / snow intensity." The principle for determining this value is straightforward: to keep it within the range that the target device can handle without noticeable gaps or breaks. In actual engineering, a constant value is usually chosen by compromising between three factors: "coverage size + visual density requirements + device performance" (e.g., 7000 for snow and 30000 for rain in your code). At runtime, the intensity parameter (1–10 in your case) is used for interpolation: actual activated particle count ≈ fixed upper limit * (intensity / 10). This ensures both GPU pre-allocation efficiency and allows for adjustment of rain and snow amounts as needed. The specific setting process is not the focus of this application and will not be elaborated here.

[0034] In some embodiments, firstly, to achieve high-performance particle rendering, a fixed-size buffer is pre-allocated in the graphics processing unit (GPU) based on a preset total number of particles (e.g., 30,000 rain particles and 7,000 snow particles). Then, based on the real-time acquired camera (i.e., user's viewpoint) position, a three-dimensional particle emission region (typically a flat box-shaped area) is defined above it. The horizontal (X and Z axes) range of this region is set to be slightly larger than the projection of the camera's view frustum onto the ground to ensure visual continuity; the vertical (Y axis) direction is a fixed height interval above the camera position. Subsequently, within this defined emission region, the system randomly generates the initial position coordinates for each particle. Finally, to accurately simulate the physical characteristics of different precipitation patterns, different baseline falling velocities are set for rain and snow as the initial velocities of the particles.

[0035] It should be noted that during the particle system initialization phase, rain and snow particle patches are generated in batches using instantiation technology, and their position, velocity, and lifecycle information are stored internally in the GPU through data textures. Unlike traditional CPU particles, this invention delegates all particle update logic to the GPU for parallel processing, thereby maintaining a high frame rate even at scales of tens of thousands or even hundreds of thousands of particles.

[0036] It should be noted that by allocating a buffer at initialization that is sufficient to hold all the data required for the lifecycle of all particles (including position, velocity, lifecycle, etc.), frequent dynamic allocation and reclamation of GPU memory due to particle creation and destruction during the main rendering loop is avoided.

[0037] It should be noted that when simulating rainfall, raindrop particles are assigned a relatively large negative Y-axis velocity value (i.e., the "first baseline falling velocity", for example, -50 units / frame) to represent the characteristics of rainwater falling rapidly and with a steep trajectory due to gravity. Conversely, when simulating snowfall, snowflake particles are assigned a relatively small negative Y-axis velocity value (i.e., the "second baseline falling velocity", for example, -4 units / frame) to represent the characteristics of snowflakes being light, falling slowly, and drifting erratically. These two baseline velocity vectors constitute the initial baseline of particle motion. In subsequent GPU parallel update steps, they will be superimposed with external forces such as wind field and noise to jointly calculate the final realistic particle motion trajectory. This differentiated initial parameter setting is the basis for achieving the distinction between rain and snow visual features and the realism of motion.

[0038] By assigning initial positions and initial velocities, the complete synchronicity of particle motion is broken, laying the foundation for the formation of natural, disordered rain and snow distribution.

[0039] Step S103: Based on the wind speed and direction information, the initial position, the initial velocity, and the noise disturbance function, update the position and velocity of each particle in parallel to obtain the updated particle position and particle velocity, and bind the particle position to the camera spatial offset based on the real-time position to obtain the target particle position. Please refer to Figure 2 In some embodiments, the step of updating the position and velocity of each particle in parallel based on the wind speed and direction information, the initial position, the initial velocity, and the noise perturbation function to obtain the updated particle position and particle velocity includes steps S201 to S203: Step S201: Determine the increment of the influence of the wind field on the particle velocity based on the wind speed and direction information, and determine the increment of the noise disturbance on the particle velocity based on the noise disturbance function. In some embodiments, firstly, the wind field influence increment By using wind direction vector Wind speed scalar and frame time Multiplying them together yields the result, i.e. ,in, The frame interval, typically the duration of each frame obtained from the rendering loop, ensures that the particle velocity is superimposed with a wind-direction velocity component each frame update, thus achieving wind-driven snow and rain drift. Secondly, to enhance the natural drift and turbulence effects of snowflakes, a Simplex noise field is introduced into the GPU to calculate the noise perturbation increment. The calculation formula is as follows: In the formula, The curl operation ensures that the perturbation is divergence-free. This represents the noise function, where p is the particle position. This is the position scaling factor. As a time factor, To determine the turbulence intensity, the curl of the noise potential function is taken. This yields a divergence-free vector field, ensuring that particle disturbances exhibit vortex-like fluid characteristics. The calculation simulates turbulence and random fluctuations in the air, causing particle trajectories to break the mechanical regularity and exhibit natural drifting and oscillation.

[0040] It should be noted that this mechanism allows users to dynamically adjust wind speed and direction parameters during runtime, and the system can update the wind field vector in real time to ensure that the rainfall and snowfall effects are consistent with the scene changes.

[0041] Step S202: The sum of the influence increment and the disturbance increment is added to the initial velocity to obtain the updated particle velocity; In some embodiments, after obtaining the two types of velocity increments, the system superimposes them onto the particle's current velocity in the GPU shader to complete the iterative update of the particle velocity. The update formula is: ,in, It is the particle's velocity in the current frame (i.e., its initial velocity). For a single frame time step, and It is determined by the wind field, noise disturbance and other external forces.

[0042] It should be noted that the superposition operation is performed in parallel, with each particle independently converting the wind and turbulence disturbances it experiences into changes in velocity. The wind field increment dominates the overall offset direction and amplitude of the particle swarm, while the noise increment, based on this, endows each particle with a unique, time-varying random motion, working together to generate an updated, more dynamic and realistic particle velocity.

[0043] Step S203: Update the current position of the particle according to the updated particle velocity and time step to obtain the updated particle position.

[0044] In some embodiments, the particle position is further updated using the updated particle velocity, and its kinematic formula is: ,in, This indicates the particle's position. Simultaneously, the GPU shader checks the lifecycle of each particle in parallel. If a particle's lifecycle hasn't ended, its position is updated normally according to the formula above. If its lifecycle is exhausted, it indicates that the particle (such as a raindrop or snowflake) has fallen to the ground or exceeded its lifespan. The system doesn't destroy it but resets it: its position is returned to the launch area with a new initial velocity, and its lifecycle is reset. This "recycling and regeneration" mechanism allows a fixed number of particles to continuously simulate an infinite rain and snowfall process. While ensuring visual continuity, it avoids the performance overhead of dynamic memory allocation at runtime, which is key to achieving efficient operation of large-scale particle systems.

[0045] By injecting wind speed and direction information and noise disturbance functions into the update process, the particle motion is upgraded from simple uniformly accelerated falling to a composite motion driven by directional wind fields and influenced by random turbulence, which greatly enhances the naturalness and randomness of the motion.

[0046] In some embodiments, the particle position is obtained by camera spatial offset binding based on the real-time position. Specifically, the current position of each particle is... With the camera's current position vector Add them together to get the position of the target particle after binding. Its mathematical model is This mechanism allows the entire particle emission area to move synchronously and dynamically in world space as the camera moves, ensuring that the rain and snow particle rendering area around the user's field of view remains continuously distributed regardless of how the user moves the viewpoint in the 3D scene. This effectively avoids rain and snow boundaries or blank areas that appear due to movement beyond the fixed emission area. At the same time, within the offset area, the particles still move naturally based on their speed, wind field, and noise disturbance, thus maintaining the physical realism of falling rain and snow while ensuring immersion.

[0047] It's important to clarify and emphasize that binding the camera to the sensor doesn't mean the rain and snow particles will "follow the camera." The emission area moves with the camera as a whole, but within this area, the particles still fall and drift naturally according to the rules of gravity, wind, and noise. The user experience is that the surrounding rain and snow distribution remains continuous as the camera moves, without any abrupt changes or the unnatural feeling of "rain and snow floating with the camera."

[0048] Step S104: Render rain and snow particles based on the target particle position and the particle velocity to obtain a first rendering result; perform dynamic cumulative rendering based on the rendering material model to obtain a second rendering result; and fuse the first rendering result and the second rendering result to obtain the target rendering result.

[0049] Please refer to Figure 3 In some embodiments, the step of rendering rain and snow particles based on the target particle position and the particle velocity to obtain a first rendering result includes steps S301 to S303: Step S301: Select the corresponding billboard rendering method for each particle according to the weather type simulated by the rain and snow particle swarm, wherein the weather type includes rain and snowfall; In some embodiments, firstly, based on the specific weather type (rain or snow) simulated by the rain and snow particle swarm, a corresponding billboard rendering method is selected for each particle. For snowfall, a semi-billboard technique is typically used, so that while the snowflake surface rotates around the vertical axis of the camera, its own plane always remains parallel to the ground to simulate the natural posture of snowflakes gently falling. For rain, a velocity-aligned billboard technique is used, so that the long axis direction of the raindrop surface is consistent with the direction of its instantaneous falling velocity, while the lateral direction is determined by the camera's viewing angle, thereby ensuring that the raindrop appears as an elongated line from any viewing angle, enhancing its dynamic and directional falling.

[0050] It should be noted that the mathematical model of the semi-billboard technology can be expressed as: ,in, Let be the right vector of the camera. Let the vector be on the camera. The local coordinates of the particle fragment; and the mathematical model for velocity-aligned billboard technology is: ,in, The direction of particle velocity ensures that the long axis of the raindrop is always aligned with the direction of fall, while the lateral direction is determined by the camera's perspective.

[0051] This billboard technology balances rendering efficiency with natural realism, ensuring that raindrops and snowflakes maintain the correct visual effect from different angles.

[0052] Step S302: Based on the billboard rendering method, the target particle position, the particle velocity, and the camera direction vector, determine the vertex coordinates of each particle facet in the vertex shader of the graphics processor, wherein the camera direction vector is determined based on the real-time position; In some embodiments, within the vertex shader of the graphics processor, the coordinates of the four vertices of each particle facet are calculated in parallel based on the selected billboard rendering method, the target particle position after camera space binding, the particle's current velocity, and the camera orientation vector derived from the user's real-time viewpoint position. Specifically, the shader program expands and rotates a pre-defined quadrilateral facet centered on the particle target position, depending on the billboard type, using the camera's right or up vector or the particle's velocity direction vector. This calculation process ensures that regardless of how the user changes their viewpoint, each particle facet can dynamically adjust its orientation, always facing the camera in the most reasonable posture, thus preparing the geometry for subsequent shading.

[0053] Step S303: Based on the vertex coordinates, the particle facets are colored in the fragment shader of the graphics processor, and the first rendering result is output.

[0054] In some embodiments, firstly, the vertex coordinates calculated and output by the vertex shader are passed to the fragment shader of the GPU; then, the fragment shader performs pixel-by-pixel shading calculations for each particle face based on these coordinate information; then, the shading process assigns appropriate material properties such as color and transparency to the particles, for example, giving snowflakes a white semi-transparent texture and raindrops a grayish-white semi-transparent strip texture, and finally outputting the first rendering result containing all rain and snow particles, thus completing the conversion from geometric information to the final screen pixels and generating a dynamic and realistic aerial rain and snow visual effect in the scene.

[0055] By selecting appropriate billboard rendering methods for rain and snow particles (such as velocity alignment to make raindrops more realistic and normal orientation to make snowflakes more natural) and performing vertex transformation and shading in parallel in the GPU shader, the computational load of a large number of particles is completely transferred to the GPU parallel pipeline while ensuring visual realism. This avoids the serial bottleneck of the CPU and thus efficiently supports the real-time rendering of large-scale particle swarms. This is the key rendering guarantee for achieving "efficient and realistic" simulation.

[0056] Please refer to Figure 4 In some embodiments, the second rendering result includes rain accumulation rendering, and the dynamic cumulative rendering based on the rendering material model to obtain the second rendering result includes steps S401 to S402: Step S401: Based on physically rendered materials, calculate the water accumulation intensity of the surface to be rendered according to the vertical component of the normal of the surface to be rendered, the noise texture sampling value in world coordinates, and the preset global rainfall intensity. In some embodiments, based on physically rendered materials, a comprehensive model is used to dynamically determine the degree of water accumulation. To ensure a basic sense of wetness is conveyed even during light rainfall, the system also performs nonlinear mapping corrections on the calculation results to obtain the final water accumulation intensity. The output of this step This is the core parameter that guides all subsequent rendering adjustments, ensuring a basic level of wetness even in cases of weak water accumulation.

[0057] In some embodiments, water accumulation intensity It is calculated using the following formula: ; In the formula, This represents the vertical component of the surface normal. In world coordinates The noise function of downsampling introduces random disturbances to make the water distribution more natural and irregular. The overall rainfall intensity is weighted to ensure that the greater the rainfall, the more significant the waterlogging effect. Represent a smoothing function (such as smoothstep) to constrain the results in Within the range.

[0058] It should be noted that the vertical component of the normal is taken directly from the geometric information provided by the model. Each triangular facet will have a normal vector. The system will project the normal in the vertical direction (usually the Y-axis or Z-axis) to obtain a value of 0 to 1, which indicates how "horizontal" the face is. The more horizontal the face, the more likely it is to accumulate water, while vertical faces will basically not accumulate water.

[0059] It should be noted that the noise is calculated using a noise map or a runtime noise function (such as Perlin / Simplex). The system samples this noise in world coordinates, meaning that the same ground location will receive a fixed random value. This makes the water distribution appear less rigid and more natural.

[0060] It should be noted that the global rainfall intensity weight is a parameter linked to the rain and snow transmitter set mentioned earlier. It is usually bound to a global control value. For example, if the user sets the rainfall to 7 / 10, the water accumulation intensity weight here will also be multiplied by 0.7, so the heavier the rain, the more obvious the water accumulation.

[0061] It should be noted that the smoothing function is a mathematical function used to "trim" the previously calculated results to a reasonable range. Its purpose is to avoid sudden changes in water accumulation values ​​and make the transition between wet and dry conditions more natural.

[0062] Step S402: Based on the water accumulation intensity, dynamically adjust the color, roughness, and metallicity parameters of the surface to be rendered to obtain the adjustment result, and mix the ripple perturbation normal into the adjustment result to obtain the second rendering result, wherein the ripple perturbation normal is generated by noise and time factor.

[0063] In some embodiments, when obtaining water accumulation intensity Next, the physical rendering material parameters of the surface are dynamically adjusted, due to the color of the surface after water accumulation. It will darken, so the surface color needs to be adjusted, and the roughness also needs to be adjusted. and metallicity The process will transition to a wet state, so the roughness and metallicity parameters need to be adjusted to obtain the adjusted results. Then, to simulate the ripples caused by raindrops, a ripple disturbance term is introduced into the normal calculation of the water accumulation area; that is, during the shading process, the original normal will be affected. and ripple vector The disturbance normal is generated based on the intensity of water accumulation. The relevant formula is: Where r=(rx,ry,1.0) represents the ripple perturbation vector, generated by a noise-driven periodic function. The mixing coefficient is based on the water accumulation intensity, when At that time, the perturbation normal has the greatest impact on the rendering. Finally, the ripple perturbation normal is mixed into the adjustment result. This is done to obtain a second rendering result, thus visually achieving both the material property changes caused by water accumulation and the dynamic ripple effect.

[0064] In some embodiments, the formula for calculating the adjustment result is: ; ; ; In the formula, The original surface color, The color of the surface after water accumulation; The initial roughness gradually decreases after water accumulation, approaching a mirror-like effect. It has the original metallic properties, and as the water accumulation increases, it approaches a wet, highly reflective state.

[0065] It should be noted that the ripple vector Generation depends on time parameters Spatial coordinates The relevant formula is: In the formula, For the radius of the ripple effect, It is a sine wave function based on hash function perturbation, used to generate water wave interference effects with random center and phase.

[0066] By dynamically adjusting the aforementioned material parameters, the system can realistically represent the physical characteristics of the ground after water accumulation, such as darkening of color, enhanced reflection, and ripple disturbance, within the PBR rendering framework.

[0067] This dynamic cumulative rendering based on the rendering material model simulates the water accumulation, ripples, and reflections after raindrops fall, as well as the accumulation and covering of snowflakes after they fall. This makes the weather effects no longer superficial special effects, but physical phenomena that are truly integrated into the scene.

[0068] Please refer to Figure 5 In some embodiments, the second rendering result includes snow rendering, and the dynamic cumulative rendering based on the rendering material model to obtain the second rendering result includes steps S501 to S503: Step S501: Based on the physically rendered material, calculate the snow coverage of the surface to be rendered according to the vertical component of the normal of the surface to be rendered, the noise texture sampling value in world coordinates, and the preset global snowfall intensity. In some embodiments, the snow cover of the surface to be rendered is calculated using a comprehensive model based on a physically based rendering (PBR) model. The model comprehensively considers the physical orientation of the surface, the global snowfall intensity, and natural randomness. Its core calculation formula is as follows: ,in, As a weight for global snowfall intensity, It represents the vertical component of the surface normal, indicating the degree to which the surface is facing upwards. Horizontal surfaces (facing upwards) are more likely to accumulate snow, while vertical surfaces (walls) have a lower probability of accumulating snow. It indicates the overall snowfall intensity, which is related to the amount and duration of snowfall; the heavier and longer the snowfall, the higher the snow cover. In world coordinates Downsampled noise textures are used to break up the edges of the cover, making the snow surface more natural; This is a noise texture sampled in world coordinates, representing the sensitivity of snow to the normal direction. Its purpose is to make the edges of the snow appear irregular and more natural, rather than sharp, clean edges. This represents a smoothing function (such as smoothstep) used to limit the result to a certain range. Interval.

[0069] Step S502: Based on the snow coverage rate, the original color of the surface to be rendered is dynamically mixed with the snow color to obtain a first processing result, and the roughness and metallicity parameters of the first processing result are interpolated and adjusted to obtain a second processing result. In some embodiments, when the snow cover rate is calculated Next, visual representation processing is required, using formulas. In the formula, The original surface color; The ideal white snow has a high reflectivity (actual snow may have a slightly bluish-gray tint depending on the lighting conditions). To control the degree of snow cover , to restore the original color of the surface The color of snow Dynamic blending is performed to obtain the final displayed pixel color, which is the first processing result. Subsequently, in order to enhance the material representation of the snow-covered area, it is necessary to interpolate and adjust the key physical properties of the material—roughness and metallicity—so that the snow-covered area presents a realistic material appearance with high diffuse reflection and low metallicity.

[0070] In some embodiments, the interpolation adjustment formula is: ; ; In the formula, These are the original roughness and metallicity, respectively. This indicates that the snow surface has high diffuse reflection and low roughness; This indicates that snow has almost no metallic properties.

[0071] It should be noted that when Ssnow approaches 1, it means that the fragment is completely covered by snow; when it approaches 0, it means that the surface is still bare. Its function is to determine "how much snow" a fragment (pixel) has.

[0072] It should be noted that, based on the coverage, the "original material color" and the "snow color" are mixed to obtain the final displayed pixel color. High coverage → whiter, low coverage → the original material is still visible.

[0073] Step S503: Based on the snow coverage rate, the original surface normal of the second processing result is mixed with the perturbation normal from the snow bump map to obtain the second rendering result.

[0074] In some embodiments, subtle bumps and undulations are added to the snow surface to enhance its realism. A perturbation vector is obtained from a snow-specific bump map, and this perturbation vector is transformed into world space using a tangent space matrix (TBN) composed of surface tangents, double tangents, and normals to generate perturbed normals. ,in, The tangent, bitangent, and normal matrices, and the tangent space matrix (composed of tangents, bitangents, and normals) are used to correctly transform perturbations in the texture space into the surface coordinate system. The perturbation vector is derived from the snow bump map texture. Finally, the previously calculated snow cover is used again. The original surface normal With the perturbation normal Blend to obtain the normals used for the final rendering: This process determines the second rendering result. This operation ensures that the thicker the snow, the more obvious the surface details are, while the uncovered areas retain their original normals, thus accurately simulating the snow cover and accumulation effect in three-dimensional vision.

[0075] This dynamic cumulative rendering based on the rendering material model simulates the water accumulation, ripples, and reflections after raindrops fall, as well as the accumulation and covering of snowflakes after they fall. This makes the weather effects no longer superficial special effects, but physical phenomena that are truly integrated into the scene.

[0076] Further, the fusion of the first rendering result and the second rendering result to obtain the target rendering result includes: using Alpha blending technology, superimposing the first rendering result as the source color and the second rendering result as the target color to obtain the target rendering result. Specifically, after the first rendering result and the second rendering result are drawn, the Alpha blending function is enabled during the frame buffer operation stage of the graphics processor. For each pixel, the first rendering result is used as the source fragment to be drawn, and the second rendering result already existing in the frame buffer is used as the target fragment. Subsequently, pixel-by-pixel calculation is performed according to the above formula: the Alpha value of the source fragment (rain and snow) is used to weight and blend the source color and the target color to obtain the target rendering result that simultaneously contains dynamic rain and snow particles and static ground surface accumulation effects at that pixel, wherein the target rendering result is as follows: Figure 6 or Figure 7 As shown.

[0077] It should be noted that compared with existing solutions that rely on CPU particle systems or simple texture overlays, the technical solution of this invention has significant advantages in terms of performance, effects, and immersion. First, this invention completely delegates the generation and updating of rain and snow particles to the GPU shader. Combined with an instantiation rendering mechanism, this significantly reduces the data transfer overhead between the CPU and GPU, allowing for smooth real-time frame rates even when the number of particles reaches tens or even hundreds of thousands, breaking through the performance bottleneck of particle rendering on the browser side. Second, this invention introduces wind speed and direction vector fields and noise perturbation functions into the GPU dynamic calculation process, so that the falling rain and snow are no longer limited to a single straight line motion, but can present drifting, turbulence, and disturbance effects found in nature, thereby greatly improving the natural realism. Simultaneously, this invention, through a camera space binding mechanism, associates rain and snow rendering with the camera position, ensuring that there are no abrupt disappearances of boundary blanks or precipitation areas when the user moves freely in the scene, guaranteeing the continuity and immersion of the rendering effect. Finally, in terms of depicting rain and snow, this invention no longer relies on simple texture overlay. Instead, it combines physically based materials (PBR) and shader logic to dynamically represent the normal perturbation, reflection, and ripple changes of water accumulation, as well as the realistic effect of snow gradually accumulating and changing in thickness over time. This significantly enhances the realism and dynamic expressiveness of the scene. In summary, this invention has substantial improvements and advantages over existing technologies in terms of performance, effects, and immersion.

[0078] This invention provides data support for simulating the complex motions of rain and snow particles, such as drift and turbulence, by acquiring real-time position, wind speed, and wind direction information from the user's perspective. By allocating initial position and initial velocity, it breaks the complete synchronization of particle motion, laying the foundation for a natural and disordered rain and snow distribution. By injecting wind speed and direction information and noise perturbation functions into the update process, the particle motion is upgraded from simple uniformly accelerated falling to a composite motion driven by a directional wind field and influenced by random turbulence, greatly enhancing the naturalness and randomness of the motion. By dynamically associating the particle system with the camera coordinate system, it ensures seamless... Regardless of how the user moves their viewpoint, the rain and snow effects seamlessly and continuously fill the field of view, completely eliminating the boundaries and blank areas of rain and snow bands, thus enhancing realism. Dynamic cumulative rendering based on the rendering material model simulates the accumulation, ripples, and reflections of raindrops after they fall, as well as the accumulation and coverage of snowflakes after they fall, making the weather effects no longer superficial special effects, but truly integrated physical phenomena with the scene. By fusing the first and second rendering results, the visual representation of the scene is unified, forming a complete and self-consistent weather system from sky to ground, ultimately achieving a holistic and realistic simulation. Compared with existing technologies, this application can efficiently and realistically simulate rain and snow movement in a 3D scene.

[0079] like Figure 8As shown, based on the above method embodiments, corresponding apparatus embodiments are provided; An embodiment of the present invention provides a rain and snow rendering system for a three-dimensional scene, including: an acquisition module 100, an allocation module 200, a processing module 300, and a rendering module 400; The acquisition module 100 is used to acquire real-time location and wind speed and direction information from the user's perspective; The allocation module 200 is used to allocate initial position and initial velocity to each particle in the rain and snow particle swarm based on a preset number of particles. The processing module 300 is used to update the position and velocity of each particle in parallel according to the wind speed and direction information, the initial position, the initial velocity and the noise disturbance function, to obtain the updated particle position and particle velocity, and to perform camera spatial offset binding on the particle position based on the real-time position to obtain the target particle position. The rendering module 400 is used to render rain and snow particles based on the target particle position and the particle velocity to obtain a first rendering result, to perform dynamic cumulative rendering based on the rendering material model to obtain a second rendering result, and to fuse the first rendering result and the second rendering result to obtain a target rendering result.

[0080] It is understood that the above-described device embodiments correspond to the method embodiments of the present invention, and can implement the rain and snow rendering method for three-dimensional scenes provided by any of the above-described method embodiments of the present invention.

[0081] It should be noted that the device embodiments described above are merely illustrative, and some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can specifically be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0082] Based on the above embodiments of the rain and snow rendering method for three-dimensional scenes, another embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the rain and snow rendering method for three-dimensional scenes according to any embodiment of the present invention.

[0083] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device.

[0084] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.

[0085] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.

[0086] Based on the above-described method embodiments, another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the rain and snow rendering method for a three-dimensional scene as described in any of the above-described method embodiments of the present invention.

[0087] The modules / units integrated in the device / terminal equipment, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0088] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A method for rendering rain and snow in a three-dimensional scene, characterized in that, include: Obtain real-time location, wind speed, and wind direction information from the user's perspective; Based on a preset number of particles, assign initial positions and initial velocities to each particle in the rain and snow particle swarm. Based on the wind speed and direction information, the initial position, the initial velocity, and the noise disturbance function, the position and velocity of each particle are updated in parallel to obtain the updated particle position and particle velocity. Then, the particle position is bound to the camera spatial offset based on the real-time position to obtain the target particle position. Rain and snow particles are rendered based on the target particle position and the particle velocity to obtain a first rendering result. Dynamic cumulative rendering is performed based on the rendering material model to obtain a second rendering result. The first rendering result and the second rendering result are then merged to obtain the target rendering result.

2. The method for rendering rain and snow in a three-dimensional scene according to claim 1, characterized in that, The process of assigning initial positions and initial velocities to each particle in the rain and snow particle swarm based on a preset number of particles includes: A fixed-size buffer is pre-allocated in the graphics processor based on a preset number of particles; The particle emission area is determined based on the real-time location, and an initial position is randomly generated for each particle in the rain and snow particle swarm within the particle emission area. A reference falling velocity is set for each particle in the rain and snow particle swarm as an initial velocity. The reference falling velocity includes a first reference falling velocity and a second reference falling velocity. The first reference falling velocity is the initial velocity assigned when simulating rainfall, and the second reference falling velocity is the initial velocity assigned when simulating snowfall.

3. The method for rendering rain and snow in a three-dimensional scene according to claim 1, characterized in that, The step of updating the position and velocity of each particle in parallel based on the wind speed and direction information, the initial position, the initial velocity, and the noise perturbation function to obtain the updated particle position and particle velocity includes: The incremental impact of the wind field on particle velocity is determined based on the wind speed and direction information, and the incremental disturbance of noise on particle velocity is determined based on the noise disturbance function. The sum of the influence increment and the disturbance increment is added to the initial velocity to obtain the updated particle velocity; The current position of the particle is updated based on the updated particle velocity and time step to obtain the updated particle position.

4. The method for rendering rain and snow in a three-dimensional scene according to claim 1, characterized in that, The first rendering result obtained by rendering rain and snow particles based on the target particle position and the particle velocity includes: Based on the weather type simulated by the rain and snow particle swarm, a corresponding billboard rendering method is selected for each particle, wherein the weather type includes rain and snowfall; Based on the billboard rendering method, the target particle position, the particle velocity, and the camera orientation vector, the vertex coordinates of each particle facet are determined in the vertex shader of the graphics processor, wherein the camera orientation vector is determined based on the real-time position. Based on the vertex coordinates, the particle facets are colored in the fragment shader of the graphics processor, and the first rendering result is output.

5. The method for rendering rain and snow in a three-dimensional scene according to claim 1, characterized in that, The second rendering result includes rain accumulation rendering. The dynamic cumulative rendering based on the rendering material model to obtain the second rendering result includes: Based on physically based rendering materials, the water accumulation intensity of the surface to be rendered is calculated according to the vertical component of the normal of the surface to be rendered, the noise texture sampling value in world coordinates, and the preset global rainfall intensity. Based on the water accumulation intensity, the color, roughness, and metallicity parameters of the surface to be rendered are dynamically adjusted to obtain the adjustment result. The ripple perturbation normal is then mixed into the adjustment result to obtain the second rendering result, wherein the ripple perturbation normal is generated by noise and time factor.

6. The method for rendering rain and snow in a three-dimensional scene according to claim 1, characterized in that, The second rendering result includes snow rendering. The dynamic cumulative rendering based on the rendering material model to obtain the second rendering result includes: Based on physically based rendering materials, the snow coverage rate of the surface to be rendered is calculated according to the vertical component of the normal of the surface to be rendered, the noise texture sampling value in world coordinates, and the preset global snowfall intensity. Based on the snow coverage rate, the original color of the surface to be rendered is dynamically mixed with the snow color to obtain a first processing result, and the roughness and metallicity parameters of the first processing result are interpolated and adjusted to obtain a second processing result. Based on the snow coverage rate, the original surface normal of the second processing result is mixed with the perturbation normal from the snow bump map to obtain the second rendering result.

7. The method for rendering rain and snow in a three-dimensional scene according to any one of claims 1-6, characterized in that, The step of fusing the first rendering result and the second rendering result to obtain the target rendering result includes: using Alpha blending technology, superimposing the first rendering result as the source color and the second rendering result as the target color to obtain the target rendering result.

8. A rain and snow rendering system for a three-dimensional scene, characterized in that, include: Acquisition module, allocation module, processing module, and rendering module; The acquisition module is used to acquire real-time location and wind speed and direction information from the user's perspective; The allocation module is used to assign initial position and initial velocity to each particle in the rain and snow particle swarm based on a preset number of particles. The processing module is used to update the position and velocity of each particle in parallel according to the wind speed and direction information, the initial position, the initial velocity and the noise disturbance function, to obtain the updated particle position and particle velocity, and to perform camera spatial offset binding on the particle position based on the real-time position to obtain the target particle position. The rendering module is used to render rain and snow particles based on the target particle position and the particle velocity to obtain a first rendering result, perform dynamic cumulative rendering based on the rendering material model to obtain a second rendering result, and fuse the first rendering result and the second rendering result to obtain a target rendering result.

9. A terminal device, characterized in that, include: One or more processors; A memory, coupled to the processor, for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the steps of the rain and snow rendering method for a three-dimensional scene as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, include: A stored computer program, wherein, when the computer program is executed, the device containing the computer-readable storage medium controls the execution of the rain and snow rendering method for a three-dimensional scene as described in any one of claims 1-7.