A rendering method and device for applying fluid simulation results to virtual reality real-time scenes
By obtaining the wind flow field simulation result files of the building and its surrounding environment, establishing the initial point position model and generating particle trajectory data, the three-dimensional motion performance problem of flow field rendering in virtual reality scenes is solved, and a more realistic wind field rendering effect is achieved.
Patent Information
- Application Number
- CN202510022420.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-01-07
AI Technical Summary
Traditional virtual reality scene rendering solutions cannot truly represent the flow field movement in three-dimensional space, and existing solutions cannot achieve flow field and wind field effects or can only generate two-dimensional random particle animations.
By obtaining the wind flow field simulation result file of the building and its surrounding environment, the initial point position model is established, the velocity of the neighboring points is calculated and particle trajectory data is generated. Rendering software is used to perform particle modeling and coloring to form a continuous wind field rendering animation.
It realizes the true representation of three-dimensional space flow field movement in virtual reality scenes, enhancing the realism and credibility of virtual reality scenes.
Smart Images

Figure CN120032032B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a rendering method and device for applying fluid simulation results to a virtual reality real-time scene. Background Art
[0002] Virtual simulation technology is a computer-based technology that simulates real-world environments. By simulating the physical laws and environments of the real world, it enables users to interact with the virtual environment in a natural way, thus gaining an immersive experience. With its highly realistic simulation effects and powerful interactivity, virtual simulation technology is widely used in military, industrial, medical, educational and other fields. Real-time virtual reality scene rendering is a key aspect of modern graphics programming. It allows for the creation of dynamic and interactive visual experiences in real time. It involves generating computer graphics in response to user interactions or real-world events and presenting them immediately on a display device. It is particularly widely used in video games, 3D animation, virtual reality and augmented reality applications.
[0003] Among traditional scene rendering solutions, some use cloud rendering systems for real-time rendering based on 3D model parameters. This solution cannot achieve the effects of flow and wind fields. In other solutions, although there are effects of expressing flow and wind fields, they randomly generate particles based on two-dimensional areas and drive the particles to move to form trajectory animations, which cannot truly express the flow field movement in three-dimensional space. Summary of the Invention
[0004] In order to solve the above problems, the purpose of the present invention is to provide a method and device for applying fluid simulation results to virtual reality real-time scene rendering.
[0005] The present invention provides a rendering method for applying fluid simulation results to a virtual reality scene, the method comprising:
[0006] Obtaining wind flow field simulation result files of the building and its surrounding environment, and storing the wind flow field simulation result files separately according to time steps;
[0007] Using the stored simulation result file, an initial point position model is established based on the building and the size of the scene to be rendered;
[0008] Traversing each initial point in the initial point position model and searching for a neighboring point corresponding to each initial point;
[0009] Calculate and save the corresponding velocity values based on the velocity results of the neighboring points corresponding to each initial point found, calculate the new position reached by each initial point within the unit time step based on the velocity value, and then generate a new point set;
[0010] Generate position parameters and velocity parameters corresponding to all initial points in all time steps and store them as trajectory data of point sets;
[0011] A random algorithm is used to replicate particle trajectories to form multiple segments of data to form continuous rendering data of the wind field, and generate rendering data files that can be read by scene rendering software;
[0012] The rendered data file is used to perform particle modeling in the rendering software, and after the particles are colored according to the wind speed, the particle motion animation is automatically created according to the time step.
[0013] Optionally, the step of storing the wind flow field simulation result files in a hierarchical manner according to time steps includes:
[0014] Extracting data from the wind flow field simulation result file according to the time step and storing it as an array matrix to form a flow field grid;
[0015] Each node in the flow field grid stores three-dimensional position parameters and flow field velocity values.
[0016] Optionally, establishing an initial point position model based on the building and the size of the scene to be rendered includes:
[0017] Establishing an initial point in the three-dimensional space of the flow field grid;
[0018] According to the given value ranges of the three directions X, Y, and Z and the number of points, the initial point position array matrix is automatically generated as the initial point position model.
[0019] Optionally, searching for neighboring points around each of the initial points includes:
[0020] The KDTree algorithm is used to sort the grid nodes in the flow field grid to form a new matrix as search basic data, so as to search for neighboring points around the initial point based on the search basic data.
[0021] Optionally, generating position parameters and velocity parameters corresponding to all initial points in all time steps and storing them as trajectory data of a set of points includes:
[0022] According to the particle position and velocity values of each initial point at each moment in the continuous time period, the position and velocity data of the initial point at all moments in the continuous time period are stored as particle trajectory data.
[0023] Optionally, the performing of particle modeling in rendering software using the rendered data file, coloring the particles according to wind speed, and then automatically creating a particle motion animation according to time steps includes:
[0024] Inputting the rendering data file into rendering software, the rendering software reads the rendering data file and generates a color transition color spectrum according to the maximum and minimum speed values of all particles and at all times;
[0025] Particles are generated cyclically according to the particle positions at each moment to form animation frames. The color of the particles at the current moment is set according to the current velocity value of the particles to achieve coloring of the particles.
[0026] Automatically animate particle motion over time.
[0027] The present invention also provides a rendering device for applying fluid simulation results to a virtual reality scene, the device comprising one or more processors and a non-temporary computer-readable storage medium storing program instructions. When the one or more processors execute the program instructions, the one or more processors are used to implement the method described in any one of the above items.
[0028] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute any of the above methods.
[0029] This invention provides a rendering device for applying fluid simulation results to virtual reality scenes. The method processes the fluid simulation results from virtual simulation into a particle motion data source that drives wind trajectories in real-time scene rendering. This combines virtual simulation with virtual reality, making the virtual reality scenes more realistic and believable. Furthermore, processing the results generated by three-dimensional virtual simulation into a data source for real-time scene rendering effectively displays physical laws and flow effects consistent with reality.
[0030] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:
[0032] Figure 1 A flow chart of a method for applying fluid simulation results to virtual reality real-time scene rendering according to an embodiment of the present invention;
[0033] Figure 2 Schematic diagram of the KDTree structure of an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The embodiments of the present invention are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to illustrate the present invention and are not intended to limit the present invention.
[0035] The embodiment of the present invention provides a method for applying fluid simulation results to virtual reality real-time scene rendering, such as Figure 1 As shown, the method of the embodiment of the present invention includes steps S1 to S7.
[0036] S1, obtaining wind flow field simulation result files of the building and its surrounding environment, and storing the wind flow field simulation result files separately according to time steps;
[0037] S2, using the stored simulation result file, establishing an initial point position model based on the building and the size of the scene to be rendered;
[0038] S3, traversing each initial point in the initial point position model, and searching for neighboring points around each initial point;
[0039] S4, calculating and saving the corresponding velocity values based on the velocity results of the neighboring points corresponding to each initial point found, calculating the new position reached by each initial point within a unit time step based on the velocity values, and then generating a new point set;
[0040] S5, generating position parameters and velocity parameters corresponding to all initial points in all time steps, and storing them as trajectory data of the point set;
[0041] S6, using a random algorithm to replicate the particle trajectory, forming multiple segments of data as continuous rendering data of the wind field, and generating a rendering data file that can be read by the scene rendering software;
[0042] S7, using the rendered data file to perform particle modeling in rendering software, and after coloring the particles according to wind speed, automatically creating particle motion animation according to time steps.
[0043] The method of the embodiment of the present invention for applying fluid simulation results to a rendering method of a virtual reality scene is to hierarchically store the wind flow field simulation result files of a building and the surrounding environment of the building and establish an initial point position model, calculate the velocity value of the initial point and the new position parameters, generate particle trajectory data, and then generate a rendering data file and render it through rendering software. The method of the embodiment of the present invention processes the fluid simulation results in the virtual simulation into a particle motion data source that drives the representation of wind trajectories in real-time scene rendering, combines virtual simulation with virtual reality, and makes the virtual reality scene more realistic and credible. Each step is described in detail below.
[0044] Step S1: Obtain the wind flow simulation result file of the building and its surrounding environment, and store the wind flow simulation result file separately according to the time step. The file name identifies the time step of the data, and the time step is marked as T0~T n .
[0045] The building in this embodiment can be any building that needs to be rendered, and the simulation result file of the building and its surrounding environment can be a file that has been generated by software. When the wind flow field simulation result file is stored hierarchically according to the time step, the data in the wind flow field simulation result file can be extracted according to the time step and stored as an array matrix to form a flow field grid; each node in the flow field grid stores three-dimensional position parameters and flow field velocity values. In other words, the stored results include the position (x, y, z) of each vertex in the flow field grid model and the flow field velocity value of each node (a vector containing velocity values in the three directions of x, y, and z).
[0046] As an example of storing data in CSV format, assume that the flow field simulation results are wind flow data from 10 seconds to 500 seconds. The stored files are BUILDING_WIND_10.csv to BUILDING_WIND_500.csv. The data format of the file storage is:
[0047] #POINT_ID,X,Y,Z,VX,VY,VZ
[0048] 1,0,0,0,1,0,0
[0049] …
[0050] 10000,500,500,500,10,0,0
[0051] Step S2, using the stored simulation result file, establishes an initial point position model based on the building and the size of the scene to be rendered. The initial point selection is selected according to the starting surface of the flow field grid where the flow field is to be drawn, and the number of initial points can be determined according to the display requirements. For example, the initial point position array matrix can be automatically generated according to the value range and the number of points in the given X, Y, and Z directions in the grid space of the simulation model as the initial point position data. The value range can be the maximum and minimum values of the given X, Y, and Z directions, namely: Xmin, Xmax, Ymin, Ymax, Zmin, Zmax and the data range between the maximum and minimum values. According to the given value range, the X-direction point coordinates, Y-direction point coordinates and Z-direction point coordinates are averaged and combined into an initial point set as the initial point position model.
[0052] Step S3, traverse each initial point in the initial point position model and search for neighboring points around each initial point. That is, loop through the points in the initial point set data and use the KDTree algorithm to search for the neighboring points of the point in the fluid result grid that are smaller than the grid size, i.e., as the neighboring simulation result points. Figure 2 shown.
[0053] In practical applications, the initial particles are cyclically searched for nodes whose distance from the initial particles is less than the flow field grid size. First, a binary tree search is performed (the split dimension values of the query node and the split node are compared. If the value is less than or equal to the split dimension, the node enters the left subtree branch; if the value is equal to the split dimension, the node enters the right subtree branch until the leaf node). The nearest neighbor approximate point can be quickly found along the "search path", that is, the leaf node in the same subspace as the query point. Then the search path is backtracked to determine whether there may be data points closer to the query point in the space of other subnodes of the node on the search path. If possible, it is necessary to jump to the space of other subnodes to search (add other subnodes to the search path). This process is repeated until the search path is empty. The distance between the found point and the reference particle point is calculated. The point distance formula is as follows:
[0054]
[0055] Determine whether the distance is less than the grid size. Part of the program code is as follows:
[0056]
[0057]
[0058]
[0059]
[0060] In step S4, the corresponding velocity values are calculated and saved based on the velocity results of the neighboring points corresponding to each initial point (the velocities of the neighboring simulation result points found are weighted averaged), and then the new positions reached by each initial point within the unit time step are calculated based on the velocity values, thereby generating a new point set.
[0061] Then, by traversing all simulation time steps, the velocity value of the current time step is cyclically searched and calculated, and the position reached by the point in unit time is calculated based on the velocity for use in the next calculation.
[0062] The method for calculating the new position reached by the new point set is as follows: calculate the position of the initial point at time T1 P1 = Δt*V0, where V0 represents the velocity value of the initial point, P1 represents the new position parameter reached by the initial point at time T1, Δt represents the time step, Δt = T1-T0, and T0 represents the moment before time T1.
[0063] Extract the wind speed vector based on the nearest neighbor points found, add and average the vectors, and use it as the velocity value V0 of the current initial point. Calculate Δt = T1 - T0, and calculate the particle's position at time T1, P1 = Δt * V0.
[0064] Step S5, repeating steps S3 to S4 according to the time step for the simulation result generated by S1, generating position parameters and velocity parameters corresponding to the point set in all time steps, and storing the data as trajectory data of the point set.
[0065] Specifically, according to the particle position and velocity values of each initial point at each moment in a continuous time period, the position and velocity data of the initial point at all moments in the continuous time period are stored as particle trajectory data.
[0066] That is, the steps are repeated to calculate the position Pn and velocity Vn of the point set at each moment corresponding to the simulation results, and stored as the position and velocity data of each particle at all moments, forming the trajectory data of each point in the point set.
[0067] In step S6, since the simulation step size is sparse and cannot form a continuous visual effect, a random algorithm is used to copy the particle trajectory to form multiple segments of data to form continuous rendering data of the wind field, and generate a rendering data file that can be read by the scene rendering software.
[0068] Based on the given maximum start time and generation batch, new point set trajectory data is generated according to the random start time based on the data generated in step S5. If the data exceeds the maximum time step, NaN values are padded as the criterion for particle disappearance, and a data file supported by the rendering software is generated. The sample code is as follows:
[0069]
[0070]
[0071]
[0072] Step S7: Use the rendered data file to perform particle modeling in rendering software, color the particles according to the wind speed, and automatically create a particle motion animation according to the time step.
[0073] For the rendering data file that has been generated, the rendering data file is input into the rendering software, and the rendering software reads the rendering data file and generates a color transition color spectrum according to the maximum and minimum speeds of all particles and at all times; the particles are cyclically generated according to the position of the particles at each moment to form animation frames, and the color of the particles at the current moment is set according to the current speed value of the particles to achieve coloring of the particles; and the particle motion animation is automatically created according to the time step.
[0074] The data file is read by the rendering software and a color transition color spectrum is generated according to the maximum and minimum speed values of all particles and all moments. The particles are cyclically generated according to the particle position at each moment to form animation frames. The color of the particle at the current moment is set according to the current speed value of the particle. For example, a transition color spectrum from blue to red can be defined, where blue indicates a lower speed and red indicates a higher speed. The color is evenly transitioned according to the number of color levels through the maximum and minimum speed values. When displayed, the point is given a color according to its speed.
[0075] An embodiment of the present invention also provides a rendering device for applying fluid simulation results to a virtual reality scene. The device includes one or more processors and a non-transitory computer-readable storage medium storing program instructions. When the one or more processors execute the program instructions, the one or more processors are used to implement the rendering method of applying the fluid simulation results to a virtual reality scene of the above embodiment.
[0076] An embodiment of the present invention further provides a computer-readable storage medium for storing program code, wherein the program code is used to execute the rendering method of applying the fluid simulation results of the above embodiment to a virtual reality scene.
[0077] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiment. All technical solutions based on the concept of the present invention are within the scope of protection of the present invention. It should be noted that for those skilled in the art, various improvements and modifications that do not depart from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A rendering method for applying fluid simulation results to a virtual reality scene, characterized in that: The method comprises: Obtaining wind flow field simulation result files of the building and its surrounding environment, and storing the wind flow field simulation result files separately according to time steps; Using the stored simulation result file, an initial point position model is established based on the building and the size of the scene to be rendered; Traversing each initial point in the initial point position model and searching for a neighboring point corresponding to each initial point; Calculate and save the corresponding velocity values based on the velocity results of the neighboring points corresponding to each initial point found, calculate the new position reached by each initial point within the unit time step based on the velocity value, and then generate a new point set; Generate position parameters and velocity parameters corresponding to all initial points in all time steps and store them as trajectory data of point sets; A random algorithm is used to replicate particle trajectories to form multiple segments of data to form continuous rendering data of the wind field, and generate rendering data files that can be read by scene rendering software; The rendered data file is used to perform particle modeling in the rendering software, and after the particles are colored according to the wind speed, the particle motion animation is automatically created according to the time step.
2. The method according to claim 1, characterized in that The step of hierarchically storing the wind flow field simulation result files according to time steps includes: Extracting data from the wind flow field simulation result file according to the time step and storing it as an array matrix to form a flow field grid; Each node in the flow field grid stores three-dimensional position parameters and flow field velocity values.
3. The method according to claim 2, characterized in that The step of establishing an initial point position model based on the building and the size of the scene to be rendered includes: Automatically generate the initial point position array matrix as the initial point position data according to the given value ranges and number of points in the X, Y, and Z directions in the grid space of the simulation model; According to the given value range, the X-direction point coordinates, Y-direction point coordinates and Z-direction point coordinates are generated on average and combined into an initial point set as the initial point position model.
4. The method according to claim 3, characterized in that Finding neighboring points around each of the initial points includes: The points in the initial point set data are looped, and a KDTree algorithm is used to find neighboring points of each initial point in the fluid result grid that are smaller than the grid size.
5. The method according to claim 1, characterized in that Generate position parameters and velocity parameters corresponding to all initial points in all time steps and store them as trajectory data of point sets including: According to the particle position and velocity values of each initial point at each moment in the continuous time period, the position and velocity data of the initial point at all moments in the continuous time period are stored as particle trajectory data.
6. The method according to any one of claims 1 to 5, characterized in that The method of using the rendered data file to perform particle modeling in the rendering software, coloring the particles according to the wind speed, and automatically creating the particle motion animation according to the time step includes: Inputting the rendering data file into rendering software, the rendering software reads the rendering data file and generates a color transition color spectrum according to the maximum and minimum speed values of all particles and at all times; Particles are generated cyclically according to the particle positions at each moment to form animation frames. The color of the particles at the current moment is set according to the current velocity value of the particles to achieve coloring of the particles. Automatically animate particle motion over time.
7. A rendering device for applying fluid simulation results to a virtual reality scene, characterized in that: The apparatus includes one or more processors and a non-transitory computer-readable storage medium storing program instructions. When the one or more processors execute the program instructions, the one or more processors are configured to implement the method according to any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store program code, and when the program code is executed by a processor, it is used to implement the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method for simulating dynamic typhoon scene from image sequence based on deep learning
CN113836833A
Fresh air flow field simulation and dynamic visualization system
CN115630588A