GPU-driven interactive large-range three-dimensional flow field visualization method
Through the interactive large-scale three-dimensional flow field visualization method driven by GPU, the distribution and life cycle of flow field particles are dynamically adjusted, and the confidence is calculated by combining depth distribution, feature region matching and randomized weights, the problem of unnatural flow occlusion and flow is solved, and efficient and interactive flow field visualization effect is achieved.
Patent Information
- Application Number
- CN202411674625.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-11-21
AI Technical Summary
Three-dimensional flow field visualization faces problems such as streamline occlusion, poor selection of seed points, and unnatural flow of streamlines in large-scale scenarios, which makes it difficult to distinguish and display the characteristics of the flow field area.
Using the GPU-driven interactive large-scale three-dimensional flow field visualization method, we can create indirect drawing command records and flow field calculation related buffers on the GPU, dynamically adjust the distribution and life cycle of flow field particles, and combine depth distribution, feature area matching and randomized weight calculation confidence to realize natural dynamic rendering of streamlines.
It effectively reduces streamline occlusion, improves the expression effect of flow field characteristics and visual interaction, and ensures the accurate and consistent display of flow field in large-scale scenarios.
Smart Images

Figure CN119693516A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer graphics and three-dimensional visualization, and in particular relates to a GPU-driven interactive large-scale three-dimensional flow field visualization method. Background Art
[0002] Three-dimensional flow field visualization plays an important role in scientific computing, engineering applications and digital twin scenarios. Flow field visualization technology is widely used to display the characteristics of flow fields in the real world to achieve monitoring and analysis of complex environments. With the deep integration of technologies such as the Internet, big data, the Internet of Things and digital twins, the visualization effect of three-dimensional flow fields has been given higher requirements to meet the dynamic, real-time and interactive display needs in complex scenarios.
[0003] Traditional three-dimensional flow field visualization methods mainly include icon method, texture method, streamline placement algorithm based on feature extraction and geometric method based on particle tracking. These methods have their own characteristics: icon method and texture method can intuitively display the flow field, but when dealing with large-scale three-dimensional scenes, due to occlusion problems and limitations of rendering efficiency, their effects are often not ideal. For example, the patent application with publication number CN110211207A provides a three-dimensional flow field visualization method based on streamline length accumulation. The streamline placement algorithm based on feature extraction can display the key feature areas of the flow field, but the features are often non-continuous. Placing streamlines based on features alone may lead to uneven streamline distribution, making it difficult to fully display the entire flow field structure. In contrast, the geometric method based on particle tracking has outstanding performance in real-time, expressibility and interactivity, and can dynamically display the motion state of flow field streamlines, so it has become an important development direction in the field of three-dimensional flow field visualization.
[0004] However, particle tracking-based methods still face problems such as streamline occlusion, poor seed point selection, and unnatural streamline flow when visualizing three-dimensional flow fields. These problems often make the regional features of the flow field difficult to distinguish visually, making it difficult to capture and display the complex features of the flow field. For example, a method for visualizing ocean currents based on the data structure and trajectory generation strategy of an improved particle system is provided in a patent application with publication number CN118411461A. To address these problems, existing methods include adjusting the depth distribution of flow field particles and generating streamlines through pre-calculated flow field features. In practical applications, especially in large-scale and highly complex scenes, it is necessary to weigh different methods and choose between different visualization effects. Therefore, how to reduce streamline occlusion while showing flow field characteristics and maintaining the natural dynamics of streamline visualization is still a major problem facing three-dimensional flow field visualization.
[0005] In large-scale three-dimensional scenes (such as the digital earth and complex digital twin environments), three-dimensional flow field visualization based on particle tracking requires tracking enough particles in the entire fluid domain to ensure visualization of global flow characteristics. However, too many particles will increase the burden of calculation and rendering. The traditional CPU-based computing mode is difficult to meet the requirements of real-time and interactivity. To address this problem, existing methods usually use parallel computing (such as OpenMP) or GPU acceleration (such as CUDA or OpenCL) to improve the computational efficiency of particle tracking algorithms. By assigning the calculation tasks of particle motion trajectories to multiple cores or GPU threads, the calculation time can be significantly reduced, and a closer real-time visualization effect can be achieved. For those particles that no longer provide useful information for visualization, they can be removed, thereby reducing the calculation and rendering overhead. With the development of GPUs, many new features have emerged, such as hardware ray tracing, mesh shaders, indirect drawing, and compute shaders. Among them, the indirect drawing method combined with the compute pipeline to realize GPU driving is becoming an important direction for graphics performance optimization.
[0006] In addition to visualization and performance issues, when using fixed-resolution flow field data for visualization in large-scale three-dimensional scenes, the insufficient accuracy of the flow field data from the microscopic ground perspective can easily lead to unrealistic interactions between streamlines and scene objects, such as streamlines penetrating solid obstacles or scene boundaries. This phenomenon is particularly evident in multi-layered complex scenes. When three-dimensional flow field visualization is combined with digital twin applications, due to the dynamic and changeable characteristics of the digital twin environment, the flow field visualization method is required to flexibly adapt to environmental changes and update and adjust the flow field data in real time. However, fixed-resolution flow field data is difficult to meet this requirement, resulting in the inability of flow field visualization to effectively interact with the digital twin environment in complex scenes. For example, when scene objects or the environment change, the insufficient accuracy of the flow field data may cause the trajectory of the streamlines in the low-precision area to be inconsistent with the real physical behavior, thereby affecting the consistency and accuracy of the visualization effect.
[0007] In summary, three-dimensional flow field visualization has a wide range of applications in scientific computing, engineering applications, and digital twin scenarios. With the development of related technologies and the increase in demand for complex scenarios, the requirements for its real-time, dynamic, and interactive performance are also increasing. The visualization method based on particle tracking has advantages in interactivity and dynamics, but it still faces challenges in rendering efficiency and streamline distribution, especially in large-scale scenarios. In addition, flow field visualization based on fixed-resolution data is difficult to interact with the changing digital twin environment, and it is easy to cause inconsistent visualization effects under the microscopic ground perspective. Therefore, exploring more efficient visualization methods, improving the effect, adaptability, and interactivity of three-dimensional flow field visualization, and combining adaptive analysis of flow field characteristics with real-time user interaction mechanisms will become the key to improving flow field visualization effects. This will provide real-time, accurate, and interactive solutions for three-dimensional flow field visualization in large-scale scenarios and complex applications such as digital twins. Summary of the invention
[0008] The present invention aims to provide an interactive large-scale three-dimensional flow field visualization method based on GPU drive to solve the various problems mentioned in the background technology.
[0009] The specific technical solutions of the present invention are as follows:
[0010] A GPU-driven interactive large-scale three-dimensional flow field visualization method, comprising:
[0011] Import 3D flow field data, create indirect drawing command records and flow field calculation-related buffers on the GPU, and generate signed distance fields for static objects in the scene;
[0012] Calculate and update the flow field particles in each frame. Determine the calculation rate based on the ratio of the longitude and latitude range of the viewing angle to the longitude and latitude range covered by the flow field data, and dispatch the corresponding number of calculation shaders. Calculate the target position of the flow field particles in this frame based on the position and motion vector of the flow field particles in the previous frame.
[0013] The confidence of the target position of the flow field particles in this frame is measured by depth distribution, feature area matching and randomized weights, the distribution of flow field particles is dynamically adjusted according to the confidence, the flow field particle index and the number of instances of indirect drawing commands are recorded, and the flow field particle trajectory is recorded;
[0014] The indirect drawing command submission is driven by the GPU, and the drawing call is made according to the set indirect drawing command buffer, and the streamlines are rendered using streamline trajectories of variable length and transparency overlay;
[0015] Accept user interactive input and adjust visualization parameters to interactively display flow field changes and characteristics in real time.
[0016] The present invention utilizes the new features of the GPU, uses the GPU to directly drive the generation and submission of indirect drawing commands, and combines the calculation shader to achieve efficient update and rendering of flow field particles on the GPU. This optimization enables the system to efficiently calculate a large number of flow field particles in each frame. In contrast, in the traditional rendering pipeline, the CPU needs to be responsible for generating and submitting each drawing command. This process not only increases the burden on the CPU, but also generates a large amount of data transmission between the CPU and the GPU, resulting in performance bottlenecks.
[0017] The present invention writes and sets the parameters of the indirect drawing command in the compute shader, eliminating the CPU's overhead of recording and submitting drawing commands, reducing the number of drawing calls submitted, and significantly improving the efficiency of flow field particle rendering. This optimization strategy is particularly suitable for visualization scenes of large-scale three-dimensional flow fields, and can ensure that smooth visualization effects are maintained in large-scale scenes. Since the aforementioned performance optimization measures significantly improve system efficiency, sufficient computing resources are reserved for subsequent complex calculation steps added to improve visualization effects.
[0018] When using the visualization system built by this method, users can observe the three-dimensional flow field from multiple angles, such as high altitude, ground, inside or outside the flow field, by freely moving the perspective. This free perspective design allows users to gain an in-depth understanding of the internal structure and motion characteristics of the flow field from different observation angles. In addition, the visualization system built using this method supports users to adjust various visualization and calculation parameters in real time through an interactive interface, allowing users to fine-tune the performance of the flow field according to actual needs, and achieve more efficient and accurate visualization analysis.
[0019] Preferably, the imported three-dimensional flow field data is initialized, specifically: importing the three-dimensional flow field data and uploading it to the GPU to become a three-dimensional texture; creating a flow field particle information buffer, a visible particle index buffer, an indirect drawing command buffer and a particle trajectory buffer; generating a signed distance field for static objects in the scene.
[0020] Preferably, when calculating and updating the flow field particles for each frame, the number of flow field particles that need to be calculated for this frame is determined based on the calculation rate and the upper limit of the number of flow field particles, the flow field particles that need to be calculated are evenly divided into thread groups and a corresponding number of compute shaders are dispatched to calculate and update the flow field particles.
[0021] Preferably, different calculation and update strategies are adopted according to the life cycle of the flow field particles: the corresponding flow field particle information is obtained according to the thread identifier, and for the flow field particles marked as destroyed in the previous frame, the flow field particle target position is generated using a random number or low-discrepancy sequence; for other flow field particles, the flow field particle motion vector is calculated using a numerical integration method, and the target position of the flow field particle in this frame is calculated in combination with the position of the previous frame.
[0022] Preferably, when simulation calculation is enabled and the target position of the flow field particles is not regenerated for this frame, a simulated three-dimensional flow field is created around the viewing angle to calculate its velocity vector, and the target position of the flow field particles for this frame is recalculated, specifically including:
[0023] Use the displacement of the current frame of view to reversely offset the flow field data;
[0024] Querying the signed distance field to obtain the distance between the flow field simulation grid position and the surface of the scene object, and identifying the flow field position with a distance less than zero as an internal obstacle;
[0025] The motion vector of the flow field particles is calculated using the numerical integration method and added to the flow field simulation grid of all non-internal obstacles as the source flow of the flow field simulation calculation;
[0026] Perform fluid simulation and solve it using compute shaders to iterate the simulated mesh in parallel;
[0027] The velocities of the grid points marked as internal obstacles are set to zero, and the velocities of the fluid simulation grid points on the obstacle surface are adjusted to be parallel to the obstacle surface;
[0028] According to the distance between the flow field simulation grid position and the surface of the scene object, the simulation and real speeds are linearly mixed to recalculate the target position of the flow field particles in this frame.
[0029] In the process of flow field visualization, this method adds an optional simulation calculation stage for areas with insufficient flow field data accuracy and variable three-dimensional twin scenes, improving the interactivity and visualization consistency between flow field streamlines and scene objects. This simulation calculation stage uses a grid-based fluid simulation method to calculate the velocity vector changes of the flow field to simulate the interactive performance of the flow field and scene objects. This simulation method not only improves the visualization consistency of low-precision areas of flow field data, but also enhances the interactivity of the flow field and real scene objects in the digital twin environment, extending the three-dimensional flow field visualization method to applications that combine virtuality and reality, and improving the scalability of the visualization method.
[0030] Preferably, the confidence of the target position of the flow field particles is calculated through depth distribution, feature area matching and randomized weights, the life cycle of the flow field particles is dynamically adjusted according to the confidence, and the target distribution of the flow field particles is adjusted; for flow field particles whose confidence is greater than the trust threshold set by the user, their index is written to the visible particle buffer in the compute shader, and the indirect drawing command instance count is increased; for particles that do not meet the confidence requirements or are too far away from the viewing cone, they are marked as destroyed, and the remaining particles are reset to alive; the trajectory count is calculated using the modulus of the frame number and the maximum streamline trajectory length, and the flow field particle position is written to the trajectory buffer.
[0031] Preferably, the method for calculating the confidence using the feature item is specifically as follows:
[0032] Depth distribution: The depth of the viewing cone is divided from near to far, and the upper limit of the number of flow field particles in each depth layer is calculated according to the number of flow field particles that need to be calculated in this frame. The upper limit of the flow field particles in the depth layer farther from the viewing angle is lower. The confidence of the depth distribution is calculated according to the proportion of flow field particles exceeding the upper limit of the depth level.
[0033] Feature area matching: Based on one or more flow field features selected by the user, the area of matching features in the flow field is pre-calculated by feature extraction, and the matching confidence of the feature area is calculated according to the distance between the flow field particles and the feature area;
[0034] Randomization weight: Combining the flow field motion characteristics with random numbers, the confidence of the randomization weight is calculated based on the motion vector of the flow field particles and the random number.
[0035] Preferably, the confidence calculated by the three feature items is calculated by weighted mixing to obtain the flow field particle confidence. If it is lower than the confidence threshold, it is marked as destroyed and regenerated in the next frame.
[0036] In order to solve the common problems of streamline stacking and insufficient expression of feature areas in three-dimensional flow field visualization, the present invention evaluates the confidence of flow field particles based on three feature items: depth distribution, feature area matching and randomized weight. It also performs depth analysis on the position of flow field particles in the cone of view, and dynamically adjusts the depth distribution of particles according to the change of viewing angle, thereby avoiding excessive accumulation of streamlines in the same depth layer. This adaptive depth distribution adjustment method can effectively reduce streamline occlusion, so that users can see the flow characteristics of different depth layers more clearly when observing the flow field. By pre-calculating the feature area of the flow field and performing feature matching calculation on the actual position of the flow field particles, the flow field characteristics of the feature area can be highlighted. This strategy not only improves the expression effect of the flow field, but also can enhance the directionality of visualization by highlighting the key areas. The present invention also uses a weight adjustment method based on random numbers or low-difference sequences to moderately randomize the motion parameters of the particles, thereby breaking the monotony of the particle position as a whole, making the streamline distribution more natural and the flow field characteristics richer.
[0037] Preferably, the algorithm for submitting indirect drawing commands driven by the GPU is as follows: the GPU submits drawing calls according to the instance count of the indirect drawing command buffer, and the entire process is driven by the GPU, avoiding the overhead of data transmission from the CPU to the GPU; when rendering, the pixel shader obtains the flow field particle index according to the instance label, and then obtains the particle motion vector and position information according to the flow field particle index for drawing; variable-length streamline trajectory drawing calculates the trajectory index through the frame number, and takes out the corresponding trajectory point from the buffer for drawing.
[0038] The beneficial effects of the present invention are: dynamically adjusting the distribution of flow field particles according to feature items and confidence mechanisms, which can effectively reduce streamline occlusion and stacking, focus on expressing flow field characteristics, and improve the dynamics of streamline motion; through an optional simulation calculation stage, the interaction between streamlines and scene objects in low-precision areas of flow field data is displayed, and the visualization method is extended to applications such as digital twins, thereby improving the scalability of the visualization system; GPU-driven flow field visualization is achieved through an indirect drawing method combined with a computational shader, which can dynamically display flow field characteristics in real time at a high frame rate; users can freely adjust the viewing angle and adjust the visualization parameters in real time, which is convenient for users to observe and analyze three-dimensional flow fields from multiple angles, thereby providing strong technical support for flow field visualization in various applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A flowchart of a GPU-driven interactive large-scale three-dimensional flow field visualization method provided in an embodiment of the present invention.
[0040] Figure 2 A schematic diagram of a large-scale three-dimensional flow field visualization provided by an embodiment of the present invention.
[0041] Figure 3 A schematic diagram of flow field visualization for simulation calculation provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0042] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0043] This embodiment provides a GPU-driven interactive large-scale three-dimensional flow field visualization method, including:
[0044] Import 3D flow field data, create indirect drawing command records and flow field calculation-related buffers on the GPU, and generate signed distance fields for static objects in the scene;
[0045] Calculate and update the flow field particles in each frame. Determine the calculation rate based on the ratio of the longitude and latitude range of the viewing angle to the longitude and latitude range covered by the flow field data, and dispatch the corresponding number of calculation shaders. Calculate the target position of the flow field particles in this frame based on the position and motion vector of the flow field particles in the previous frame.
[0046] The confidence of the target position of the flow field particles in this frame is measured by depth distribution, feature area matching and randomized weights, the distribution of flow field particles is dynamically adjusted according to the confidence, the flow field particle index and the number of instances of indirect drawing commands are recorded, and the flow field particle trajectory is recorded;
[0047] The indirect drawing command submission is driven by the GPU, and the drawing call is made according to the set indirect drawing command buffer, and the streamlines are rendered using streamline trajectories of variable length and transparency overlay;
[0048] Accept user interactive input and adjust visualization parameters to interactively display flow field changes and characteristics in real time.
[0049] The following is combined with Figure 1-3 The specific steps of the GPU-driven interactive large-scale three-dimensional flow field visualization method in this embodiment are described in detail:
[0050] Step S1: Import 3D flow field data, create indirect drawing command records and flow field calculation-related buffers on the GPU, and generate signed distance fields for static objects in the scene.
[0051] In step S1, the three-dimensional flow field data is first initialized. The flow field data can be loaded in formats such as NetCDF (NC) or JSON, and transferred to the GPU three-dimensional texture for subsequent sampling interpolation calculations. The method for creating a signed distance field for static objects in the scene is to first determine the spatial range and resolution of the signed distance field. Usually, the range is the bounding box of the entire scene. Then, it is necessary to traverse the mesh data of all static objects in the scene, extract their triangle or polygon surfaces, and build an acceleration structure (such as BVH or KD-Tree) for these geometries to speed up the distance query from the point to the nearest surface. When generating SDF data, each point is traversed on a three-dimensional grid, and the acceleration structure is used to quickly calculate the distance to the nearest geometric surface. The distance of each grid point determines its sign according to its position (inside or outside the object): positive values outside and negative values inside. Then, these calculation results are stored as a three-dimensional texture to form a complete SDF data structure. In order to optimize the subsequent query process, the SDF data is processed by mipmap to generate multi-level resolution, each layer represents the distance field data of different precision. After the generation is completed, the SDF data is uploaded to the GPU and stored as a three-dimensional texture. The appropriate texture sampling mode (such as linear sampling) is set to ensure smooth distance values in subsequent calculations. After that, multiple GPU buffers such as flow field particle information buffer, visible particle index buffer, indirect drawing command buffer, and streamline trajectory buffer are created. By managing, recording and using buffer data on the GPU, latency is minimized and overall performance is improved.
[0052] Step S2: Calculate and update the flow field particles, determine the calculation rate according to the ratio of the longitude and latitude range of the viewing angle to the longitude and latitude range covered by the flow field data, and dispatch the corresponding number of calculation shaders. For the flow field particles marked as destroyed in the previous frame, use random numbers or low-discrepancy sequences to generate the target position of the flow field particles. For other flow field particles, use the numerical integration method to calculate the flow field particle motion vector, and obtain the target position of the flow field particle in this frame based on the position of the flow field particle in the previous frame and the calculated motion vector.
[0053] Step S2 is the calculation and update process of the flow field particles in each frame. This method dynamically adjusts the number of calculated particles according to the viewing angle information and selects different calculation methods according to the life cycle of the flow field particles to ensure efficient calculation while maintaining the flow field visualization effect and rendering quality. Specifically, it includes:
[0054] Step S21, dynamically calculate the calculation rate of flow field particles according to the current viewing angle information. Specifically, obtain the longitude and latitude range visible from the viewing angle, and calculate its proportion of the longitude and latitude range covered by the entire flow field data as the calculation rate for this frame update. Determine the number of flow field particles that need to be calculated in this frame based on the calculation rate and the upper limit of the number of flow field particles, divide the flow field particles that need to be calculated evenly into thread groups and dispatch a corresponding number of calculation shaders to calculate and update the flow field particles. The lower limit of the number of dispatched calculation shaders is set by a fixed value.
[0055] Step S22: for the flow field particles marked as destroyed in the previous frame, their positions are regenerated in the current frame by means of random numbers or low-discrepancy sequences; for other flow field particles, the motion vector is calculated by using a numerical integration method. The available numerical integration methods include but are not limited to the Euler method, the fourth-order Runge-Kutta method, etc., and a suitable method is selected according to the complexity and accuracy requirements of the flow field. The calculated motion vector is multiplied by the scaling factor and added to the position of the previous frame as the target position of the flow field particle in the current frame.
[0056] Step S3: When simulation calculation is enabled and the target position of the flow field particles is not regenerated for this frame, a simulated three-dimensional flow field is created at the viewing angle for calculation, and the steps include reverse offset, setting internal obstacles, adding source flow, fluid simulation, setting obstacle interaction, smooth transition simulation and real velocity vector. The result of the simulation calculation is used to recalculate the target position of the flow field particles in this frame, replacing the target position calculated in step S2), and participating in the calculation of subsequent steps.
[0057] When simulation calculation is enabled and the target position of the flow field particles is not regenerated for this frame, a simulated three-dimensional flow field is created around the view to calculate its velocity vector. The simulation method is mainly a grid-based stable fluid solution method. This method is suitable for stable fluid solvers for real-time simulation. It ensures the realistic appearance of the fluid while taking into account the computational efficiency. It is very suitable for application scenarios that require real-time interaction, such as computer graphics and game development. The specific steps of the simulation calculation stage of this method include reverse offset, setting internal obstacles, adding source flow, fluid simulation, setting obstacle interaction, smooth transition simulation and real velocity vector, including:
[0058] Step S31, reverse offset, moves the simulated flow field following the viewing angle, and reversely offsets the flow field data using the displacement of the viewing angle in each frame.
[0059] Step S32, set internal obstacles, iterate all simulated flow field grid points in parallel in the GPU's compute shader, query the pre-generated scene object SDF value at each grid point, if the value is less than or equal to 0, it means that the grid point is inside the scene object, and the grid point position is identified as an internal obstacle.
[0060] Step S33, add source flow, iterate all simulated flow field grid points in parallel in the GPU's compute shader, and at each grid point, query whether it is identified as an internal obstacle by step S32. For non-internal obstacle grid points, sample real three-dimensional flow field data and use numerical integration methods to calculate the flow field particle motion vector of the grid point, and multiply the motion vector by the scaling factor to add it as the source flow.
[0061] Step S34, fluid simulation. The fluid simulation method is based on the core equation of fluid mechanics, the Navier-Stokes equation. In order to take into account both visualization and real-time requirements, this method uses a simplified and stabilized solution to ensure a balance between computational efficiency and visual effects. The simulation process mainly includes three steps: diffusion, advection, and projection. Each step is optimized to meet the fluid simulation requirements in real-time application scenarios. This step also includes steps S341, S342, and S343.
[0062] Step S341, the physical meaning of the diffusion step is to simulate the homogenization process of substances (such as heat, concentration or velocity). In fluid simulation, diffusion causes substances in high-concentration areas to gradually spread to low-concentration areas, thus tending to equilibrium. This process reflects the spatial distribution and diffusion of substances and energy caused by molecular motion in nature. It is an important step to ensure that the simulation results are visually and physically closer to the real fluid behavior. The diffusion step is solved using the Gauss-Seidel iteration method, and its calculation method is:
[0063]
[0064] Where u represents the velocity component in the flow field, i, j, k are the three-dimensional grid indices, and a = Δt·diff·N 3 , Δt represents the time step, which is the time interval between each update in the simulation process. It determines the amount of time the fluid advances in each calculation, and usually needs to be set small enough to ensure the stability of the simulation. diff represents the diffusion coefficient, which describes the rate of velocity diffusion in the fluid. It is determined by the physical object of the flow field simulation. N is the resolution of the three-dimensional grid. In this method, in order to balance the simulation effect and computational efficiency, the resolution is set to 128. The numerical iteration method requires setting the number of iterations. This method balances the simulation effect and computational efficiency, and the number of iterations selected is 30.
[0065] Step S342, the advection process represents the material transport of the fluid due to its own velocity field (velocity vector), that is, the material or properties (such as temperature, density) in the fluid changes with the position of the fluid movement during the flow process. The velocity field itself will also be affected by the advection and change. The velocity vector will be updated with the movement position of the fluid, thereby forming a more complex flow pattern. In actual calculations, three-dimensional advection can be achieved by the reverse tracking method. According to the three-dimensional velocity field, the starting position of a grid point in the previous time step is calculated, and then the value of the point is calculated by interpolation. The numerical implementation formula is:
[0066] u[i,j,k]=Interpolate(u prev , ivΔt·v x [i, j, k], j - Δt v y [i, j, k], k - Δt v z [i, j, k])
[0067] Where Δt is the time step, v x , v y , v z They are the components of the velocity field in the x, y, and z directions respectively, Interpolate(u prev , a, b, c) means three-dimensional interpolation of the values at index a, b, c in the previous iteration of u.
[0068] Step S343, the physical significance of the projection step is to ensure that the fluid velocity field remains incompressible, that is, to satisfy the fluid continuity equation so that there is no source or sink inside the fluid. This process simulates the conservation of flow and vortex structure in real fluids by adjusting the velocity field so that it no longer has divergence. This is a key step in achieving physically real fluid behavior and ensuring that the simulation complies with the basic laws of fluid mechanics.
[0069] The numerical calculation method of the projection step is divided into three parts. The first part is to calculate the divergence: where h is the grid spacing. The second part is to solve the pressure field using the Gauss-Seidel method or other iterative solvers: This process requires multiple iterations until convergence. This method balances the simulation effect and computational efficiency, and selects 30 iterations. The third part is to adjust the velocity field and update each component of the velocity field according to the pressure field obtained in the second part.
[0071] Step S35, setting obstacle interaction. In order to simulate the interaction effect between the flow field and the internal obstacles, boundary conditions need to be set: on the grid cells occupied by the obstacles, the velocity is set to zero to ensure that the fluid cannot pass through the obstacles. For the fluid cells on the obstacle surface, their velocity is adjusted to be parallel to the obstacle surface, thereby achieving the effect of the fluid flowing around the obstacle, ensuring that the fluid follows the principle of impenetrability when encountering an obstacle, that is, there is no flow inside the obstacle, and maintaining a certain velocity boundary condition on the obstacle surface, thereby improving the authenticity and accuracy of the simulation.
[0072] Step S36, smoothly transition the simulated and real velocity vectors, and perform linear interpolation between the motion vector obtained by numerical integration of the sampled real flow field data and the motion vector obtained by simulation calculation according to the distance between the simulated flow field grid point and the surface of the scene object as the result. Use the result of simulation calculation to recalculate the target position of the flow field particle in this frame, replace the target position calculated in step S22), and participate in the calculation of subsequent steps.
[0073] Step S4: Measure the confidence of the target position of the flow field particles in this frame through the three feature items of depth distribution, feature area matching and randomization weight, dynamically adjust the flow field particle distribution according to the confidence, record the flow field particle index and the number of instances of the indirect drawing command, and record the flow field particle trajectory.
[0074] In order to ensure the visualization effect of the three-dimensional flow field, the position distribution of the particles should be as close to the characteristic area of the flow field as possible, while avoiding excessive stacking and occlusion of streamlines to avoid affecting the observation of the flow field characteristics. The fluidity of the flow field particles also needs to be ensured. Therefore, the present invention uses three feature items to measure the confidence of the flow field particles. The three feature items are depth distribution, feature area matching and randomization weight, which specifically include:
[0075] Step S41, for the depth distribution item, divide the viewing cone into N depth layers, i is the layer number of the depth layer, d i is the starting point of each depth layer, d beginIt is the starting point of the depth division, which is generally the near plane of the view cone. When the near plane depth value exceeds the maximum height of the flow field data range, the maximum height of the flow field data range is used as the depth starting point. end The end point of the depth division is usually the far plane of the view cone. Similar to the starting point, when the depth of the far plane layer exceeds the minimum height of the flow field data range, the minimum height of the flow field data is used as the end point of the depth division. The number of particles allocated is reduced exponentially from near to far according to the depth layer. The number of particles accommodated in each layer is different. The closer the depth layer to the camera, the more particles it can accommodate. The depth layer far away from the camera has a lower upper limit on the number of particles it can accommodate. The specific allocation method is: P i is the number of particles assigned to the i-th layer, P total It is the total number of particles calculated for the current frame. This value is obtained by multiplying the calculation rate by the upper limit of the number of particles. p is an exponential parameter used to control the distribution of the number of particles. A larger p value makes the particle density of the nearby layers greater.
[0076] The calculation method of the depth distribution confidence obtained according to the frustum stratification and particle number allocation is:
[0077]
[0078] Among them, C i is the confidence of the depth distribution term of flow field particle i, and its value range belongs to [0,1], n i is the number of flow field particles in the depth layer where the particle is located, n max The upper limit of the number of particles in this depth layer is set. After exceeding this number, the confidence begins to decrease. Using the depth distribution item confidence can preferentially distribute particles to the depth layer closer to the viewing angle, improve the visualization details near, and reduce the visualization stacking in the distance.
[0079] Step S42, for the feature region matching item, taking the vortex as an example, firstly, the vortex detection algorithm is used to output the information such as the position, impact size and intensity of the vortex, and the feature region matching confidence calculation method of the flow field particle is: C i is the confidence of the characteristic region matching item of flow field particle i, ranging from 0 to 1, d i is the Euclidean distance between flow field particle i and the nearest vortex center, and σ is the influence range of the vortex. The confidence given by this formula can ensure that the closer the particle is to the vortex, the higher its confidence is; conversely, the farther the distance is, the lower the confidence is, so that the flow field particles are more distributed near the feature area selected by the user, highlighting the characteristics of the flow field.
[0080] Step S43, for the randomized weight item, in order to express the fluidity in the flow field, the present invention introduces a combination of particle motion vector and random weight, and determines the confidence of the flow field particle according to the particle motion vector and the random number. C i is the confidence of the randomized weight term of flow field particle i, |v i | is the modulus of the particle's velocity, v max is the maximum value of the particle velocity in the flow field, r i is the random number of the i-th particle, ranging from [0,1]. Measuring the confidence by the random weight term can ensure the naturalness and dynamics of the particle distribution.
[0081] Step S44, the confidence of depth distribution, feature area matching and randomized weight is mixed and calculated to obtain the final confidence. When mixing multiple confidence items, a linear mixing method can be used. Among them C mix is the mixed confidence, C i is the confidence value corresponding to the i-th feature item, w i is the weight value corresponding to the feature item. Users can set the weights of different feature items. If the mixed confidence is less than the trust threshold set by the user, the particle is marked as destroyed.
[0082] Step S45, process the flow field particles. For the flow field particles that meet the trust threshold set by the user, they are eliminated according to the view cone space information. For the flow field particles that are not near the view cone space, their indexes are written into the visible particle index buffer, and the drawing instance count in the indirect drawing command buffer is increased; each frame writes the flow field particle position before the update into the corresponding position of the trajectory buffer as the basis for the subsequent variable-length streamline trajectory drawing.
[0083] Step S5: submitting indirect drawing commands through the GPU driver, making drawing calls according to the indirect drawing command buffer set in step S2), and rendering streamlines using streamline trajectories of variable length and transparency overlay.
[0084] The present invention uses a GPU-driven indirect rendering method combined with a computing pipeline to efficiently render and update streamline particles. In step S45), the indirect rendering command buffer is written and set by the computing shader, and the total number of flow field particle instances that need to be rendered per frame is recorded in the indirect rendering command buffer. The GPU generates a drawing call based on the content of the buffer and submits it directly to the rendering pipeline, so that the drawing command is controlled and executed by the GPU throughout the process. This strategy eliminates the process of CPU generating and submitting drawing commands in the traditional rendering pipeline, greatly reduces the data transmission requirements from the CPU to the GPU, and thus improves the rendering efficiency of the system. In the rendering stage, the pixel shader takes out the particle index from the index buffer based on the instance index, and then uses the particle index to obtain the motion vector and position information of the flow field particles from the particle information buffer for rendering.
[0085] For the drawing of streamline trajectories of variable length, the present invention adopts a dynamic length calculation method based on the frame number. In each frame, the total number of trajectories is modulo the current frame number to obtain the trajectory index that needs to be recorded. When drawing, the trajectory length is multiplied by the total number of visible flow field particles as the number of instances of the drawing call. The corresponding trajectory count is calculated in the pixel shader according to the instance index, and then the position of the flow field particles recorded in the previous frame update is taken out from the particle trajectory buffer according to the trajectory count and the visible flow field particle index. For long trailing streamlines, the transparency attenuation method is used for rendering, that is, the transparency is multiplied by an attenuation coefficient, and the longer the trajectory, the lower the transparency. This method ensures the flexibility of displaying and adjusting the streamline particle trajectory and avoids redundant calculations in flow field data processing. In addition, in order to further optimize the rendering efficiency in large-scale scenes, the present invention improves performance by executing the calculation process of streamline particles in frames.
[0086] Step S6: accept user interactive input and adjust visualization parameters, interactively display flow field changes and characteristics in real time, and repeat steps S2) to S6) for each frame.
[0087] The present invention supports users to interactively set parameters in real time and adjust flow field calculation and visualization parameters through an interactive interface. The visualization system implemented using this method can receive user input and adjust flow field characteristics in real time. Users can interact with the flow field by setting parameters and observe flow field changes in real time.
[0088] The present invention supports users to freely move the camera and interactively set multiple parameters for controlling flow field calculation and rendering in real time. These parameters will be passed to the calculation shader in real time to update the calculation and rendering logic of flow field visualization. During each frame rendering cycle, the system will adjust the life cycle and motion characteristics of the flow field particles according to the user's perspective information and parameter settings. For example, when calculating the position and trajectory of the flow field particles, it will be dynamically updated according to the flow field characteristics and confidence weights set by the user. If the user adjusts the upper limit of the number of flow field particles, the system will automatically reallocate the thread group for particle calculation and regenerate the flow field particle allocation method that meets the user's settings in the next frame update. For the evaluation of the confidence of flow field particles, the present invention is based on three feature items: depth distribution, feature area matching, and randomization weight. Users can freely set the weights of these features through the interface, select different feature areas, observe the performance effects of particle distribution and feature areas in real time, and make adjustments to ensure that the flow field particles visually meet the user's observation expectations and perspective requirements. At the same time, the present invention supports the real-time activation of the simulation calculation function, by creating a simulated flow field, and performing analog calculations on its velocity vector, to achieve the interactive performance of streamline motion trajectories and objects. Users can turn on or off simulation calculations through the interactive interface, and adjust simulation calculation parameters such as the source flow scaling factor, diffusion coefficient, etc. in real time to simulate more realistic interactions between streamlines and objects. This method significantly enhances the scalability of large-scale three-dimensional flow field visualization and the user's interactive experience in three-dimensional flow field visualization scenes. Simulation calculations can be used to display the interactivity between streamlines and scene objects in low-precision areas of flow field data, ensuring the consistency of the flow field's motion characteristics from macro and micro perspectives.
[0089] Through the above-mentioned specific implementation method, the present invention can efficiently and dynamically perform visualization calculation and rendering of a large-scale three-dimensional flow field, thereby improving the efficiency and visualization effect when visualizing a large-scale three-dimensional flow field. Through the switchable simulation calculation steps, the interaction effect between the flow field and the scene objects is enhanced, and the scalability of the visualization method is enhanced. Users can adjust the visualization parameters of the flow field and view the flow field changes in real time, thereby improving the interactivity of the flow field visualization.
[0090] The above description is only an example of a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A GPU-driven interactive large-scale three-dimensional flow field visualization method, characterized in that: include: Import 3D flow field data, create indirect drawing command records and flow field calculation-related buffers on the GPU, and generate signed distance fields for static objects in the scene; Calculate and update the flow field particles for each frame. Determine the calculation rate based on the ratio of the longitude and latitude range of the viewing angle to the longitude and latitude range covered by the flow field data, and dispatch the corresponding number of calculation shaders. Calculate the target position of the flow field particles in this frame according to the position and motion vector of the flow field particles in the previous frame; The confidence of the target position of the flow field particles in this frame is measured by depth distribution, feature area matching and randomized weights, the distribution of flow field particles is dynamically adjusted according to the confidence, the flow field particle index and the number of instances of indirect drawing commands are recorded, and the flow field particle trajectory is recorded; The indirect drawing command submission is driven by the GPU, and the drawing call is made according to the set indirect drawing command buffer, and the streamlines are rendered using streamline trajectories of variable length and transparency overlay; Accept user interactive input and adjust visualization parameters to interactively display flow field changes and characteristics in real time.
2. The GPU-driven interactive large-scale three-dimensional flow field visualization method according to claim 1, characterized in that: Initialize the imported 3D flow field data, specifically: import the 3D flow field data and upload it to the GPU as a 3D texture; create a flow field particle information buffer, a visible particle index buffer, an indirect drawing command buffer, and a particle trajectory buffer; generate a signed distance field for static objects in the scene.
3. The GPU-driven interactive large-scale three-dimensional flow field visualization method according to claim 1, characterized in that: When calculating and updating the flow field particles for each frame, the number of flow field particles that need to be calculated for this frame is determined based on the calculation rate and the upper limit of the number of flow field particles. The flow field particles that need to be calculated are evenly divided into thread groups and the corresponding number of compute shaders are dispatched to calculate and update the flow field particles.
4. The GPU-driven interactive large-scale three-dimensional flow field visualization method according to claim 3, characterized in that: Different calculation and update strategies are adopted according to the life cycle of flow field particles: Obtain the corresponding flow field particle information according to the thread identifier, and for the flow field particles marked as destroyed in the previous frame, use a random number or a low-discrepancy sequence to generate the flow field particle target position; For other flow field particles, the numerical integration method is used to calculate the flow field particle motion vector, and the target position of the flow field particle in this frame is calculated in combination with the position of the previous frame.
5. The GPU-driven interactive large-scale three-dimensional flow field visualization method according to claim 1, characterized in that: When simulation calculation is enabled and the target position of the flow field particles is not regenerated for this frame, a simulated three-dimensional flow field is created around the view to calculate its velocity vector and recalculate the target position of the flow field particles for this frame, including: Use the displacement of the current frame of view to reversely offset the flow field data; Querying the signed distance field to obtain the distance between the flow field simulation grid position and the surface of the scene object, and identifying the flow field position with a distance less than zero as an internal obstacle; The motion vector of flow field particles is calculated by numerical integration method and added to the flow field simulation grid of all non-internal obstacles as the source flow of flow field simulation calculation; Perform fluid simulation and solve the simulation mesh using parallel iteration of compute shaders; The velocities of the grid points marked as internal obstacles are set to zero, and the velocities of the fluid simulation grid points on the obstacle surface are adjusted to be parallel to the obstacle surface; According to the distance between the flow field simulation grid position and the surface of the scene object, the simulation and real speeds are linearly mixed to recalculate the target position of the flow field particles in this frame.
6. The GPU-driven interactive large-scale three-dimensional flow field visualization method according to claim 1, characterized in that: The confidence of the target position of the flow field particles is calculated through depth distribution, feature area matching and randomized weights. The life cycle of the flow field particles is dynamically adjusted according to the confidence, and the target distribution of the flow field particles is adjusted. For flow field particles whose confidence is greater than the trust threshold set by the user, their index is written to the visible particle buffer in the compute shader, and the indirect drawing command instance count is increased. For particles that do not meet the confidence requirements or are too far away from the view frustum, they are marked as destroyed, and the remaining particles are reset to alive. The trajectory count is calculated using the modulus of the frame number and the maximum streamline trajectory length, and the flow field particle position is written to the trajectory buffer.
7. The GPU-driven interactive large-scale three-dimensional flow field visualization method according to claim 6, characterized in that: The specific method of calculating confidence using feature items is: Depth distribution: The depth of the viewing cone is divided from near to far, and the upper limit of the number of flow field particles in each depth layer is calculated according to the number of flow field particles that need to be calculated in this frame. The upper limit of the flow field particles in the depth layer farther from the viewing angle is lower. The confidence of the depth distribution is calculated according to the proportion of flow field particles exceeding the upper limit of the depth level. Feature area matching: Based on one or more flow field features selected by the user, the area of matching features in the flow field is pre-calculated by feature extraction, and the matching confidence of the feature area is calculated according to the distance between the flow field particles and the feature area; Randomization weight: Combining the flow field motion characteristics with random numbers, the confidence of the randomization weight is calculated based on the motion vector of the flow field particles and the random number.
8. The GPU-driven interactive large-scale three-dimensional flow field visualization method according to claim 7, characterized in that: The confidence calculated by the three feature items is calculated through weighted mixing to obtain the confidence of the flow field particles. If it is lower than the confidence threshold, it is marked as destroyed and regenerated in the next frame.
9. The GPU-driven interactive large-scale three-dimensional flow field visualization method according to claim 1, characterized in that: The specific algorithm for submitting indirect drawing commands driven by the GPU is as follows: The GPU submits drawing calls based on the instance count of the indirect drawing command buffer, and is driven entirely by the GPU, avoiding the overhead of data transmission from the CPU to the GPU; when rendering, the pixel shader obtains the flow field particle index based on the instance label, and then obtains the particle motion vector and position information based on the flow field particle index for drawing; variable-length streamline trajectory drawing calculates the trajectory index through the frame number, and takes out the corresponding trajectory points from the buffer for drawing.
Citation Information
Patent Citations
GPU-based interactive ocean three-dimensional flow field dynamic visual algorithm
CN104867186A
Three-dimensional flow field visualization method based on streamline length accumulation
CN110211207A
Ocean current visualization method based on data structure and trajectory generation strategy of improved particle system
CN118411461A
Cited By
Design method of urban population flow visualization system
CN120198565A
Ocean current forecasting and visualization method based on digital twinning
CN122115768A