Spraying type water column simulation method suitable for virtual scene, medium and equipment

Through parametric mesh deformation technology and staged dynamic operation, the problems of high computational overhead and poor realism of water column simulation in virtual scenes are solved, and realistic simulation and low computational overhead of the entire life cycle of water column spraying are achieved, which is suitable for real-time rendering scenes such as games.

CN120852607APending Publication Date: 2025-10-28FUZHOU SUZAKU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510916843.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-03
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

Existing water column simulation methods have high computational overhead and poor simulation realism in virtual scenes. They are difficult to run efficiently on mobile devices or in large-scale scenes, and lack refined control over the details of water column deformation.

Method used

Using parametric mesh deformation technology, initial parameters are obtained by responding to water column generation commands, the number of vertex rings is calculated to construct the basic mesh of the water column, and phased dynamic operations are performed according to the spraying status, including adding or removing vertex rings frame by frame. Combined with oscillation functions and wind field parameters, a foam particle system is generated to achieve a realistic simulation of the entire life cycle of the water column.

Benefits of technology

It significantly reduces computational overhead while maintaining the realism and visual effects of water jet spraying, making it suitable for real-time rendering scenarios such as games.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120852607A_ABST
    Figure CN120852607A_ABST
Patent Text Reader

Abstract

The invention discloses a spraying type water column simulation method suitable for a virtual scene, a medium and equipment. The method comprises the steps of obtaining parameters such as an initial height H, an initial radius R0 and a collision body position in response to a water column generation instruction; the number of vertex rings is calculated according to the formula N = H / d, a water column foundation grid is constructed, and the radiuses of all the rings are sequentially increased in the height direction; staged dynamic operation is carried out according to the spraying state, specifically, vertex rings are increased to N rings frame by frame in the spraying starting stage, transverse fluctuation displacement is overlaid for vertexes through an oscillation function in the spraying continuing stage, and top vertex rings are removed frame by frame from the position of a collision body in the spraying ending stage; and finally, calling the graphic API to draw the grid of the current frame. According to the method, the parameterized grid deformation technology is adopted, the vertex ring structure is dynamically adjusted in stages, real simulation of the whole life cycle of water column spraying is achieved, the calculation overhead is remarkably reduced while the visual effect is guaranteed, and the method is suitable for real-time rendering scenes such as games.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of mobile application development, specifically to a method, medium, and device for simulating spray-type water jets in virtual scenarios. Background Technology

[0002] In virtual environments such as games, virtual reality (VR), and augmented reality (AR), the dynamic representation of water (such as fountains and waterfalls) is crucial to the realism and immersion of the scene. Traditional water rendering techniques are mainly divided into two categories:

[0003] (1) Static representation method: The appearance of water is simulated by using a pre-made 3D model and texture materials (such as normal maps and transparent textures). This method is simple to implement, but lacks dynamic interactivity and cannot represent the dynamic changes of water flow.

[0004] (2) Dynamic simulation methods: These mainly include particle systems and physics engine simulations. Particle systems simulate water flow using a large number of particles, which can achieve basic dynamic effects, but it is difficult to represent the continuity and viscosity of water, and the computational cost increases significantly with the number of particles. Physics engine simulations, based on fluid dynamics equations, can achieve high realism, but the computational cost is too high for game scenes with high real-time requirements, and the parameter adjustment is complex, making it difficult to adapt to the needs of virtual scenes of different scales.

[0005] While current general-purpose plugins (such as FluidFlux) can quickly generate water column effects, they have the following limitations: (1) Insufficient adaptability: the preset parameters are difficult to dynamically respond to changes in the spraying state of the water column (such as the start, continuous, and end stages); (2) Monotonous effects: lack of fine-grained control over the deformation details of the water column (such as oscillation, frame-by-frame growth and fading); (3) Performance bottleneck: the physical simulation and rendering are tightly coupled, making it difficult to run efficiently on mobile devices or in large-scale scenes.

[0006] Therefore, there is an urgent need for a dynamic water column simulation method that balances real-time performance, realism, and low computational cost. Summary of the Invention

[0007] In view of the above problems, this application provides a method, medium, and equipment for simulating spray-type water columns in virtual scenes, in order to solve the problems of high computational cost and poor simulation realism in existing water column simulation generation methods.

[0008] To address the aforementioned problems, in a first aspect, this application provides a method for simulating spray-type water jets in virtual scenes, the method comprising:

[0009] In response to the water column generation command, water column generation parameters are obtained, including the initial height H of the water column, the starting position radius R0, and the position of the colliding body. The initial height H is the vertical distance from the starting position to the position of the colliding body.

[0010] Calculate the number of vertex rings N to obtain the basic mesh of the water column. The calculation formula is N = H / d, where d is the preset ring spacing. Each vertex ring includes multiple vertices distributed along the circumference. The radius of each vertex ring is calculated from the starting position to the position of the collider according to the interpolation function and increases sequentially.

[0011] The water column base grid is subjected to phased dynamic operations based on the water column spraying status. The spraying status includes a spraying start stage, a spraying duration stage, and a spraying end stage. The specific phased dynamic operations include:

[0012] At the beginning of the spraying phase, the number of vertex rings is increased frame by frame until N rings are reached. The radius of the newly added vertex rings is calculated frame by frame according to the interpolation function and is increased sequentially.

[0013] During the continuous spraying phase, the lateral undulation displacement is superimposed on the vertices and / or center points of all vertex rings using an oscillation function, calculated as follows: Δr i =A·sin(ωt+φ) i )·n i , where Δr i The position of the vertex and / or center point of the vertex ring after the lateral fluctuation displacement, where A is the amplitude, ω is the oscillation frequency, t is time, and φ is the position of the vertex ring. i This represents the phase difference corresponding to the current vertex ring. The formula for calculating the phase difference is: φ i = (N-1-i)·Δφ, where Δφ represents the preset phase gradient, n i This represents the normal vector of the ring plane of the current vertex ring;

[0014] At the end of the spraying phase, the topmost vertex ring is removed frame by frame from the position of the collider towards the starting position.

[0015] Call the graphics API to draw the water column base grid for the current frame.

[0016] Furthermore, the interpolation function is a linear interpolation, and the calculation formula is shown in formula (1). Formula (1) is as follows: Among them, R i R represents the radius of the cycle at vertex i, where i ranges from [0, N-1]. N The radius of the end vertex ring representing the position of the collider;

[0017] The vertex ring radius is calculated frame by frame according to the interpolation function and increases sequentially, including: the vertex ring radius is calculated frame by frame according to formula (1) and increases linearly.

[0018] Furthermore, the interpolation function is a spline interpolation function, which calculates the vertex loop radius of the interpolation as follows:

[0019] Define the initial position radius R0 at the top of the water column and the radius R of the final vertex loop at the bottom. N ;

[0020] Construct a piecewise continuous polynomial function such that the radius of the vertex loop changes from R0 to R along the height of the water column. N Smooth transition;

[0021] Normalized position parameter μ for each vertex ring i ∈[0,1], when μ i When μ = 1, the position parameter corresponding to the bottom, when μ i When = 0, the position parameter at the top is used to calculate the radius R of the interpolated vertex loop in the middle using the polynomial function. i .

[0022] Furthermore, the method includes:

[0023] Apply a rotation angle to the center point of each vertex ring and to all vertices. The formula for calculating the rotation angle is shown in formula (2). Formula (2) is as follows:

[0024] φ i =φ N +μ i ×(φ0-φ N );

[0025] Where, φ i Let φ be the rotation angle corresponding to the i-th vertex ring. N φ is the rotation angle corresponding to the end vertex ring at the collider position, and φ0 is the rotation angle corresponding to the vertex ring at the starting position.

[0026] Furthermore, we define the number of vertices M on each vertex cycle, where all vertices lie within a circle centered at the center point with radius R. i On the circumference of M, the dynamic adjustment range of M is:

[0027]

[0028] Where M0 is the base value for the number of vertices. Where ΔL is the preset maximum vertex spacing, and M min M is the minimum number of vertices threshold. max The maximum number of vertices threshold. This indicates the rounding up operation;

[0029] The method further includes:

[0030] The spacing d between adjacent vertex rings is dynamically adjusted according to the current frame rate f, and the calculation formula is as follows:

[0031]

[0032] Where d0 is the baseline spacing, f0 is the target frame rate, and α is the attenuation coefficient, with a value range of [0.5, 1].

[0033] Furthermore, the water column base mesh includes multiple triangular faces, and the method includes the following before the phased dynamic operation:

[0034] Duplicate all the triangular faces of the water column base mesh to generate a water column copy mesh, and reverse the vertex order of all the triangular faces of the water column base mesh so that the normal direction of the water column copy mesh is opposite to that of the corresponding triangular face on the water column base mesh.

[0035] The vertices of the water column base mesh are offset positively along the normal direction of the triangle face containing the vertex, and the vertices of the water column copy mesh are offset negatively along the normal direction of the triangle face containing the vertex, forming a closed structure.

[0036] Merge the vertex pairs in the water column base mesh and the water column replica mesh where the spatial distance is less than a preset error threshold, and remove the triangular faces formed by the fully merged vertices and the invalid triangular faces with abrupt changes in normals;

[0037] Distance-weighted normal interpolation is used to calculate the merged vertices, with higher weights for original vertices that are closer to each other. The smoothing intensity is automatically reduced in high curvature regions to preserve feature details, resulting in a complete water column base mesh.

[0038] The step of performing phased dynamic operations on the water column base grid based on the water column spraying state includes:

[0039] The complete water column base grid is subjected to phased dynamic operations based on the water column spraying status.

[0040] Furthermore, the method also includes:

[0041] A foam particle system and a collision-splash particle system are generated at the end of the water column;

[0042] The foam particle system is generated according to the following steps:

[0043] Take the set of all vertices of the vertex ring at the end of the water column;

[0044] A spherical particle emission region is established with the set of vertices as the center;

[0045] Calculate the cross-sectional area at the end of the water column, and adjust the number of particles emitted per unit time based on the ratio of the cross-sectional area to the preset reference area.

[0046] The initial velocity vector of the particles is set based on the velocity field data of the water column, and its direction is a linear combination of the normal and tangent of the water column surface. Random displacement perturbation is applied to each particle.

[0047] The collision sputtering particle system is generated in the following manner:

[0048] Real-time detection of the collision contact surface between the water column base mesh and colliders in the virtual scene;

[0049] A transient particle emitter is generated at the vertex position of the collision contact surface;

[0050] The principal direction of particle scattering is calculated based on the normal direction of the collision contact surface, and the coordinates of particles whose end positions meet the survival conditions are used as secondary emission sources.

[0051] A texture map is generated at the collision contact surface that is synchronized with the lifecycle of the collision sputtering particle system, and the texture parameters of the texture map are updated according to the direction of the collision impulse.

[0052] Furthermore, the water column base mesh includes multiple triangular faces, and the method further includes:

[0053] The wind field parameters in the virtual scene are acquired in real time, including the reference wind direction vector, wind speed intensity and time-varying turbulence disturbance components.

[0054] The water column base grid is divided into several elastic segments along its length. The vertices of each segment undergo non-rigid offset based on the wind pressure and constraints. The wind pressure is calculated based on wind field parameters, specifically including: the offset of the vertices on the windward side along the wind direction is proportional to the square of the wind speed; the vertices on the leeward side are subjected to attenuated displacement and generate a vortex-induced oscillation effect; and an enhanced deformation coefficient is applied to the end region of the water column to make the sprayed water droplets exhibit a downstream diffusion trend.

[0055] The constraints include: the maximum offset of each vertex does not exceed a certain multiple of the diameter of the vertex ring corresponding to that vertex, and when it is detected that the stretching of adjacent vertices of the same triangle exceeds a preset change value, a transition vertex is automatically inserted to prevent the water column base mesh from tearing.

[0056] In a second aspect, this application also provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the method described in the first aspect.

[0057] In a third aspect, this application also provides an electronic device including a memory and a processor, the memory being used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method described in the first aspect.

[0058] Unlike existing technologies, the above solution provides a method, medium, and device for simulating spray-type water columns in virtual scenes. The method includes: obtaining parameters such as initial height H, initial radius R0, and collider position in response to water column generation commands; calculating the number of vertex rings N = H / d to construct the basic water column mesh, with the radius of each ring increasing sequentially along the height direction; performing phased dynamic operations according to the spraying state, specifically including: adding vertex rings frame-by-frame to N rings at the start of spraying; superimposing lateral fluctuation displacements on vertices using an oscillation function during the spraying duration; and removing the top vertex rings frame-by-frame from the collider position at the end of spraying; finally, calling a graphics API to draw the mesh for the current frame. This application employs parametric mesh deformation technology, achieving realistic simulation of the entire lifecycle of water column spraying by dynamically adjusting the vertex ring structure in stages. While ensuring visual effects, it significantly reduces computational overhead, making it suitable for real-time rendering scenarios such as games.

[0059] The above description of the invention is merely an overview of the technical solution of this application. In order to enable those skilled in the art to better understand the technical solution of this application and to implement it based on the description and drawings, and to make the above-mentioned objectives and other objectives, features and advantages of this application easier to understand, the following description is provided in conjunction with the specific embodiments and drawings of this application. Attached Figure Description

[0060] The accompanying drawings are only used to illustrate the principles, implementation methods, applications, features, and effects of specific embodiments of this application and other related content, and should not be considered as limitations on this application.

[0061] In the accompanying drawings of the instruction manual:

[0062] Figure 1 A flowchart illustrating a spray-type water column simulation method applicable to virtual scenes, as described in the first exemplary embodiment of this application;

[0063] Figure 2 A flowchart illustrating a spray-type water column simulation method applicable to virtual scenes, as described in the second exemplary embodiment of this application;

[0064] Figure 3 A flowchart illustrating a spray-type water column simulation method applicable to virtual scenes, as described in the third exemplary embodiment of this application;

[0065] Figure 4 This is a flowchart illustrating a spray-type water column simulation method applicable to virtual scenes, as described in the fourth exemplary embodiment of this application.

[0066] Figure 5 A flowchart illustrating a spray-type water column simulation method applicable to virtual scenes, as described in the fifth exemplary embodiment of this application;

[0067] Figure 6 This is a schematic diagram of the water column foundation mesh generation process according to the first exemplary embodiment of this application;

[0068] Figure 7 This is a schematic diagram of the water column foundation mesh generation process according to the second exemplary embodiment of this application;

[0069] Figure 8 This is a schematic diagram of the water column foundation mesh generation process according to the third exemplary embodiment of this application;

[0070] Figure 9 This is a schematic diagram of the water column foundation mesh generation process according to the fourth exemplary embodiment of this application;

[0071] Figure 10 This is a schematic diagram of the water column foundation mesh generation process according to the fifth exemplary embodiment of this application;

[0072] Figure 11 This is a schematic diagram of the water column foundation mesh generation process according to the sixth exemplary embodiment of this application;

[0073] Figure 12 This is a schematic diagram of the water column foundation mesh generation process according to the seventh exemplary embodiment of this application;

[0074] Figure 13 This is a schematic diagram of the water column foundation mesh generation process according to the eighth exemplary embodiment of this application;

[0075] Figure 14 This is a schematic diagram of the modules of the electronic device involved in this application;

[0076] The reference numerals used in the above figures are explained as follows:

[0077] 10. Electronic devices;

[0078] 101. Processor;

[0079] 102. Storage medium. Detailed Implementation

[0080] To illustrate the possible application scenarios, technical principles, implementable specific solutions, and achievable objectives and effects of this application in detail, the following description, in conjunction with the listed specific embodiments and accompanying drawings, provides a detailed explanation. The embodiments described herein are merely illustrative of the technical solutions of this application and are therefore intended to limit the scope of protection of this application.

[0081] In this document, the term "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The term "embodiment" appearing in various places throughout the specification does not necessarily refer to the same embodiment, nor does it specifically limit its independence or connection with other embodiments. In principle, in this application, as long as there are no technical contradictions or conflicts, the technical features mentioned in each embodiment can be combined in any way to form corresponding implementable technical solutions.

[0082] Unless otherwise defined, the technical terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the use of related terms herein is merely for the purpose of describing particular embodiments and is not intended to limit this application.

[0083] In the description of this application, the term "and / or" is used to describe the logical relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A exists, B exists, and A and B exist simultaneously. Additionally, the character " / " in this document generally indicates that the preceding and following objects have an "or" logical relationship.

[0084] In this application, terms such as “first” and “second” are used only to distinguish one entity or operation from another, and do not necessarily require or imply any actual quantity, hierarchy or order relationship between these entities or operations.

[0085] Without further limitations, the use of terms such as “comprising,” “including,” “having,” or other similar open-ended expressions in this application is intended to cover non-exclusive inclusion, which does not exclude the presence of additional elements in a process, method, or product that includes the stated elements, such that a process, method, or product that includes a list of elements may include not only those defined elements but also other elements not expressly listed, or elements inherent to such a process, method, or product.

[0086] In this application, expressions such as "greater than", "less than", and "exceeding" are understood to exclude the stated number; expressions such as "above", "below", and "within" are understood to include the stated number. Furthermore, in the description of the embodiments of this application, "multiple" means two or more (including two), and similar expressions related to "multiple" are also understood in this way, such as "multiple groups" and "multiple times", unless otherwise explicitly specified.

[0087] In the first aspect, such as Figure 1 As shown, this application provides a method for simulating spray-type water jets in virtual scenes, the method comprising:

[0088] S1: Responding to the water column generation command, obtain the water column generation parameters;

[0089] In step S1, the water column generation command refers to the trigger signal that starts the water column simulation. This can be triggered by player actions (such as clicking, pressing buttons, or gamepad input), scripts or events, or physical system interactions (such as collisions or physical interactions between the player-controlled virtual character and other game objects triggering the water column). Water column generation can also be dynamically adjusted using external parameters. The water column generation parameters include the initial height H of the water column, the starting position radius R0, and the position of the collider. The initial height H is the vertical distance from the starting position to the collider position. If there is no collider position in the virtual scene, the maximum range position of the water column is set as the ending position.

[0090] S2: Calculate the number of vertex loops N to obtain the basic mesh of the water column.

[0091] In step S2, the calculation formula is N = H / d, where d is the preset ring spacing. Each vertex ring includes multiple vertices distributed circumferentially. The radius of each vertex ring is calculated from the starting position to the position of the collider according to the interpolation function and increases sequentially.

[0092] S3: Perform phased dynamic operations on the water column base grid according to the water column spraying status.

[0093] In step S3, the spraying state includes a spraying start stage, a spraying duration stage, and a spraying end stage. The specific execution of the phased dynamic operation includes:

[0094] At the beginning of the spraying phase, the number of vertex rings is increased frame by frame until N rings are reached. The radius of the newly added vertex rings is calculated frame by frame according to the interpolation function and is increased sequentially.

[0095] During the continuous spraying phase, the lateral undulation displacement is superimposed on the vertices and / or center points of all vertex rings using an oscillation function, calculated as follows: Δr i =A·sin(ωt+φ) i )·n i , where Δr i The position of the vertex and / or center point of the vertex ring after the lateral fluctuation displacement, where A is the amplitude, ω is the oscillation frequency, t is time, and φ is the position of the vertex ring. i This represents the phase difference corresponding to the current vertex ring. The formula for calculating the phase difference is: φ i = (N-1-i)·Δφ, where Δφ represents the preset phase gradient, n i This represents the normal vector of the ring plane of the current vertex ring;

[0096] At the end of the spraying phase, the topmost vertex ring is removed frame by frame from the position of the collider towards the starting position.

[0097] S4: Call the graphics API to draw the water column base grid for the current frame.

[0098] The above solution employs parametric mesh deformation technology, which dynamically adjusts the vertex ring structure in stages to achieve a realistic simulation of the entire life cycle of water jet spraying. While ensuring visual effects, it significantly reduces computational overhead and is suitable for real-time rendering scenarios such as games.

[0099] In some embodiments, the interpolation function is a linear interpolation, and the calculation formula is shown in formula (1). Formula (1) is as follows: Among them, R i R represents the radius of the cycle at vertex i, where i ranges from [0, N-1]. N The radius of the end vertex ring representing the position of the collider;

[0100] The vertex ring radius is calculated frame by frame according to the interpolation function and increases sequentially, including: the vertex ring radius is calculated frame by frame according to formula (1) and increases linearly.

[0101] In other embodiments, the interpolation function is a spline interpolation function, which calculates the vertex loop radius of the interpolation as follows:

[0102] Define the initial position radius R0 at the top of the water column and the radius R of the final vertex loop at the bottom. N ;

[0103] Construct a piecewise continuous polynomial function such that the radius of the vertex loop changes from R0 to R along the height of the water column. N Smooth transition;

[0104] Normalized position parameter μ for each vertex ring i ∈[0,1], when μ i When μ = 1, the position parameter corresponding to the bottom, when μ i When = 0, the position parameter at the top is used to calculate the radius R of the interpolated vertex loop in the middle using the polynomial function. i .

[0105] Preferably, the spline interpolation function can be a cubic spline, a B-spline, a Catmull-Rom spline interpolation function, etc.

[0106] Taking the Catmull-Rom spline interpolation function as an example, its cubic polynomial coefficients are generated through the following steps:

[0107] Define control point R0 as the top starting radius (corresponding to parameter μ). i =0), R N The bottom end radius (corresponding parameter μ) i=1, radius of the intermediate control point of R1 (μ) i If the value is some value between (0,1), then the virtual control point is defined as follows:

[0108] R -1 (Left virtual point): R -1 =2R0-R1;

[0109] R2 (right virtual point): R2 = 2R N -R1;

[0110] Assuming R1 = (R0 + RN) / 2, the formula for calculating the polynomial coefficients is as follows:

[0111] a = 0.5 × (-R) -1 +3R0-3R1+R2);

[0112] b = 0.5 × (2R) -1 -5R0+4R1-R2);

[0113] c = 0.5 × (-R) -1 +R1);

[0114] d = R0;

[0115] Then the vertex loop radius of each interpolation and its corresponding position parameter u i The calculation formula is as follows:

[0116] R(u i )=a·u i 3 +b·u i 2 +c·u i +d.

[0117] Furthermore, the method includes:

[0118] Apply a rotation angle to the center point of each vertex ring and to all vertices. The formula for calculating the rotation angle is shown in formula (2). Formula (2) is as follows:

[0119] φ i =φ N +μ i ×(φ0-φ N );

[0120] Where, φ i Let φ be the rotation angle corresponding to the i-th vertex ring. N φ is the rotation angle corresponding to the end vertex ring at the collider position, and φ0 is the rotation angle corresponding to the vertex ring at the starting position.

[0121] In some embodiments, the number of vertices M on each vertex ring is defined, and all vertices lie on a circle centered at the center point with radius R. i On the circumference of M, the dynamic adjustment range of M is:

[0122]

[0123] Where M0 is the base value for the number of vertices. Where ΔL is the preset maximum vertex spacing, and M min M is the minimum number of vertices threshold. max The maximum number of vertices threshold. This indicates the rounding up operation;

[0124] The method further includes:

[0125] The spacing d between adjacent vertex rings is dynamically adjusted according to the current frame rate f, and the calculation formula is as follows:

[0126]

[0127] Where d0 is the baseline spacing, f0 is the target frame rate, and α is the attenuation coefficient, with a value range of [0.5, 1].

[0128] like Figure 6-Figure 8 As shown, when generating the basic mesh for the water column, a vertex loop is first generated at the beginning and end (bottom and top) of the water column, and then more vertex loops are generated between the two vertex loops at the same spacing. The bottom of the water column refers to the contact surface between the water column and the collider, i.e., the end position of the water column. When there is no collider in the scene, the maximum range position of the water column is set as the end position. The top of the water column refers to the starting position of the water column.

[0129] The number of vertex rings generated is determined by the actual height of the water column and the required level of detail. Specifically, the number of rings is calculated based on the total height H of the water column and the preset ring spacing d: number of rings ≈ H / d. The number of vertices on each vertex ring can be determined based on the diameter of the water column and the visual smoothness requirements. For example, values ​​can be 12, 16, 24, etc. The more vertices in a vertex ring, the closer the cross-section of the water column is to a circle, and the more refined the rendering effect, but the computational load also increases accordingly. The spacing between vertex rings can be dynamically adjusted according to the real-time frame rate or time step to ensure that the water column model has appropriate segmentation accuracy without obvious discontinuities.

[0130] Preferably, all vertex rings are located on the central axis of the water column and are evenly distributed along the length of the water column. Each vertex ring corresponds to a center point. The central axis of the water column refers to the curve connecting these center points along the direction of water column jetting.

[0131] After obtaining several vertex rings, the vertex rings are then interpolated, resized, and rotated according to the actual size of the water column. Besides the interpolation and rotation methods described in the previous embodiment, a spline interpolation function can also be used. The spline interpolation function is used to scale and rotate each vertex ring, resulting in the following... Figure 9 The smooth water column base grid is shown.

[0132] In some embodiments, as Figure 2 As shown, the water column base mesh includes multiple triangular faces. Before the phased dynamic operation, the method includes:

[0133] S201: Copy all the triangular faces of the water column base mesh to generate a water column copy mesh, and reverse the vertex order of all the triangular faces of the water column base mesh so that the normal direction of the water column copy mesh is opposite to that of the corresponding triangular face on the water column base mesh.

[0134] S202: Offset the vertices of the water column base mesh in the positive direction along the normal direction of the triangle face where the vertex is located, and offset the vertices of the water column replica mesh in the negative direction along the normal direction of the triangle face where the vertex is located, to form a closed structure.

[0135] S203: Merge the vertex pairs in the water column base mesh and the water column replica mesh whose spatial distance is less than a preset error threshold, and remove the triangular faces formed by the fully merged vertices and the invalid triangular faces with abrupt changes in normals;

[0136] S204: The merged vertices are calculated using distance-weighted normal interpolation. The closer the original vertex is, the higher the weight. The smoothing intensity is automatically reduced in high curvature regions to preserve feature details, resulting in a complete water column base mesh.

[0137] In step S3, performing phased dynamic operations on the water column base grid according to the water column spraying state includes performing phased dynamic operations on the complete water column base grid according to the water column spraying state. That is, the object processed in the spraying start stage, spraying duration stage, and spraying end stage is the complete water column base grid.

[0138] like Figure 10As shown, during the merging process, the base water column mesh can be used as the outer shell, and the copy water column mesh as the inner shell, giving the merged base water column mesh a certain thickness and preventing light from penetrating. During merging, duplicate vertices and overlapping triangles in the two meshes need to be processed. Specifically, a vertex position merging algorithm is used to merge corresponding vertices from the two meshes and remove overlapping inner triangles to form a closed solid water column model. Then, normal smoothing or edge smoothing techniques are used to interpolate the vertex normals of adjacent regions, making the surface appear more continuous and natural. Finally, a complete base water column mesh model that includes both internal structure and seamlessness is obtained, as shown below. Figure 11 As shown.

[0139] In this embodiment, Boolean variables and timers can be used to manage the switching of water jet spraying states, and the processing method of the mesh model can be selected according to the current water jet spraying state. Specifically: if the spraying state is "spraying in progress" (i.e., in the continuous spraying stage), the complete water jet model is used; if it is in the start or end stage of spraying, the corresponding vertex ring data needs to be dynamically modified to adjust the length or radius of the water jet base mesh.

[0140] like Figure 12 As shown, in the initial stage of spraying, water columns can be gradually generated. That is, only one bottom vertex ring is generated at the beginning, and the upper vertex rings are gradually added as time goes on. Alternatively, the size of the vertex rings can be made close to zero in the initial state and then gradually increased to the normal radius, thus presenting the effect of water columns "emerging" from the ground.

[0141] At the end of the spraying phase, a reverse operation is performed, specifically including: gradually reducing the top vertex rings or linearly shrinking the vertex positions, and simultaneously reducing vertex transparency, causing the water column to gradually dissipate at the end. In practice, the height, vertex ring radius, or position of the complete water column base mesh can be linearly or smoothly interpolated to control the expansion or contraction of the water column frame by frame. In this way, the water column base mesh will exhibit a smooth transition animation during both the water column generation and disappearance phases.

[0142] like Figure 3 As shown, in some embodiments, the method further includes:

[0143] Step S301: Generate a foam particle system and a collision sputtering particle system at the end of the water column;

[0144] Step S302: Generate a texture map on the collision contact surface that is synchronized with the lifecycle of the collision sputtering particle system, and update the texture parameters of the texture map according to the collision impulse direction.

[0145] like Figure 4 As shown, the foam particle system is generated according to the following steps:

[0146] S401: Take the set of all vertices of the vertex ring at the end of the water column;

[0147] S402: Establish a spherical particle emission region centered on the set of vertices;

[0148] S403: Calculate the cross-sectional area of ​​the end of the water column and adjust the number of particles emitted per unit time according to the ratio of the cross-sectional area to the preset reference area.

[0149] S404: Set the initial velocity vector of the particles based on the water column velocity field data. Its direction is a linear combination of the normal and tangent of the water column surface, and apply random displacement perturbation to each particle.

[0150] In steps S401-S404, an adaptive particle emission strategy is adopted, meaning the particle density can be dynamically adjusted according to the current environment, and the particle density N... foam The calculation formula is as follows:

[0151]

[0152] Among them, N foam N represents the current number of particles. base A represents the base value for the set number of particles emitted. end The real-time cross-sectional area at the end of the water column can be calculated by summing the triangular faces of the ring at the vertex of the end position. A base This represents the base value of the set cross-sectional area, α is the area influence coefficient (α's value range is less than 1, for example, it can be set to 0.7), β is the velocity influence coefficient (for example, it can be set to 0.3), ||υ|| represents the magnitude of the velocity vector at the end of the water column (i.e., the magnitude of the velocity), and υ max This represents the set upper speed threshold, which, through normalization, ensures that ||υ|| and υ are equal. max The value range is within [0,1].

[0153] Preferably, the magnitude of the velocity vector at the end of the water column is represented by the Euclidean norm of that vector, and the calculation formula is as follows:

[0154]

[0155] A higher velocity at the tip of the water column indicates a stronger impact force at that point, causing more water to break into foam, thus dynamically increasing the number of emitted particles. Conversely, a lower velocity at the tip of the water column results in a smaller number of emitted foam particles approaching the baseline value N. base Furthermore, the smaller the real-time cross-sectional area at the end of the water column, the more foam particles are generated.

[0156] When the turbulence intensity exceeds a threshold, the amplitude of random displacement disturbance is automatically increased to prevent excessive and unreasonable foam particles from being generated in low-velocity, small water columns. Simultaneously, the foam density is automatically increased during high-pressure jetting to conform to fluid dynamics characteristics. The generated basic mesh model of the water column with foam particles is as follows: Figure 13 As shown.

[0157] like Figure 5 As shown, the collision sputtering particle system is generated in the following manner:

[0158] S501: Real-time detection of the collision contact surface between the water column base mesh and colliders in the virtual scene;

[0159] S502: A transient particle emitter is generated at the vertex position of the collision contact surface;

[0160] S503: Calculate the principal direction of particle scattering based on the normal direction of the collision contact surface, and use the coordinates of particles whose end positions meet the survival conditions as secondary emission sources.

[0161] In step S503, the initial velocity of the secondary emitted particle is derived from the velocity of the primary particle (i.e., the particle after the collision), and the calculation formula is as follows:

[0162] υ secondary =υ primary ·e -k·t ·n reflect ;

[0163] Among them, υ secondary υ represents the initial velocity of the secondary emitted particle. primary e represents the velocity vector of the primary particle. -k·t n represents the attenuation factor, k represents the attenuation coefficient (a constant greater than 0), t represents the time parameter (the time difference between the primary particle's collision and the triggering of secondary emission); the longer the time t or the larger the k, the lower the velocity of the secondary particle. reflect This represents the reflection vector of the normal to the collision contact surface.

[0164] If the incident direction of the primary particle is d in If the normal to the collision surface is n, then the reflection vector of the normal to the collision contact surface is n. reflect The following formula can be used to calculate n: reflect =d in -2(d in ·n)n.

[0165] In some embodiments, the water column base grid includes multiple triangular faces, and the method further includes:

[0166] Step S601: Obtain wind field parameters in the virtual scene in real time. The wind field parameters include the reference wind direction vector, wind speed intensity, and turbulent disturbance components that change with time.

[0167] Step S602 divides the water column base grid into several elastic segments along the length direction. The vertices of each segment undergo non-rigid offset based on the wind pressure and constraints. The wind pressure is calculated based on wind field parameters, specifically including: the offset of the vertices on the windward side along the wind direction is proportional to the square of the wind speed; the vertices on the leeward side are subjected to attenuation displacement and generate a vortex-induced oscillation effect; and an enhanced deformation coefficient is applied to the end region of the water column to make the sprayed water droplets exhibit a downstream diffusion trend.

[0168] The constraints include: the maximum offset of each vertex does not exceed a certain multiple of the diameter of the vertex ring corresponding to that vertex, and when it is detected that the stretching of adjacent vertices of the same triangle exceeds a preset change value, a transition vertex is automatically inserted to prevent the water column base mesh from tearing.

[0169] In this embodiment, the water column can be divided into M elastic segments (e.g., M=10) along its length. Each segment contains several vertex loops, and the vertices contained in all vertex loops within the same segment constitute a vertex group. For each vertex P... i The position offset can be calculated using the following formula:

[0170] ΔP i =Δd wind +Δ dvortex +Δd end ;

[0171] Wherein, ΔP i Δd represents the total displacement. wind This represents the positional offset caused by wind pressure weighting, and this offset is inversely proportional to the distance from the vertex to the windward side, Δd. vortex Δd represents the displacement caused by eddy current oscillation. end This indicates the offset of the end-strength deformation.

[0172] Set the maximum offset constraint for each vertex, with the formula: ||ΔPi||≤α·D i Where ||ΔPi|| represents the magnitude of the maximum offset, α is the scaling factor, and its value ranges from [0,1]. i This indicates the diameter of the vertex ring containing the current vertex.

[0173] Then, by detecting the rate of change of the side length of the triangle, it can be determined whether a transition vertex needs to be inserted between the two vertices. The calculation formula is as follows:

[0174]

[0175] Where η represents the rate of change of the side length of the triangular face, ||P j -P k || represents the current edge length, P j and P k Let ||P represent two vertices on the triangle after displacement adjustment. j 0 -P k 0 || represents the initial edge length of the two identical vertices. When η is detected to be greater than the preset rate of change, a transition vertex is inserted to prevent the water column base mesh from being overstretched.

[0176] In a second aspect, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the spray-type water column simulation method applicable to virtual scenes as described in the first aspect of this application.

[0177] The computer-readable storage medium may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.

[0178] The non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD ROM); the magnetic surface memory may be a disk storage device or a magnetic tape storage device.

[0179] The volatile memory may be random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synclink dynamic random access memory (SLDRAM), and direct memory bus random access memory (DRRAM). The computer-readable storage media described in the embodiments of this application are intended to include these and any other suitable types of memory.

[0180] like Figure 14 As shown, in a third aspect, this application provides an electronic device 10, including a processor 101 and a storage medium 102, wherein a computer program is stored on the storage medium, and the computer program, when executed by the processor, implements the spray-type water column simulation method applicable to virtual scenes as described in the first aspect of this application.

[0181] In some embodiments, the processor may be implemented by software, hardware, firmware, or a combination thereof, and may be a circuit, one or more of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, or a microprocessor, thereby enabling the processor to execute some or all of the steps or any combination thereof in the spray-type water column simulation method for virtual scenes described in the various embodiments of this application.

[0182] Finally, it should be noted that although the above embodiments have been described in the text and drawings of this application, this should not limit the scope of patent protection of this application. Any technical solutions that are based on the essential concept of this application and utilize the content described in the text and drawings of this application, resulting in equivalent structural or procedural substitutions or modifications, as well as the direct or indirect application of the technical solutions of the above embodiments to other related technical fields, are all included within the scope of patent protection of this application.

Claims

1. A method for simulating spray-type water columns in virtual scenes, characterized in that, The method includes: In response to the water column generation command, water column generation parameters are obtained, including the initial height H of the water column, the starting position radius R0, and the position of the colliding body. The initial height H is the vertical distance from the starting position to the position of the colliding body. Calculate the number of vertex rings N to obtain the basic mesh of the water column. The calculation formula is N = H / d, where d is the preset ring spacing. Each vertex ring includes multiple vertices distributed along the circumference. The radius of each vertex ring is calculated from the starting position to the position of the collider according to the interpolation function and increases sequentially. The water column base grid is subjected to phased dynamic operations based on the water column spraying status. The spraying status includes a spraying start stage, a spraying duration stage, and a spraying end stage. The specific phased dynamic operations include: At the beginning of the spraying phase, the number of vertex rings is increased frame by frame until N rings are reached. The radius of the newly added vertex rings is calculated frame by frame according to the interpolation function and is increased sequentially. During the continuous spraying phase, the lateral undulation displacement is superimposed on the vertices and / or center points of all vertex rings using an oscillation function, calculated as follows: Δr i =A·sin(ωt+φ) i )·n i , where Δr i The position of the vertex and / or center point of the vertex ring after the lateral fluctuation displacement, where A is the amplitude, ω is the oscillation frequency, t is time, and φ is the position of the vertex ring. i This represents the phase difference corresponding to the current vertex ring. The formula for calculating the phase difference is: φ i = (N-1-i)·Δφ, where Δφ represents the preset phase gradient, n i This represents the normal vector of the ring plane of the current vertex ring; At the end of the spraying phase, the topmost vertex ring is removed frame by frame from the position of the collider towards the starting position. Call the graphics API to draw the water column base grid for the current frame.

2. The method for simulating spray-type water columns in virtual scenes as described in claim 1, characterized in that, The interpolation function is a linear interpolation, and the calculation formula is shown in formula (1). Formula (1) is as follows: Among them, R i R represents the radius of the cycle at vertex i, where i ranges from [0, N-1]. N The radius of the end vertex ring representing the position of the collider; The vertex ring radius is calculated frame by frame according to the interpolation function and increases sequentially, including: the vertex ring radius is calculated frame by frame according to formula (1) and increases linearly.

3. The method for simulating spray-type water columns suitable for virtual scenes as described in claim 1, characterized in that, The interpolation function is a spline interpolation function, which calculates the vertex loop radius of the interpolation as follows: Define the initial position radius R0 at the top of the water column and the radius R of the final vertex loop at the bottom. N ; Construct a piecewise continuous polynomial function such that the radius of the vertex loop changes from R0 to R along the height of the water column. N Smooth transition; Normalized position parameter μ for each vertex ring i ∈[0,1], when μ i When μ = 1, the position parameter corresponding to the bottom, when μ i When = 0, the position parameter at the top is used to calculate the radius R of the interpolated vertex loop in the middle using the polynomial function. i .

4. The method for simulating spray-type water columns in virtual scenes as described in claim 3, characterized in that, The method includes: Apply a rotation angle to the center point of each vertex ring and to all vertices. The formula for calculating the rotation angle is shown in formula (2). Formula (2) is as follows: f i =φ N +m i ×(φ0-φ N ); Where, φ i Let φ be the rotation angle corresponding to the i-th vertex ring. N φ is the rotation angle corresponding to the end vertex ring at the collider position, and φ0 is the rotation angle corresponding to the vertex ring at the starting position.

5. The method for simulating spray-type water columns in virtual scenes as described in claim 2 or 3, characterized in that, Define the number of vertices M on each vertex cycle, where all vertices lie on a circle centered at the center point with radius R. i On the circumference of M, the dynamic adjustment range of M is: Where M0 is the base value for the number of vertices. Where ΔL is the preset maximum vertex spacing, and M min M is the minimum number of vertices threshold. max The maximum number of vertices threshold. This indicates the rounding up operation; The method further includes: The spacing d between adjacent vertex rings is dynamically adjusted according to the current frame rate f, and the calculation formula is as follows: Where d0 is the baseline spacing, f0 is the target frame rate, and α is the attenuation coefficient, with a value range of [0.5, 1].

6. The method for simulating spray-type water columns in virtual scenes as described in claim 1, characterized in that, The water column base grid includes multiple triangular faces, and the method includes: [Further details needed for the phased dynamic operation] Duplicate all the triangular faces of the water column base mesh to generate a water column copy mesh, and reverse the vertex order of all the triangular faces of the water column base mesh so that the normal direction of the water column copy mesh is opposite to that of the corresponding triangular face on the water column base mesh. The vertices of the water column base mesh are offset positively along the normal direction of the triangle face containing the vertex, and the vertices of the water column copy mesh are offset negatively along the normal direction of the triangle face containing the vertex, forming a closed structure. Merge the vertex pairs in the water column base mesh and the water column replica mesh where the spatial distance is less than a preset error threshold, and remove the triangular faces formed by the fully merged vertices and the invalid triangular faces with abrupt changes in normals; Distance-weighted normal interpolation is used to calculate the merged vertices, with higher weights for original vertices that are closer to each other. The smoothing intensity is automatically reduced in high curvature regions to preserve feature details, resulting in a complete water column base mesh. The step of performing phased dynamic operations on the water column base grid based on the water column spraying state includes: The complete water column base grid is subjected to phased dynamic operations based on the water column spraying status.

7. The method for simulating spray-type water columns in virtual scenes as described in claim 1, characterized in that, The method further includes: A foam particle system and a collision-splash particle system are generated at the end of the water column; The foam particle system is generated according to the following steps: Take the set of all vertices of the vertex ring at the end of the water column; A spherical particle emission region is established with the set of vertices as the center; Calculate the cross-sectional area at the end of the water column, and adjust the number of particles emitted per unit time based on the ratio of the cross-sectional area to the preset reference area. The initial velocity vector of the particles is set based on the velocity field data of the water column, and its direction is a linear combination of the normal and tangent of the water column surface. Random displacement perturbation is applied to each particle. The collision sputtering particle system is generated in the following manner: Real-time detection of the collision contact surface between the water column base mesh and colliders in the virtual scene; A transient particle emitter is generated at the vertex position of the collision contact surface; The principal direction of particle scattering is calculated based on the normal direction of the collision contact surface, and the coordinates of particles whose end positions meet the survival conditions are used as secondary emission sources. A texture map is generated at the collision contact surface that is synchronized with the lifecycle of the collision sputtering particle system, and the texture parameters of the texture map are updated according to the direction of the collision impulse.

8. The method for simulating spray-type water columns suitable for virtual scenes as described in claim 1, characterized in that, The water column base grid includes multiple triangular faces, and the method further includes: The wind field parameters in the virtual scene are acquired in real time, including the reference wind direction vector, wind speed intensity and time-varying turbulence disturbance components. The water column base grid is divided into several elastic segments along its length. The vertices of each segment undergo non-rigid offset based on the wind pressure and constraints. The wind pressure is calculated based on wind field parameters, specifically including: the offset of the vertices on the windward side along the wind direction is proportional to the square of the wind speed; the vertices on the leeward side are subjected to attenuated displacement and generate a vortex-induced oscillation effect; and an enhanced deformation coefficient is applied to the end region of the water column to make the sprayed water droplets exhibit a downstream diffusion trend. The constraints include: the maximum offset of each vertex does not exceed a certain multiple of the diameter of the vertex ring corresponding to that vertex, and when it is detected that the stretching of adjacent vertices of the same triangle exceeds a preset change value, a transition vertex is automatically inserted to prevent the water column base mesh from tearing.

9. A computer-readable storage medium storing computer program instructions thereon, characterized in that, The computer program instructions, when executed by a processor, implement the method as described in any one of claims 1 to 8.

10. An electronic device comprising a memory and a processor, characterized in that, The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in any one of claims 1 to 8.