WO2019052313A1 - 一种液体仿真方法、液体交互方法及装置 - Google Patents

一种液体仿真方法、液体交互方法及装置 Download PDF

Info

Publication number
WO2019052313A1
WO2019052313A1 PCT/CN2018/101329 CN2018101329W WO2019052313A1 WO 2019052313 A1 WO2019052313 A1 WO 2019052313A1 CN 2018101329 W CN2018101329 W CN 2018101329W WO 2019052313 A1 WO2019052313 A1 WO 2019052313A1
Authority
WO
WIPO (PCT)
Prior art keywords
liquid
dimensional
cube
grid
simulated
Prior art date
Application number
PCT/CN2018/101329
Other languages
English (en)
French (fr)
Inventor
张天翔
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2019052313A1 publication Critical patent/WO2019052313A1/zh
Priority to US16/601,736 priority Critical patent/US11062513B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/20Finite element generation, e.g. wire-frame surface description, tesselation
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F9/00Games not otherwise provided for
    • A63F9/06Patience; Other games for self-amusement
    • A63F9/08Puzzles provided with elements movable in relation, i.e. movably connected, to each other
    • A63F9/0826Three-dimensional puzzles with slidable or rotatable elements or groups of elements, the main configuration remaining unchanged, e.g. Rubik's cube
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/011Arrangements for interaction with the human body, e.g. for user immersion in virtual reality
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/203D [Three Dimensional] animation
    • G06T13/603D [Three Dimensional] animation of natural phenomena, e.g. rain, snow, water or plants
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/24Fluid dynamics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/56Particle system, point based geometry or rendering

Definitions

  • the invention relates to the field of simulation technology, and in particular to a liquid simulation technology.
  • Liquid simulation can simulate three-dimensional flowing liquid, which is widely used in scenes such as film and television special effects production, computer games, and hydraulic engineering design. Liquids include but are not limited to water bodies.
  • the performance of liquid simulation is mainly measured by the fidelity of liquid simulation results and the computational overhead involved in liquid simulation, especially when liquid simulation is performed in computer game scenarios. High-fidelity and low computational overhead liquid simulation is normal for computer games. Operation is essential.
  • the main method of liquid simulation is particle-based particle method. Specifically, a large number of particles can be used to approximate the liquid, and the liquid is simulated by calculating the motion behavior of the particles.
  • the advantage of using the particle method for liquid simulation is that the calculation speed is relatively fast. And the calculation cost is low, but the disadvantage is that the liquid simulation result is less realistic (the liquid simulation accuracy is lower and the effect is rougher). Therefore, how to reduce the computational cost of liquid simulation in the case of guaranteeing the fidelity of liquid simulation results has been an urgent problem to be solved by those skilled in the art.
  • the embodiments of the present invention provide a liquid simulation method, a liquid interaction method, and a device, which reduce the computational cost of the liquid simulation while ensuring the fidelity of the liquid simulation result.
  • the embodiment of the present invention provides the following technical solutions:
  • an embodiment of the present invention provides a liquid simulation method, which is applied to a graphics processing unit (GPU), and the method includes:
  • the embodiment of the present invention further provides a liquid interaction method, which is applied to a central processing unit (CPU), and the method includes:
  • the model of the interacting body is approximated using a set of cubes comprising a plurality of cubes;
  • Obtaining a corresponding height field of the three-dimensional liquid to be simulated in the two-dimensional grid wherein the height field corresponds to a target grid, and the target grid is a plane of the three-dimensional liquid to be simulated in the two-dimensional grid
  • Correspondingly mapped grids and each grid point of the target grid records a corresponding liquid level height of the three-dimensional liquid to be simulated;
  • the embodiment of the present invention further provides a liquid simulation device, which is applied to a GPU, and includes:
  • An initialization information acquisition module configured to acquire initialization information
  • a two-dimensional grid determining module configured to determine a two-dimensional grid according to the initialization information
  • a plane mapping module configured to map a plane of the three-dimensional liquid to be simulated into the two-dimensional grid, and determine a target grid corresponding to the plane of the three-dimensional liquid to be simulated in the two-dimensional grid;
  • a height mapping module configured to record a liquid level corresponding to a plane coordinate of the three-dimensional liquid to be simulated at each grid point of the target grid, to obtain a corresponding height of the three-dimensional liquid to be simulated in the two-dimensional grid field;
  • the simulation result drawing module is configured to draw a three-dimensional liquid according to the update of the height field, and obtain a liquid simulation result.
  • the embodiment of the present invention further provides a liquid interaction device, which is applied to a CPU, and includes:
  • a model approximation module for approximating a model of the interacting body using a cube group comprising a plurality of cubes;
  • a height field acquisition module configured to acquire a corresponding height field of the three-dimensional liquid to be simulated in the two-dimensional grid, wherein the height field corresponds to a target grid, and the target grid is a plane of the three-dimensional liquid to be simulated Correspondingly mapped grids in the two-dimensional grid, and each grid point of the target grid records a corresponding liquid level height of the three-dimensional liquid to be simulated;
  • a liquid level determining module configured to determine a liquid level corresponding to each cube according to a horizontal position coordinate of each cube and the height field;
  • An interaction force determining module configured to determine an interaction force between the three-dimensional liquid to be simulated and each cube according to a liquid level corresponding to each cube;
  • an integration module configured to combine the interaction force of the three-dimensional liquid to be simulated with each cube to determine an interaction force between the three-dimensional liquid to be simulated and the interaction body.
  • an embodiment of the present invention further provides a liquid simulation device, including: a memory and a GPU;
  • the memory is used to store program code and transmit the program code to the GPU;
  • the GPU is configured to perform the liquid simulation method provided by the above first aspect in accordance with an instruction in the program code.
  • an embodiment of the present invention further provides a liquid interaction device, including: a memory and a CPU;
  • the memory is configured to store program code and transmit the program code to the CPU;
  • the CPU is configured to perform the liquid interaction method provided by the second aspect above according to an instruction in the program code.
  • the embodiment of the present invention further provides a storage medium, where the storage medium is used to store a program code, where the program code is used to execute the liquid simulation method provided by the above first aspect, or the second aspect provides Liquid interaction method.
  • an embodiment of the present invention provides a computer program product comprising instructions, when executed on a computer, causing the computer to perform the liquid simulation method provided by the above first aspect, or the liquid provided by the second aspect Interactive method.
  • the GPU may determine a two-dimensional grid, and map a plane of the three-dimensional liquid to be simulated into the two-dimensional grid to determine the a target mesh corresponding to the plane of the three-dimensional liquid to be simulated in the two-dimensional grid; recording the liquid level corresponding to the plane coordinate of the three-dimensional liquid to be simulated at each grid point of the target mesh, and obtaining the to-be-simulated The corresponding height field of the three-dimensional liquid in the two-dimensional grid; further, the three-dimensional liquid can be drawn according to the update of the height field, and the liquid simulation result is obtained.
  • the liquid simulation method determines the target mesh occupied by the plane of the three-dimensional liquid to be simulated in the two-dimensional grid, and records the corresponding three-dimensional liquid to be simulated in each grid point of the target grid.
  • the liquid level height can simplify the simulation of the three-dimensional liquid to be simulated into a two-dimensional grid, which can greatly reduce the calculation amount and reduce the calculation overhead, thus making real-time flow liquid simulation possible.
  • using the space-based grid realizes liquid simulation (that is, the embodiment of the present invention is a spatial grid-based Euler method, and the improved three-dimensional liquid grid-based three-dimensional liquid simulation method), which can inherit the liquid simulation based on the spatial grid. The effect of higher fidelity, thereby reducing the computational cost of liquid simulation while ensuring the fidelity of liquid simulation results.
  • 1 is a block diagram of a hardware structure of a simulation device
  • FIG. 2 is a flowchart of a liquid simulation method according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a plane mapping of a three-dimensional liquid to be simulated to a two-dimensional grid
  • Figure 4 is a schematic view showing the height of the liquid level recorded by the grid
  • FIG. 5 is a schematic diagram of comparison between a prior art and a liquid simulation scheme of an embodiment of the present invention
  • FIG. 6 is another flowchart of a liquid simulation method according to an embodiment of the present invention.
  • FIG. 7a is a diagram showing an example of a liquid simulation effect according to an embodiment of the present invention.
  • FIG. 7b is another exemplary diagram of a liquid simulation effect according to an embodiment of the present invention.
  • FIG. 7c is still another exemplary diagram of a liquid simulation effect according to an embodiment of the present invention.
  • FIG. 8 is a flowchart of a liquid interaction method according to an embodiment of the present invention.
  • Figure 9 is a flow chart of a method for determining the interaction force of a three-dimensional liquid with each cube
  • Figure 10 is a schematic view showing the force of a three-dimensional liquid to a cube
  • Figure 11 is a schematic view of the force of a cube on a three-dimensional liquid
  • FIG. 12 is a schematic diagram of a comparison of a liquid interaction scheme between the prior art and the embodiment of the present invention.
  • FIG. 13 is a schematic diagram of processing directions of a CPU and a GPU
  • FIG. 14 is a structural block diagram of a liquid simulation apparatus according to an embodiment of the present invention.
  • FIG. 15 is another structural block diagram of a liquid simulation device according to an embodiment of the present invention.
  • FIG. 16 is a structural block diagram of a liquid interaction device according to an embodiment of the present invention.
  • the inventors of the present invention have found a technique for liquid simulation based on the space grid-based Euler method; by dividing the entire simulation space into a space grid, confirming that the three-dimensional liquid to be simulated is in the The grid occupied by the space grid calculates the flow information of the liquid (such as flow rate, pressure, etc.) according to the hydrodynamic equation on each occupied grid, and updates the shape of the liquid (such as the movement of the liquid) The state and shape change), complete the liquid simulation.
  • the flow information of the liquid such as flow rate, pressure, etc.
  • the inventors of the present invention have compared the space-grid-based Euler method and the particle-based particle method, and found that the advantages and disadvantages of the Euler method are opposite to those of the particle method, and the Euler method can well represent the liquid surface (liquid Surface details such as water surface, liquid simulation results have higher fidelity, but the disadvantage is that the calculation cost is large, especially in the case of three-dimensional liquid simulation, only a small range of liquid simulation can be performed. Therefore, for real-time requirements Liquid simulations using the Euler method are not acceptable for scenes such as high games.
  • the inventors of the present invention improved on the basis of the Euler method, proposed a liquid simulation method provided by an embodiment of the present invention, and set a corresponding program, and hoped to retain the Euler method in the case of performing three-dimensional liquid simulation.
  • High-fidelity liquid simulation results while reducing computational overhead, to meet the requirements for real-time performance of the liquid simulation method provided by the embodiments of the present invention, and making the liquid simulation method in a scenario such as a game with high simulation fidelity requirements The same applies.
  • the liquid simulation method provided by the embodiment of the present invention can be represented by a corresponding program, and is jointly operated by a CPU (Central Processing Unit) and a GPU (Graphics Processing Unit) to execute a liquid simulation method in a corresponding program CPU.
  • the liquid simulation method provided by the embodiment of the present invention is implemented by the processes that are in charge of the GPU.
  • the liquid interaction method provided by the embodiment of the present invention can also be represented by a corresponding program, and the CPU and the GPU work together to execute the flow of the CPU and the GPU in the corresponding program of the liquid interaction method, and realize the liquid provided by the embodiment of the present invention. Interactive method.
  • the CPU and the GPU can be set on the emulation device, and the emulation device is a server on the network side.
  • the emulation device does not exclude the possibility of using a terminal device such as a PC (personal computer) or a smart phone on the user side.
  • FIG. 1 shows an optional hardware structure block diagram of the emulation device.
  • the emulation device may include: a CPU 1, a GPU 2, a communication interface 3, a memory 4, and a communication bus 5;
  • the communication interface 2 can be an interface of the communication module
  • the memory 3 may include a high speed RAM (random access memory) memory, and may also include a non-volatile memory, such as at least one disk memory; the memory 3 may store the liquid simulation provided by the embodiment of the present invention. a corresponding program, and a corresponding program for implementing the liquid interaction method provided by the embodiment of the present invention;
  • the CPU 1 and the GPU 2 can work together to implement the liquid simulation method provided by the embodiment of the present invention. Specifically, the CPU 1 and the GPU 2 can execute the respective processes in the liquid simulation method by calling the corresponding program of the liquid simulation method stored in the memory 3 to implement The liquid simulation method provided by the embodiment of the invention.
  • the CPU 1 and the GPU 2 can work together to implement the liquid interaction method provided by the embodiment of the present invention. Specifically, the CPU 1 and the GPU 2 can execute the respective processes in the liquid interaction method by calling the corresponding program of the liquid interaction method stored in the memory 3, The liquid interaction method provided by the embodiment of the invention is implemented.
  • the liquid simulation method provided by the embodiment of the present invention is mainly implemented by the GPU 2, and the GPU 2 can implement three-dimensional liquid simulation based on the initialization information of the CPU 1 and the program executed by the GPU stored in the memory 3; the CPU 1 can be based on the GPU 2
  • the output information is implemented in a program corresponding to the liquid interaction method stored in the memory 3 and executed by the CPU.
  • FIG. 2 is a flowchart of a liquid simulation method provided by an embodiment of the present invention.
  • the liquid simulation method is applicable to a GPU, and is executed by a GPU.
  • the liquid simulation method may include:
  • Step S100 Acquire initialization information.
  • the initialization information may be transmitted to the GPU by the CPU, and the initialization information may include: layout information of the two-dimensional grid corresponding to the liquid simulation, such as a two-dimensional dimension of the two-dimensional grid, a side length of each grid, etc.;
  • layout information of the two-dimensional grid can draw a two-dimensional grid corresponding to the liquid simulation;
  • the initialization information may further include: an initial liquid level corresponding to all grid points in the two-dimensional grid, and other parameters required in the liquid simulation process.
  • Step S110 Determine a two-dimensional grid according to the initialization information.
  • the embodiment of the present invention may draw a two-dimensional grid corresponding to the liquid simulation according to the layout information of the two-dimensional grid recorded in the initialization information; specifically, according to the two-dimensional dimension of the two-dimensional grid, The length of each mesh is used to draw a two-dimensional grid.
  • the determined two-dimensional grid can be regarded as a space grid based European The corresponding two-dimensional grid of Rafa.
  • Step S120 Mapping a plane of the three-dimensional liquid to be simulated into the two-dimensional grid, and determining a target grid corresponding to the plane of the three-dimensional liquid to be simulated in the two-dimensional grid.
  • the liquid simulation method provided by the embodiment of the present invention is mainly used for performing simulation of a three-dimensional liquid.
  • the embodiment of the present invention may Simulating the plane mapping of the three-dimensional liquid into the two-dimensional grid determined in the above step S110, determining the grid occupied by the plane of the three-dimensional liquid to be simulated in the two-dimensional grid, that is, obtaining the plane of the three-dimensional liquid to be simulated a corresponding mapped target mesh in the two-dimensional grid;
  • a plane of the three-dimensional liquid to be simulated is regarded as a bottom surface of the three-dimensional liquid to be simulated, and an embodiment of the present invention may map a bottom surface of the three-dimensional liquid to be simulated into the two-dimensional grid;
  • the embodiment of the present invention can determine the plane coordinate of the bottom surface of the three-dimensional liquid to be simulated, and map the plane of the three-dimensional liquid to be simulated to the area corresponding to the plane coordinate of the bottom surface in the two-dimensional grid according to the plane coordinate of the bottom surface.
  • the grid occupied by the plane of the three-dimensional liquid to be simulated is determined, that is, the target grid corresponding to the plane of the three-dimensional liquid to be simulated is mapped in the two-dimensional grid.
  • the plane shape of the three-dimensional liquid to be simulated is as shown in the curve part of the figure, and after mapping the plane of the three-dimensional liquid to be simulated into the two-dimensional grid, it can be confirmed that the three-dimensional grid is to be simulated by the three-dimensional grid.
  • the mesh occupied by the plane of the liquid is the target mesh, and the number of target meshes is plural.
  • Step S130 Record the liquid level corresponding to the plane coordinate of the three-dimensional liquid to be simulated in each grid point of the target grid, and obtain a corresponding height field of the three-dimensional liquid to be simulated in the two-dimensional grid.
  • the planar two-dimensional coordinates of the three-dimensional liquid to be simulated may be correspondingly recorded as the plane coordinates of the target mesh; Simulating the liquid level height information of the vertical direction of the three-dimensional liquid, in the embodiment of the present invention, the vertical direction corresponding to the plane coordinates of the three-dimensional liquid to be simulated can be recorded on the grid points of the target grid corresponding to the plane coordinates of the three-dimensional liquid to be simulated.
  • the liquid level height for example, the height of the water body, so that each grid point of the target grid can record the liquid level corresponding to the plane coordinate of the correspondingly mapped three-dimensional liquid to be simulated; thereby integrating the plane of the three-dimensional liquid to be simulated in the two-dimensional grid
  • the height field is obtained by the coordinates of the target mesh correspondingly mapped, and the corresponding liquid level of the three-dimensional liquid to be simulated recorded by each grid point of the target mesh.
  • the height field can represent a two-dimensional plane coordinate of the liquid to be simulated as a function of the liquid level.
  • the embodiment of the present invention can record the liquid level corresponding to the plane coordinate of the three-dimensional liquid to be simulated corresponding to each grid point in each grid point of the target grid, thereby realizing the three-dimensional liquid to be simulated.
  • the liquid level is mapped into the two-dimensional grid, and the liquid level of the three-dimensional liquid to be simulated is recorded at each grid point of the target grid;
  • the embodiment of the present invention can determine the plane coordinates of the three-dimensional liquid to be simulated corresponding to each grid point of the target mesh, and record the three-dimensional liquid to be simulated correspondingly at each grid point.
  • the plane height corresponding to the liquid level as shown in the black point portion of the corresponding liquid level; correspondingly, the height field can be considered as a plane grid, the value of each grid point in the grid represents the point height.
  • the liquid simulation method determines the target mesh occupied by the plane of the three-dimensional liquid to be simulated in the two-dimensional grid, and records corresponding to be simulated in each grid point of the target grid.
  • the liquid level of the three-dimensional liquid simplifies the simulation of the three-dimensional liquid to be simulated into a two-dimensional grid, which can greatly reduce the calculation amount and reduce the calculation overhead, thereby making liquid simulation of real-time flow possible.
  • the left part of Figure 5 is a three-dimensional liquid simulation based on the traditional space-based Euler method.
  • the traditional space-based Euler method needs to construct a three-dimensional space grid.
  • the corresponding form of the liquid, the calculation cost is extremely large;
  • the right part of FIG. 5 is a liquid simulation based on the liquid simulation method provided by the present invention, and the simulation of the three-dimensional liquid to be simulated is simplified into a two-dimensional grid, and preferably in the target grid.
  • Each grid point records the corresponding liquid level of the three-dimensional liquid to be simulated, which can greatly reduce the calculation overhead.
  • Step S140 Draw a three-dimensional liquid according to the update of the height field, and obtain a liquid simulation result.
  • the height field can be regarded as an initial height field.
  • the height field can be continuously updated to draw a three-dimensional liquid according to the update result of the height field. The liquid simulation results were obtained.
  • the GPU may determine a two-dimensional grid, and map a plane of the three-dimensional liquid to be simulated into the two-dimensional grid to determine the three-dimensional liquid to be simulated.
  • a target mesh correspondingly mapped in the two-dimensional grid; recording corresponding liquid level heights of the three-dimensional liquid to be simulated at each grid point of the target mesh, obtaining the three-dimensional liquid to be simulated in the two-dimensional network Corresponding height field in the grid; according to the update of the height field, a three-dimensional liquid is drawn to obtain a liquid simulation result.
  • the liquid simulation method determines the target mesh occupied by the plane of the three-dimensional liquid to be simulated in the two-dimensional grid, and records the corresponding three-dimensional liquid to be simulated in each grid point of the target mesh.
  • the liquid level can simplify the simulation of the three-dimensional liquid to be simulated into a two-dimensional grid, which can greatly reduce the amount of calculation and reduce the computational overhead, thus making liquid simulation of real-time flow possible.
  • using space-based network The liquid mode is realized by the method of grid (that is, the embodiment of the present invention is an Eulerian method based on a space grid, and the improved three-dimensional liquid simulation method based on a two-dimensional space grid) can inherit the liquid simulation based on the space grid. The effect of higher fidelity, thereby reducing the computational overhead of liquid simulation while ensuring the fidelity of liquid simulation results.
  • the embodiment of the present invention may update the height field every set number of frames, and further may draw the updated height field according to the set number of frames. Three-dimensional liquid, the liquid simulation results are obtained.
  • the height field determined by the flow of step S100 to step S130 can be regarded as the initial height field of the three-dimensional liquid to be simulated, and in the case of three-dimensional liquid flow or interaction with the interaction body, the flow velocity of the three-dimensional liquid will change, resulting in a height.
  • the field also changes accordingly; therefore, after the initial height field is determined through steps S100 to S130, the updated height field is set every few frames according to the flow of the three-dimensional liquid or the interaction with the interacting body.
  • step S100 to step S130 can be performed once, and then the height field can be updated every set number of frames, so that the three-dimensional liquid can be performed according to the updated height field every set number of frames.
  • the set number frame may be one frame, that is, the height field is updated according to the flow of the three-dimensional liquid or the interaction with the interaction body in each frame; the set number of frames may also be larger than The number of frames can be set according to the actual situation.
  • the embodiment of the present invention may draw a three-dimensional liquid according to the updated height field, combined with the tessellation and vertex offset techniques, every set number of frames;
  • the embodiment of the present invention may correspond to the preset Mesh of the three-dimensional liquid to be simulated (
  • a three-dimensional mesh model, Mesh can be considered as a three-dimensional mesh model of an object, divided into a grid of multiple triangles; and the height of each vertex of each triangle can be updated according to the height field updated every set number of frames.
  • the Mesh (three-dimensional mesh model, Mesh can be regarded as a three-dimensional mesh model of the object) to be simulated by the three-dimensional liquid is only a simple quadrilateral, and the embodiment of the present invention can further improve the fidelity effect of the liquid simulation.
  • the Mesh corresponding to the three-dimensional liquid to be simulated is dynamically divided into a mesh composed of a plurality of triangles by using a tessellation technique.
  • the embodiment of the present invention can use the tessellation technology provided by DirectX to simulate the three-dimensional liquid to be simulated.
  • Mesh performs tessellation;
  • the liquid level corresponding to each vertex of each divided triangle is determined, thereby setting the height of each vertex of each triangle Adding to the corresponding liquid level height, performing vertex offset, and obtaining the vertex position after each vertex of each triangle is offset; thus, according to the vertex position after each vertex offset of each triangle, every predetermined number of frames is drawn. Three-dimensional liquid, the liquid simulation results are obtained.
  • the update calculation of the flow information (such as flow rate and pressure) of the three-dimensional liquid to be simulated can be performed by the GPU based on the hydrodynamic equation in a two-dimensional space, and the flow field is updated according to the fluid mechanics equation, so that based on the updated flow field, Updating the liquid level corresponding to the three-dimensional liquid to be simulated recorded in each grid point of the target grid by using the SWE formula (ie, updating the height field);
  • the liquid level value recorded on each grid point of the target grid is updated based on the calculated flow information of the three-dimensional liquid to be simulated, so that The three-dimensional liquid can be reduced according to the liquid level height value of all grid points, and the back projection of the two-dimensional grid to the three-dimensional liquid is completed, and the flow effect simulation of the three-dimensional liquid is realized.
  • the update of the flow information (such as flow rate, pressure) of the three-dimensional liquid to be simulated may also be based on the interaction force of the interaction body on the three-dimensional liquid. Realization; optionally, in addition to considering the flow information update of the three-dimensional liquid to be simulated based on the fluid mechanics equation, the interaction force of the interaction body on the three-dimensional liquid may be considered, the flow information of the three-dimensional liquid to be simulated is updated, and the height field is updated.
  • each grid point of the target grid may also record: flow information such as flow velocity and pressure between the grid point and surrounding neighboring grid points; target grid Flow information such as flow velocity and pressure recorded between each grid point and adjacent grid points may form a corresponding velocity field in the two-dimensional grid of the three-dimensional liquid to be simulated;
  • the liquid level information recorded in each grid point of the target grid can form a height field
  • the flow information such as the flow rate and pressure recorded in each grid point of the target grid can form a velocity field
  • the height field may be updated every set number of frames: the flow field may be updated every set number of frames; and the height field is updated according to the updated flow field every set number of frames.
  • the update of the velocity field can be performed according to the fluid mechanics equation; in the case where the interaction body interacts with the liquid, the flow field can be updated by combining the interaction between the interaction body and the three-dimensional liquid.
  • the GPU performs three-dimensional liquid rendering through the real-time updated height field of each frame, and the liquid flow simulation effect can be obtained.
  • the two-dimensional grid determined according to the initialization information the higher the approximation degree of the liquid simulation result and the actual liquid to be simulated, but the calculation overhead will also be correspondingly improved, so the two-dimensional grid can be selected.
  • the GPU can perform liquid simulation processing using a Compute Shader (parallel computer) parallel computing system; with the help of the Compute Shader, the GPU can be utilized as a parallel processor, and the GPU will not only utilize With 3D rendering capabilities, it also has other computing power; optionally, the GPU can use the updated height field of Compute Shade every few frames to further reduce the computational overhead involved in liquid simulation.
  • Compute Shader parallel computer
  • the GPU may preferably use the method flow shown in FIG. 6 when performing liquid simulation.
  • FIG. 6 is another flowchart of the liquid simulation method provided by the embodiment of the present invention, and the liquid simulation method may be applied to the GPU.
  • the GPU is responsible for execution.
  • the liquid simulation method may include:
  • Step S200 Acquire initialization information.
  • Step S210 Determine a two-dimensional grid according to the initialization information.
  • Step S220 Mapping a plane of the three-dimensional liquid to be simulated into the two-dimensional grid, and determining a target grid of the plane of the three-dimensional liquid to be simulated correspondingly mapped in the two-dimensional grid.
  • Step S230 Recording, at each grid point of the target grid, the liquid level corresponding to the plane coordinate of the three-dimensional liquid to be simulated corresponding to the lattice point, and obtaining a corresponding height field of the three-dimensional liquid to be simulated in the two-dimensional grid.
  • step S230 can be considered as a preferred implementation of step S130 shown in FIG. 2.
  • Step S240 updating the height field every set number of frames.
  • the embodiment of the present invention may update the flow rate field every set number of frames, and then update the height field according to the updated flow rate field every set number of frames;
  • the update of the velocity field can be implemented according to a fluid mechanics equation; when there is an interaction body and a liquid, the interaction between the interaction body and the three-dimensional liquid can be combined to update the velocity field; and the interaction between the interaction interacting body and the three-dimensional liquid
  • the content of the updated flow field will be described in the content section of the liquid interaction method below.
  • Step S250 The Mesh preset by the three-dimensional liquid to be simulated is dynamically divided into a grid stitched by a plurality of triangles by using a tessellation technique.
  • Step S260 Determine the liquid level corresponding to each vertex of each divided triangle according to the corresponding liquid level height of the three-dimensional liquid to be simulated recorded according to the updated height field, and set the height of each vertex of each triangle. Adding to the corresponding liquid level height, the vertex positions after the vertices of each triangle are offset are obtained.
  • Step S270 Draw a three-dimensional liquid according to the position of the vertex after each vertex offset of each triangle, and obtain a liquid simulation result.
  • step S240 to step S270 may be considered as an optional implementation of step S140 shown in FIG. 2.
  • the implementation of the present invention does not exclude other ways of drawing a three-dimensional liquid according to a height field updated every set number of frames, such as
  • the initial three-dimensional liquid is first drawn according to the updated height field every set number of frames, and the liquid level of the initial three-dimensional liquid corresponds to the liquid level corresponding to the three-dimensional liquid to be simulated recorded in each grid point of the target grid in the height field.
  • the liquid level of each vertex in the initial three-dimensional liquid is adjusted according to the height of each vertex of each triangle subdivided by the three-dimensional liquid preset to be simulated, and a three-dimensional liquid is drawn.
  • the embodiment of the present invention can also realize interaction between the interaction body and the liquid, such as a solid interacting with the liquid, an item for the user to operate the liquid, etc., so that the user can calculate based on high fidelity and calculation.
  • the low-cost liquid simulation results to achieve a realistic interactive experience; taking liquid as the water body as an example, Figures 7a and 7b show the water body simulation effect of the pool and the user's interaction, the user can draw waves or even stir on the water surface. The water in the whole pool, the white cube floating on the water surface will fluctuate with the waves up and down and float back and forth. It can be seen that the water surface simulation based on the embodiment of the present invention has a delicate and realistic water surface effect;
  • FIG. 7c shows a liquid simulation method provided by the embodiment of the present invention. It can be seen that the water body simulation effect realized by the embodiment of the present invention is very real, and the real water surface effect can enhance the user's immersion. ;
  • the water body simulation of the embodiment of the present invention only takes about 0.5 ms in the CPU and GPU end, compared with the high realistic water surface effect.
  • the calculation time overhead of the embodiment of the present invention is extremely low.
  • an interaction force between the three-dimensional liquid and the interaction body for example, a force of the three-dimensional liquid on the interaction body, and a force of the interaction body on the three-dimensional liquid
  • the calculation of the interaction force between the three-dimensional liquid and the interaction body can be performed by the CPU to reduce the computational overhead of the GPU, and the GPU can perform the liquid interaction effect display based on the interaction force of the three-dimensional liquid and the interaction body calculated by the CPU;
  • FIG. 8 is a flowchart of a liquid interaction method provided by an embodiment of the present invention.
  • the liquid interaction method mainly introduces a calculation process of an interaction force between a three-dimensional liquid and an interaction body, and the liquid interaction method can be applied to a CPU. Executed by the CPU; referring to FIG. 8, the method may include:
  • Step S300 approximating the model of the interaction body using a cube group including a plurality of cubes.
  • the first problem to be solved is to abstract the interaction body into a form.
  • the traditional liquid interaction mode mainly uses the surface Mesh of the interaction body to represent the interaction body. Therefore, the interaction force between the interaction body and the three-dimensional liquid is calculated for each triangle on the surface Mesh of the interaction body to determine the interaction force between the three-dimensional liquid and the interaction body; however, the surface Mesh of the interaction body is used to represent the interaction.
  • the way of the body involves a lot of computational overhead, and is not suitable for scenarios such as computer games that require high real-time performance;
  • the embodiment of the present invention proposes an improvement scheme, which uses a set of cubes (the cube group can include multiple cubes) to approximate the interaction body, thereby avoiding the traditional way to represent the interaction body by using the surface Mesh of the interaction body, for the interaction body.
  • the cube group can include multiple cubes
  • Each triangle on the surface Mesh is calculated, and the calculation of the interaction between the interacting body and the three-dimensional liquid requires a lot of computational overhead.
  • the method for approximating the interaction body using the cube group may be: dividing the space around the model of the interaction body into a three-dimensional mesh.
  • the length, width, and height of the three-dimensional mesh should be able to accommodate the interaction. For each grid point in the three-dimensional grid, determine whether the position of the grid point is inside the model of the interaction body, and if so, generate a cube corresponding to the grid point at the grid point, and if not, ignore the Grid points; each grid point inside the model of the interaction body can be determined in the three-dimensional grid, and a cube group similar to the model of the interaction body is generated according to the cube corresponding to each grid point inside the model of the interaction body.
  • the embodiment of the present invention can determine all the cubes included in the interaction body, and the side length of each cube and the relative position of the cube in the interaction body.
  • the CPU may transmit the information of the cube group for approximating the interaction body to the GPU, so that the GPU displays the interaction body in the liquid simulation result, and the information of the cube group may include: The length of each cube, the relative position of each cube relative to the model of the interacting body, and so on.
  • Step S310 acquiring a corresponding height field in the two-dimensional grid of the three-dimensional liquid to be simulated, wherein the height field corresponds to a target mesh, and the target mesh is a plane of the three-dimensional liquid to be simulated in the two-dimensional Correspondingly mapped grids in the grid, and each grid point of the target grid records the corresponding liquid level height of the three-dimensional liquid to be simulated.
  • each grid point of the target grid may be recorded, and the liquid level corresponding to the plane coordinate of the three-dimensional liquid to be simulated corresponding to each grid point.
  • the height field may be determined by the GPU according to the liquid simulation method provided above, and the GPU may feed back to the CPU after determining the height field, so that the CPU performs the interaction calculation of the three-dimensional liquid and the interaction body.
  • Step S320 determining the liquid level corresponding to each cube according to the horizontal position coordinates of each cube and the height field.
  • the height field may represent a two-dimensional plane coordinate of the liquid to be simulated as a function of the liquid level height, and the spatial position coordinates at which the cubes are located are known by the level in the spatial position coordinates of each cube.
  • the position coordinates are substituted into the functional relationship represented by the height field, the liquid level height corresponding to the horizontal position coordinates of each cube can be obtained, and the liquid level corresponding to each cube is obtained;
  • the functional relationship represented by the height field is f(x, y) ⁇ z, that is, the corresponding liquid level can be determined by the horizontal coordinate x, y; assuming that the spatial position coordinate of a cube is (x, y, z), By substituting the horizontal position coordinates x, y in the spatial position coordinates of the cube into a function relationship of f(x, y) ⁇ z, the liquid level corresponding to the cube can be obtained.
  • Step S330 determining an interaction force between the three-dimensional liquid to be simulated and each cube according to a liquid level corresponding to each cube.
  • Step S340 synthesizing the interaction force of the three-dimensional liquid to be simulated and each cube, and determining the interaction force between the three-dimensional liquid to be simulated and the interaction body.
  • the central space coordinate of the cube is p
  • the relative position of p on the model of the interaction body of the cube may be directly determined.
  • the interaction of three-dimensional liquids; the process of determining interaction forces at specified points provides a functional interface in the general physics engine, which can be called directly here.
  • Combining the interaction force of the three-dimensional liquid with each cube means that after performing all the operations on all the cubes, the interaction force of the model of the interaction body with the three-dimensional liquid at different positions can be obtained, thereby To determine the liquid interaction effect;
  • the embodiment of the present invention can determine the interaction between the model of the interaction body and the central space coordinates of each cube according to the interaction force of the three-dimensional liquid corresponding to the central space coordinates of each cube, and the corresponding interaction force with the three-dimensional liquid, Obtaining the interaction force between the three-dimensional liquid and the interacting body;
  • the embodiment of the present invention can determine the corresponding three-dimensional liquid force of the central space coordinate of each cube, thereby corresponding to the central space coordinate of each cube on the model of the interaction body, The corresponding three-dimensional liquid force is determined, and a set of three-dimensional liquid forces at different positions of the model of the interaction body is obtained, that is, the force of the three-dimensional liquid on the interaction body is obtained.
  • the principle of determining the force of an interacting body on a three-dimensional liquid is similar.
  • the CPU may further determine the interaction result of the three-dimensional liquid and the interaction body according to the interaction force between the three-dimensional liquid and the interaction body, and transmit the result to the GPU, which is The interaction between the three-dimensional liquid and the interacting body affects the result, and shows the interaction result of the three-dimensional liquid and the interacting body;
  • the CPU may further determine the influence result of the interaction body under the action of the three-dimensional liquid, and transmit the result to the GPU, and the GPU displays the interaction result of the three-dimensional liquid to the interaction body.
  • the GPU can update the velocity field to further update the height field and update the simulation result of the three-dimensional liquid.
  • the embodiment of the present invention can determine the depth of each cube immersed in the three-dimensional liquid, thereby determining the interaction force between the three-dimensional liquid and each cube according to the depth of each cube immersed in the three-dimensional liquid.
  • FIG. 9 is a flowchart of a method for determining the interaction force between a three-dimensional liquid and each cube according to an embodiment of the present invention.
  • the method is applicable to a CPU. Referring to FIG. 9, the method may include:
  • Step S400 determining the depth of each cube immersed in the three-dimensional liquid according to the vertical height coordinates of each cube and the corresponding liquid level.
  • the embodiment of the present invention can determine the height of the lower bottom surface of each cube according to the vertical height coordinates of each cube and the height of each cube; thereby subtracting the height of the liquid surface corresponding to each cube from the height of the lower bottom surface, Each cube is immersed in the depth of the three-dimensional liquid.
  • Step S410 Determine the interaction force between the three-dimensional liquid and each cube according to the depth of each cube immersed in the three-dimensional liquid.
  • the volume of each cube immersed in the three-dimensional liquid is determined according to the depth of each cube immersed in the three-dimensional liquid, thereby determining the three-dimensional liquid according to the volume of each cube immersed in the three-dimensional liquid, the speed of each cube, and the velocity of the three-dimensional liquid.
  • the interaction force of each cube is determined according to the depth of each cube immersed in the three-dimensional liquid, thereby determining the three-dimensional liquid according to the volume of each cube immersed in the three-dimensional liquid, the speed of each cube, and the velocity of the three-dimensional liquid.
  • the interaction force between the three-dimensional liquid and each cube can be represented by the force of the three-dimensional liquid on each cube, and the force of each cube on the three-dimensional liquid;
  • the force of the three-dimensional liquid to the cube can be expressed by the buoyancy and resistance of the three-dimensional liquid to the cube.
  • the volume of the cube immersed in the three-dimensional liquid can be determined according to the depth of the cube immersed in the three-dimensional liquid, and then the three-dimensional liquid is immersed according to the cube.
  • volume, cube velocity, three-dimensional liquid velocity calculate the buoyancy and resistance of the three-dimensional liquid to the cube, and obtain the force of the three-dimensional liquid to the cube; as shown in Figure 10, the box shown in Figure 10 represents the cube, the wavy graphical representation A three-dimensional liquid, an area separated by a virtual arrow corresponds to a grid point, and the arrow indicates the force of the three-dimensional liquid on the cube.
  • the volume of the cube immersed in the three-dimensional liquid can be determined according to the depth of the cube immersed in the three-dimensional liquid, and then the volume of the cube relative to the three-dimensional liquid according to the volume of the cube immersed in the three-dimensional liquid, Calculate the force of the cube on the three-dimensional liquid; optionally, the relative velocity of each cube to the three-dimensional liquid can be determined by the velocity of the three-dimensional liquid and the velocity of the cube, wherein the velocity of the three-dimensional liquid can be determined by the velocity field transmitted by the GPU (correspondingly, The CPU may also acquire a velocity field of the GPU transmission, where the velocity field corresponds to a target grid, and the target grid is a grid correspondingly mapped to the plane of the three-dimensional liquid to be simulated in the two-dimensional grid, and each The grid of the target grid has a relative flow rate with the adjacent grid points, and the speed of the cube is calculated by the physics
  • the box represents a cube, and an area separated by a virtual arrow corresponds to a grid point, and the cube occupies two grid points, according to the respective immersion depths of the cubes on the two grid points, and relative
  • the force of the cube on the three-dimensional liquid is calculated, and the force of the cube on the three-dimensional liquid is as shown by the arrow in FIG.
  • the embodiment of the present invention can be used to represent the interaction body with respect to the surface Mesh using the interaction body, thereby calculating the interaction force with the three-dimensional liquid for each triangle on the surface Mesh of the interaction body.
  • the model of the interacting body samples the cube to determine the interaction force with the three-dimensional liquid by the subdivided cube, and the embodiment of the present invention can be extremely large with respect to the calculation of the interaction force with the three-dimensional liquid by the surface Mesh as a whole. Reduce the computational overhead.
  • the force of the cube on the three-dimensional liquid will affect the motion state of the three-dimensional liquid. Therefore, in the embodiment of the present invention, the relative speed of each cube and the three-dimensional liquid in the process of calculating the interaction force between the cube and the three-dimensional liquid can be calculated by the CPU.
  • the depth of each cube immersed in the three-dimensional liquid is transmitted to the GPU.
  • the GPU updates the velocity field according to the relative velocity of each cube and the three-dimensional liquid, and the depth of each cube immersed in the three-dimensional liquid, that is, the grid of the target grid corresponding to each cube. Update the relative flow rate recorded on the point;
  • the corresponding liquid level can be recorded on the grid points of each target grid corresponding to the height field, and the relative flow rate of the adjacent grid points can be recorded on the grid points of each target grid corresponding to the velocity field;
  • the GPU is based on CPU transmission, determines the relative velocity of each cube sampled by the model of the interacting body and the three-dimensional liquid, and after the cube is immersed in the depth of the three-dimensional liquid, for each cube, the GPU can multiply the relative velocity of the cube and the three-dimensional liquid by Definite coefficient, the multiplication result is added to the relative flow rate recorded on the grid point of the target grid corresponding to the cube in the velocity field, and the addition result is recorded on the grid point of the target grid corresponding to the cube, thereby updating the flow rate The relative flow rate recorded on the grid points of the target grid corresponding to the cube in the field; wherein the set factor is related to the depth at which the cube is immersed in the three-dimensional liquid.
  • the GPU may update the height field according to the relative flow rate of the updated record of the grid points of the target meshes in the updated flow field, that is, update the level of the liquid level corresponding to the recorded points of the target grid in the height field;
  • the relative flow rate recorded on the grid of the updated target grid is included in the SWE (Shallow Water Equation) formula, and the liquid level of each grid point of the target grid is calculated to determine the interaction body to the three-dimensional The influence of the state of motion of the liquid;
  • the core formula of SWE indicates the mutual influence of the liquid level and the flow rate, that is, the change of the liquid level is affected by the flow rate, and the change of the flow rate is affected by the liquid level height value. For example, if the relative flow velocity of a grid point and an adjacent grid point flows out from this grid point, the greater the outflow velocity, the faster the liquid level of the grid point will fall. The outflow velocity is related to the height difference between the grid point and the surrounding grid points.
  • the rate of change of height is inversely related to the recorded outflow velocity of the relative flow velocity of the adjacent lattice point, the outflow velocity of a grid point recorded in response to the relative flow velocity of the adjacent grid point, and the grid point record
  • the height difference between the liquid level and the liquid level recorded by the adjacent grid points is positively correlated.
  • the GPU can perform a liquid simulation update based on the updated height field to update the liquid simulation results.
  • the GPU updates the velocity field and the height field, and the process of determining the liquid simulation results can be performed by parallel processing provided by the Compute Shader.
  • the liquid simulation method provided by the embodiment of the present invention described above is mainly implemented by a GPU, and the interaction force calculation between the interaction body and the three-dimensional liquid involved in the liquid interaction method is implemented by the CPU;
  • the liquid simulation method and the liquid interaction method provided by the embodiments of the present invention involve CPU and GPU processing directions.
  • the CPU may transmit initialization information, information for approximating the cube group of the interaction body to the GPU.
  • the GPU can update the height field and the flow field through the Compute Shader and transmit it to the CPU.
  • the CPU performs the liquid interaction method provided by the embodiment of the present invention based on the height field and the velocity field and the model of the interaction body, and performs the interaction body and the three-dimensional liquid. Interaction force calculation; at the same time, the GPU can perform Pixe Shader rendering rendering based on the updated height field, obtain liquid simulation results, and render the interaction body in the liquid simulation result.
  • the liquid simulation method provided by the embodiment of the invention can be parallel processed by the GPU using the Compute Shader, and the simulation of the three-dimensional liquid to be simulated is simplified into a two-dimensional grid, which greatly reduces the calculation amount and reduces the calculation overhead, thereby real-time flowing.
  • Liquid simulation is possible; at the same time, the use of spatial grid-based liquid simulation can inherit the high fidelity effect of liquid simulation based on spatial grid, thus reducing the fidelity of liquid simulation results.
  • the computational overhead of liquid simulation can be parallel processed by the GPU using the Compute Shader, and the simulation of the three-dimensional liquid to be simulated is simplified into a two-dimensional grid, which greatly reduces the calculation amount and reduces the calculation overhead, thereby real-time flowing.
  • the liquid interaction method provided by the embodiment of the present invention can be used by the CPU to calculate the interaction force of the three-dimensional liquid and the interaction body based on the height field, and the three-dimensional liquid can be reduced during the liquid interaction method.
  • the computational overhead of the interaction force with the interacting body; and the GPU can update the velocity field based on the relative velocity of the cube and the three-dimensional liquid, and the depth of the cube immersed in the three-dimensional liquid, thereby updating the height field through the SWE formula with the updated velocity field, thereby
  • the GPU is able to update liquid simulation results in real time based on real-time updated height fields.
  • the liquid simulation device provided by the embodiment of the present invention is described below.
  • the liquid simulation device described below can be considered as a program module required for the GPU to implement the liquid simulation method provided by the embodiment of the present invention.
  • the liquid simulation device described below can be referred to each other in correspondence with the liquid simulation method described above.
  • the liquid simulation device can be applied to a GPU.
  • the liquid simulation device can include:
  • the initialization information obtaining module 100 is configured to acquire initialization information.
  • the two-dimensional grid determining module 110 is configured to determine a two-dimensional grid according to the initialization information
  • a plane mapping module 120 configured to map a plane of the three-dimensional liquid to be simulated into the two-dimensional grid, and determine a target grid corresponding to the plane of the three-dimensional liquid to be simulated in the two-dimensional grid;
  • a height mapping module 130 configured to record a liquid level corresponding to a plane coordinate of the three-dimensional liquid to be simulated at each grid point of the target grid, to obtain a corresponding three-dimensional liquid to be simulated in the two-dimensional grid Height field
  • the simulation result drawing module 140 is configured to draw a three-dimensional liquid according to the update of the height field to obtain a liquid simulation result.
  • the simulation result drawing module 140 is configured to draw a three-dimensional liquid according to the update of the height field, and obtain a liquid simulation result, specifically including:
  • the liquid simulation result is obtained by plotting the three-dimensional liquid according to the updated height field every set number of frames.
  • the height mapping module 130 is configured to map a liquid level of the three-dimensional liquid to be simulated into the two-dimensional grid, and record a corresponding liquid level of the three-dimensional liquid to be simulated at each grid point of the target grid. Specifically, including:
  • the grid level corresponding to the plane coordinate of the three-dimensional liquid to be simulated corresponds to the liquid level.
  • the simulation result drawing module 140 is configured to draw a three-dimensional liquid according to the updated height field every predetermined number of frames, and obtain a liquid simulation result, which specifically includes:
  • the heights of the vertices of the triangles are vertex-shifted according to the updated height field, and the vertex positions after the vertices of the respective triangles are offset are obtained;
  • a three-dimensional liquid is drawn for each set number of frames according to the vertex positions after the vertices of each triangle are offset, and a liquid simulation result is obtained.
  • the simulation result drawing module 140 is configured to divide the Mesh corresponding to the three-dimensional liquid to be simulated into a mesh that is spliced by multiple triangles, and specifically includes:
  • Mesh corresponding to the three-dimensional liquid to be simulated is dynamically divided into meshes composed of a plurality of triangles using a tessellation technique
  • the simulation result drawing module 140 is configured to perform vertex offset on the heights of the vertices of the triangles according to the updated height field, and obtain vertex positions after the vertices of each triangle are offset, including:
  • the heights of the vertices of the respective triangles are added to the corresponding liquid level heights to obtain vertex positions after the vertices of the respective triangles are shifted.
  • the plane mapping module 120 is configured to map a plane of the three-dimensional liquid to be simulated into the two-dimensional grid, and determine a target network corresponding to the plane of the three-dimensional liquid to be simulated in the two-dimensional grid.
  • Grid specifically including:
  • the mesh occupied by the plane of the three-dimensional liquid to be simulated obtains a target mesh correspondingly mapped in the two-dimensional grid of the plane of the three-dimensional liquid to be simulated.
  • FIG. 15 is a block diagram showing another structure of the liquid simulation device according to the embodiment of the present invention.
  • the liquid simulation device may further include:
  • the flow field determining module 150 is configured to determine flow information between each grid point of the target grid and surrounding neighboring grid points, and obtain a corresponding velocity field of the three-dimensional liquid to be simulated in the two-dimensional grid; the flow information includes: The relative flow rate between each grid point and the surrounding grid points;
  • the simulation result drawing module 140 is configured to update the height field every set number of frames, specifically including:
  • the height field is updated according to the updated flow rate field every set number of frames.
  • simulation result drawing module 140 is configured to update the flow rate field every set number of frames, specifically:
  • the relative velocity of each cube of the interaction body and the three-dimensional liquid is approximated, and the depth of each cube immersed in the three-dimensional liquid is set every few frames according to the relative speed of each cube and the three-dimensional liquid. And the depth of each cube immersed in the three-dimensional liquid, updating the velocity field.
  • the simulation result drawing module 140 is configured to update the height field according to the updated flow rate field every predetermined number of frames, specifically including:
  • the relationship between the liquid level and the relative flow rate indicated by the SWE formula is: the rate of change of the liquid level recorded by one grid point is negatively correlated with the recorded outflow velocity of the relative flow velocity of the adjacent grid point, one The outflow velocity of the lattice point recorded in response to the relative flow velocity of the adjacent grid point is positively correlated with the height difference between the liquid level height recorded by the grid point and the liquid level height recorded by the adjacent grid point.
  • the simulation result drawing module 140 is configured to update the velocity field according to the relative velocity of each cube and the three-dimensional liquid, and the depth of each cube immersed in the three-dimensional liquid, and specifically includes:
  • the cube corresponds to the grid of the target grid to update the relative flow rate recorded on the grid points of the target grid corresponding to the cube in the velocity field; wherein the set factor is related to the depth of the cube immersed in the three-dimensional liquid.
  • the liquid simulation device can also be used to call a Compute Shade
  • the simulation result drawing module 140 can use the Compute Shade to update the height field every set number of frames.
  • the embodiment of the present invention further provides a liquid interaction device, which can be considered as a program module required for the CPU to implement the liquid interaction method provided by the embodiment of the present invention.
  • the liquid interaction device described below can be referred to each other in correspondence with the liquid interaction method described above.
  • FIG. 16 is a structural block diagram of a liquid interaction device according to an embodiment of the present invention.
  • the liquid interaction device may include:
  • a model approximation module 200 configured to approximate a model of the interacting body using a cube group, the cube group including a plurality of cubes;
  • a height field acquisition module 210 configured to acquire a corresponding height field of the three-dimensional liquid to be simulated in the two-dimensional grid, wherein the height field corresponds to a target grid, and the target grid is a plane of the three-dimensional liquid to be simulated Correspondingly mapped grids in the two-dimensional grid, and each grid point of the target grid records a corresponding liquid level height of the three-dimensional liquid to be simulated;
  • a liquid level determining module 220 configured to determine a liquid level corresponding to each cube according to a horizontal position coordinate of each cube and the height field;
  • the interaction force determining module 230 is configured to determine an interaction force between the three-dimensional liquid to be simulated and each cube according to a liquid level corresponding to each cube;
  • the integration module 240 is configured to combine the interaction force of the three-dimensional liquid to be simulated with each cube to determine an interaction force between the three-dimensional liquid to be simulated and the interaction body.
  • model approximation module 200 is configured to approximate the model of the interaction body by using a cube group, and specifically includes:
  • a corresponding cube is generated according to each grid point located inside the model of the interaction body, and a cube group approximated by the model of the interaction body is obtained.
  • the liquid level determining module 220 is configured to determine a liquid level corresponding to each cube according to the horizontal position coordinates of the cubes and the height field, and specifically includes:
  • the height field represents the two-dimensional plane coordinate of the liquid to be simulated as a function of the liquid level.
  • the interaction force determining module 230 is configured to determine the interaction force between the three-dimensional liquid and each cube according to the liquid level corresponding to each cube, and specifically includes:
  • the interaction force of the three-dimensional liquid to be simulated and each cube is determined according to the depth of each cube immersed in the three-dimensional liquid to be simulated.
  • the liquid interaction device is further configured to: acquire a velocity field; the velocity field corresponds to a target mesh, and the target mesh is a corresponding mapping of the plane of the three-dimensional liquid to be simulated in the two-dimensional grid a grid, and the relative flow rates of adjacent grid points are recorded on the grid points of each target grid;
  • the interaction force determining module 230 is configured to determine the interaction force between the three-dimensional liquid and each cube according to the depth of each cube immersed in the three-dimensional liquid, and specifically includes:
  • Determining the interaction force of the three-dimensional liquid to be simulated and each cube according to the volume of each cube to be immersed in the volume of the three-dimensional liquid to be simulated, the speed of each cube, and the three-dimensional liquid to be simulated The velocity is determined by the velocity field and the speed of each cube is determined by the physics engine.
  • the integration module 240 is configured to combine the interaction force of the three-dimensional liquid to be simulated with each cube to determine the interaction force between the three-dimensional liquid to be simulated and the interaction body, and specifically includes:
  • the interaction force corresponding to the central space coordinates of each cube is determined, and the corresponding interaction force is obtained, and the interaction force between the three-dimensional liquid to be simulated and the interaction body is obtained.
  • the interaction force of the three-dimensional liquid to be simulated and each cube includes: a force of the three-dimensional liquid to be simulated on each cube, and a force of each cube on the three-dimensional liquid to be simulated.
  • the liquid interaction device is further configured to: transmit a relative speed of each cube to the three-dimensional liquid to be simulated, and immerse each cube into a depth of the three-dimensional liquid to be simulated, and transmit the depth to the GPU, so that the GPU updates the velocity field;
  • the relative velocity of the cube to the three-dimensional liquid to be simulated is determined by the velocity of the three-dimensional liquid to be simulated and the velocity of each cube.
  • the embodiment of the present invention further provides a simulation device for implementing a liquid simulation method, and the structure of the simulation device can be similar to that shown in FIG. 1, including: a memory and a GPU;
  • the memory stores a program
  • the GPU calls the program
  • the program is used to:
  • the embodiment of the present invention further provides a simulation device for implementing a liquid interaction method, and the structure of the simulation device can be similar to that shown in FIG. 1, including: a memory and a CPU;
  • the memory stores a program
  • the CPU calls the program
  • the program is used to:
  • the model of the interacting body is approximated using a set of cubes comprising a plurality of cubes;
  • the three-dimensional liquid is integrated with the interaction force of each cube to determine the interaction force between the three-dimensional liquid and the interacting body.
  • the embodiment of the present invention further provides a storage medium for storing program code, which is used to execute any one of the liquid simulation methods described in the foregoing embodiments, or to execute the foregoing various embodiments. Any one of the liquid interaction methods described.
  • the embodiment of the present application further provides a computer program product comprising instructions, when executed on a computer, causing the computer to execute any one of the liquid simulation methods described in the foregoing various embodiments, or perform the foregoing Any one of the liquid interaction methods described in the embodiments.
  • the steps of a method or algorithm described in connection with the embodiments disclosed herein can be implemented directly in hardware, a software module executed by a processor, or a combination of both.
  • the software module can be placed in random access memory (RAM), memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or technical field. Any other form of storage medium known.

Abstract

一种液体仿真方法、液体交互方法及装置,其中液体仿真方法包括:获取初始化信息(S100);根据初始化信息确定二维网格(S110);将待仿真三维液体的平面映射到二维网格中,确定待仿真三维液体的平面在二维网格中相应映射的目标网格(S120);将待仿真三维液体的液面高度映射到二维网格中,在目标网格的各格点记录待仿真三维液体相应的液面高度,得到待仿真三维液体在所述二维网格中相应的高度场(S130);根据所述高度场的更新,绘制三维液体得到液体仿真结果(S140)。本方法可在保障液体仿真结果逼真度的情况下,降低液体仿真的计算开销。

Description

一种液体仿真方法、液体交互方法及装置
本申请要求于2017年9月13日提交中国专利局、申请号2017108234928、发明名称为“一种液体仿真方法、液体交互方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及仿真技术领域,具体涉及液体仿真技术。
背景技术
液体仿真能够模拟三维的流动液体,在影视特效制作、计算机游戏、水利工程设计等场景中应用广泛,液体包括但不限于水体等。液体仿真的性能主要通过液体仿真结果的逼真度,和液体仿真所涉及的计算开销衡量,特别是在计算机游戏场景中进行液体仿真时,高逼真度且低计算开销的液体仿真对于计算机游戏的正常运行至关重要。
目前液体仿真的主要方式是基于粒子的粒子法,具体的,可使用大量粒子对液体进行近似,通过计算粒子的运动行为来仿真液体;使用粒子法进行液体仿真的优势在于计算速度相对较快,且计算开销较低,但缺点是液体仿真结果的逼真度较低(体现在液体的仿真精度较低,效果较为粗糙)。因此如何在保障液体仿真结果逼真度的情况下,降低液体仿真的计算开销一直是本领域技术人员急需解决的问题。
发明内容
有鉴于此,本发明实施例提供一种液体仿真方法、液体交互方法及装置,以在保障液体仿真结果逼真度的情况下,降低液体仿真的计算开销。
为实现上述目的,本发明实施例提供如下技术方案:
第一方面,本发明实施例提供一种液体仿真方法,应用于图形处理器(Graphics Processing Unit,GPU),所述方法包括:
获取初始化信息;
根据所述初始化信息确定二维网格;
将待仿真三维液体的平面映射到所述二维网格中,确定所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格;
在所述目标网格的各格点记录所述待仿真三维液体的平面坐标相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场;
根据所述高度场的更新,绘制三维液体,得到液体仿真结果。
第二方面,本发明实施例还提供一种液体交互方法,应用于中央处理器(Central Processing Unit,CPU),所述方法包括:
将交互体的模型使用立方体组进行近似,所述立方体组包括多个立方体;
获取待仿真三维液体在二维网格中相应的高度场,其中,所述高度场对应有目标网格,所述目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且所述目标网格的各格点记录有所述待仿真三维液体相应的液面高度;
根据各立方体的水平位置坐标及所述高度场,确定各立方体对应的液面高度;
根据各立方体对应的液面高度,确定所述待仿真三维液体与各立方体的相互作用力;
将所述待仿真三维液体与各立方体的相互作用力相综合,确定所述待仿真三维液体与交互体的相互作用力。
第三方面,本发明实施例还提供一种液体仿真装置,应用于GPU,包括:
初始化信息获取模块,用于获取初始化信息;
二维网格确定模块,用于根据所述初始化信息确定二维网格;
平面映射模块,用于将待仿真三维液体的平面映射到所述二维网格中,确定所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格;
高度映射模块,用于在所述目标网格的各格点记录所述待仿真三维液体的平面坐标相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场;
仿真结果绘制模块,用于根据所述高度场的更新,绘制三维液体,得到液体仿真结果。
第四方面,本发明实施例还提供一种液体交互装置,应用于CPU,包括:
模型近似模块,用于将交互体的模型使用立方体组进行近似,所述立方体组包括多个立方体;
高度场获取模块,用于获取待仿真三维液体在二维网格中相应的高度场,其中,所述高度场对应有目标网格,所述目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且目标网格的各格点记录有所述待仿真三维液体相应的液面高度;
液面高度确定模块,用于根据各立方体的水平位置坐标及所述高度场,确定各立方体对应的液面高度;
相互作用力确定模块,用于根据各立方体对应的液面高度,确定所述待仿真三维液体与各立方体的相互作用力;
综合模块,用于将所述待仿真三维液体与各立方体的相互作用力相综合,确定所述待仿真三维液体与交互体的相互作用力。
第五方面,本发明实施例还提供一种液体仿真设备,包括:存储器和GPU;
其中,所述存储器用于存储程序代码,并将所述程序代码传输给所述GPU;
所述GPU用于根据所述程序代码中的指令执行上述第一方面提供的液体 仿真方法。
第六方面,本发明实施例还提供一种液体交互设备,包括:存储器和CPU;
其中,所述存储器用于存储程序代码,并将所述程序代码传输给所述CPU;
所述CPU用于根据所述程序代码中的指令执行上述第二方面提供的液体交互方法。
第七方面,本发明实施例还提供一种存储介质,所述存储介质用于存储程序代码,所述程序代码用于执行上述第一方面提供的液体仿真方法,或者,上述第二方面提供的液体交互方法。
第八方面,本发明实施例提供一种包括指令的计算机程序产品,当其在计算机上运行时,使得所述计算机执行上述第一方面提供的液体仿真方法,或者,上述第二方面提供的液体交互方法。
基于上述技术方案,本发明实施例提供的液体仿真方法中,GPU获取初始化信息后,可确定二维网格,将待仿真三维液体的平面映射到所述二维网格中,确定出所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格;在目标网格的各格点记录所述待仿真三维液体的平面坐标相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场;进而可根据所述高度场的更新,绘制三维液体,得到液体仿真结果。
可见,本发明实施例提供的液体仿真方法,通过在二维网格中确定待仿真三维液体的平面占据的目标网格,并在目标网格的各格点中记录相应的待仿真三维液体的液面高度,可将待仿真三维液体的仿真简化到二维网格中实现,可极大的减少计算量,降低计算开销,从而使实时流动的液体仿真成为可能;同时,使用基于空间网格的方式实现液体仿真(即本发明实施例为基于空间网格的欧拉法,所改进的基于二维空间网格的三维液体仿真方法),可继承基于空间网格进行液体仿真所带来的较高逼真度的效果,从而在保障液体仿真结果逼真度的情况下,降低液体仿真的计算开销。
附图说明
图1为仿真设备的硬件结构框图;
图2为本发明实施例提供的液体仿真方法的流程图;
图3为待仿真三维液体的平面映射到二维网格的示意图;
图4为格点记录液面高度的示意图;
图5为现有技术与本发明实施例的液体仿真方案比对示意图;
图6为本发明实施例提供的液体仿真方法的另一流程图;
图7a为本发明实施例提供的液体仿真效果的示例图;
图7b为本发明实施例提供的液体仿真效果的另一示例图;
图7c为本发明实施例提供的液体仿真效果的再一示例图;
图8为本发明实施例提供的液体交互方法的流程图;
图9为确定三维液体与各立方体的相互作用力的方法流程图;
图10为三维液体对立方体的作用力的示意图;
图11为立方体对三维液体的作用力的示意图;
图12为现有技术与本发明实施例的液体交互方案比对示意图;
图13为CPU和GPU的处理走向示意图;
图14为本发明实施例提供的液体仿真装置的结构框图;
图15为本发明实施例提供的液体仿真装置的另一结构框图;
图16为本发明实施例提供的液体交互装置的结构框图。
具体实施方式
在改进液体仿真方法的过程中,本发明的发明人发现了一种基于空间网格的欧拉法进行液体仿真的技术;通过将整个仿真空间划分为空间网格,确认待仿真三维液体在该空间网格中所占据的网格,在每一个被占据的网格上根据流体力学方程来计算液体的流动信息(如流速、压强等),并以此更新液体的形态(如更新液体的运动状态和形状变化),完成液体仿真。
本发明的发明人经过比对基于空间网格的欧拉法,和基于粒子的粒子法,发现欧拉法的优势和劣势与粒子法相反,欧拉法能够很好地表现出液面(液面如水面)细节,液体仿真结果具有较高的逼真度,但缺点是计算开销较大,特别是在三维的液体仿真情况下,仅可进行小范围的液体仿真,因此,对于实时性要求较高的游戏等场景而言无法接受采用欧拉法进行液体仿真。
基于此,本发明的发明人在欧拉法的基础上进行改进,提出本发明实施例提供的液体仿真方法,并设置相应的程序,希望在进行三维的液体仿真的情况下,保留欧拉法的高逼真度的液体仿真结果,同时降低计算开销,以满足本发明实施例提供的液体仿真方法在对于实时性的要求,并且使得该液体仿真方法在仿真逼真度要求较高的游戏等场景中同样适用。
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明实施例提供的液体仿真方法可通过相应的程序表示,并由CPU(Central Processing Unit,中央处理器)和GPU(Graphics Processing Unit,图形处理器)联合工作,执行液体仿真方法相应程序中CPU和GPU各自负责的流程,实现本发明实施例提供的液体仿真方法。另外,本发明实施例还提供的液体交互方法也可通过相应的程序表示,由CPU和GPU联合工作,执行液体交互方法相应程序中CPU和GPU各自负责的流程,实现本发明实施例提 供的液体交互方法。
可选的,CPU和GPU可在仿真设备上进行设置,仿真设备如网络侧的服务器,当然,仿真设备也并不排除使用用户侧的PC(个人计算机)、智能手机等终端设备的可能。
可选的,图1示出了仿真设备的可选硬件结构框图,参照图1,仿真设备可以包括:CPU1,GPU2,通信接口3,存储器4和通信总线5;
可选的,通信接口2可以为通信模块的接口;
存储器3可能包含高速RAM(随机存取存储器)存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器;存储器3中可存储实现本发明实施例提供的液体仿真方法相应的程序,以及实现本发明实施例提供的液体交互方法相应的程序;
CPU1和GPU2可联合工作实现本发明实施例提供的液体仿真方法,具体的,CPU1和GPU2可通过调用存储器3中所存储的液体仿真方法相应的程序,执行液体仿真方法中各自负责的流程,实现本发明实施例提供的液体仿真方法。CPU 1和GPU2可联合工作实现本发明实施例提供的液体交互方法,具体的,CPU1和GPU2可通过调用存储器3中所存储的液体交互方法相应的程序,执行液体交互方法中各自负责的流程,实现本发明实施例提供的液体交互方法。
可选的,本发明实施例所提供的液体仿真方法主要由GPU2实现,GPU2可基于CPU1的初始化信息和存储器3中所存储的由GPU负责执行的程序,实现三维的液体仿真;CPU1可基于GPU2的输出信息,和存储器3中所存储的由CPU负责执行的液体交互方法相应的程序,实现液体交互。
可选的,图2示出了本发明实施例提供的液体仿真方法的流程图,该液体仿真方法可应用于GPU中,由GPU负责执行,参照图2,该液体仿真方法可以包括:
步骤S100、获取初始化信息。
可选的,初始化信息可由CPU传递给GPU,初始化信息中可以包括:液体仿真对应的二维网格的布局信息,如二维网格的二维维度,每一个网格的边长等;使用该二维网格的布局信息可以绘制出液体仿真对应的二维网格;
进一步,该初始化信息中还可以包括:二维网格中所有格点对应的初始液面高度,以及液体仿真过程中所需的其他参数。
步骤S110、根据所述初始化信息确定二维网格。
可选的,本发明实施例可根据所述初始化信息中记录的二维网格的布局信息,绘制出液体仿真对应的二维网格;具体的,可根据二维网格的二维维度,每一个网格的边长,进行二维网格的绘制。
值得注意的是,本发明实施例在进行三维液体仿真时,仅进行二维网格 的绘制,并不涉及三维网格的情况;所确定的二维网格可以认为是基于空间网格的欧拉法所相应的二维网格。
步骤S120、将待仿真三维液体的平面映射到所述二维网格中,确定所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格。
本发明实施例提供的液体仿真方法主要用于进行三维液体的仿真,在确认需要进行液体仿真的待仿真三维液体(如需要进行液体仿真的液池等)后,本发明实施例可将该待仿真三维液体的平面映射到上述步骤S110中确定出的二维网格中,确定所述二维网格中该待仿真三维液体的平面所占据的网格,即得到待仿真三维液体的平面在所述二维网格中相应映射的目标网格;
可选的,本发明实施例可将待仿真三维液体的平面视为是待仿真三维液体的底面,本发明实施例可将待仿真三维液体的底面映射到所述二维网格中;
本发明实施例可确定待仿真三维液体的底面的平面坐标,根据所述底面的平面坐标,将待仿真三维液体的平面映射到二维网格中与所述底面的平面坐标相应的区域,在二维网格中,确定出该待仿真三维液体的平面所占据的网格,即得到待仿真三维液体的平面在所述二维网格中相应映射的目标网格。
如图3所示,待仿真三维液体的平面形状如图中曲线部分所示,将待仿真三维液体的平面映射到二维网格中后,可确认出二维网格中被该待仿真三维液体的平面所占据的网格为目标网格,目标网格的数量为多个。
步骤S130、在所述目标网格的各格点记录所述待仿真三维液体的平面坐标相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场。
在通过步骤S120确定出二维网格中被待仿真三维液体的平面占据的目标网格后,待仿真三维液体的平面二维坐标已可相应地记录为目标网格的平面坐标;而对于待仿真三维液体的垂直方向的液面高度信息,本发明实施例可以在待仿真三维液体的平面坐标相应映射的目标网格的格点上,记录待仿真三维液体不同的平面坐标对应的垂直方向的液面高度,例如,水体高度,即使得目标网格的各格点可记录相应映射的待仿真三维液体的平面坐标所对应的液面高度;从而综合待仿真三维液体的平面在二维网格中相应映射的目标网格的坐标,以及目标网格的各格点记录的待仿真三维液体相应的液面高度,得出所述高度场。
可见,高度场可以表示出待仿真液体的二维的平面坐标与液面高度的一种函数关系。
可选的,作为一种优选方案,本发明实施例可在目标网格的各格点记录,各个格点对应的待仿真三维液体的平面坐标相应的液面高度,从而实现将待仿真三维液体的液面高度映射到所述二维网格中,在目标网格的各格点记录所述待仿真三维液体相应的液面高度;
如图4所示,在确定出目标网格后,本发明实施例可确定目标网格的各格 点所对应的待仿真三维液体的平面坐标,在各格点上相应地记录待仿真三维液体的平面坐标对应的液面高度,如图中黑点部分对应记录有相应的液面高度;相应的,高度场可以认为是一个平面网格,网格中每个格点的值代表该点的高度。
需要说明的是,本发明实施例提供的液体仿真方法,通过在二维网格中确定被待仿真三维液体的平面占据的目标网格,并在目标网格的各格点记录相应的待仿真三维液体的液面高度,将待仿真三维液体的仿真简化到二维网格中实现,可极大的减少计算量,降低计算开销,从而使实时流动的液体仿真成为可能。
如图5所示比对,图5左部分为传统的基于空间网格的欧拉法所进行的三维液体仿真,该传统的基于空间网格的欧拉法需要构建出三维空间网格的三维液体相应的形态,,计算开销极大;图5右部分为基于本发明提供液体仿真法进行的液体仿真,将待仿真三维液体的仿真简化到二维网格中实现,并优选在目标网格的各格点记录相应的待仿真三维液体的液面高度,可极大的降低了计算开销。
步骤S140、根据所述高度场的更新,绘制三维液体,得到液体仿真结果。
在通过步骤S100至步骤S130确定出高度场后,该高度场可以认为是初始高度场,在液体仿真的过程中,可不断的进行高度场的更新,从而根据高度场的更新结果绘制三维液体,得到液体仿真结果。
本发明实施例提供的液体仿真方法中,GPU获取初始化信息后,可确定二维网格,将待仿真三维液体的平面映射到所述二维网格中,确定出所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格;在目标网格的各格点记录所述待仿真三维液体相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场;根据所述高度场的更新,绘制三维液体,得到液体仿真结果。
可见,本发明实施例提供的液体仿真方法,通过在二维网格中确定被待仿真三维液体的平面占据的目标网格,并在目标网格的各格点中记录相应的待仿真三维液体的液面高度,可将待仿真三维液体的仿真简化到二维网格中实现,可极大的减少计算量,降低计算开销,从而使实时流动的液体仿真成为可能;同时,使用基于空间网格的方式实现液体仿真(即本发明实施例为基于空间网格的欧拉法,所改进的基于二维空间网格的三维液体仿真方法),可继承基于空间网格进行液体仿真所带来的较高逼真度的效果,从而在保障液体仿真结果逼真度的情况下,降低液体仿真的计算开销。
可选的,在通过步骤S100至步骤S130的流程确定高度场后,本发明实施例可每隔设定数量帧更新所述高度场,进而可每隔设定数量帧,根据更新的高度场绘制三维液体,得到液体仿真结果。
步骤S100至步骤S130的流程所确定的高度场可以认为是待仿真三维液体初始的高度场,而在三维液体流动或者与在交互体进行交互的情况下,三维液体的流速将改变,从而导致高度场也相应的改变;因此在通过步骤S100至步骤S130确定出初始的高度场后,还需根据三维液体的流动或者与交互体的交互情况,每隔设定数量帧的更新高度场。
可以认为,在液体仿真过程中,步骤S100至步骤S130可执行一次,后续可每隔设定数量帧更新所述高度场,从而可每隔设定数量帧,根据更新的高度场进行三维液体的绘制,得到液体仿真结果;可选的,设定数量帧可以是一帧,即在每一帧根据三维液体的流动或者与交互体的交互情况,更新高度场;设定数量帧也可能是大于一的帧数,具体可根据实际情况设置。
可选的,本发明实施例可每隔设定数量帧,根据更新的高度场,结合曲面细分和顶点偏移技术,绘制出三维液体;
可选的,在每隔设定数量帧,根据更新的高度场,结合曲面细分和顶点偏移技术,绘制出三维液体时,本发明实施例可将待仿真三维液体对应预置的Mesh(三维网格模型,Mesh可以认为是物体的三维网格模型),划分成由多个三角形拼接的网格;进而可根据每隔设定数量帧更新的高度场,对各三角形的各顶点的高度进行顶点偏移,得到各三角形的各顶点偏移后的顶点位置,进而每隔设定数量帧,根据各三角形的各顶点偏移后的顶点位置绘制三维液体,得到液体仿真结果;
具体的,由于待仿真三维液体预置的Mesh(三维网格模型,Mesh可以认为是物体的三维网格模型)仅仅是简单的四边形,为进一步提升液体仿真的逼真度效果,本发明实施例可将待仿真三维液体对应的Mesh使用曲面细分技术,动态划分成由多个三角形拼接的网格;可选的,本发明实施例可使用DirectX提供的曲面细分技术,将待仿真三维液体的Mesh进行曲面细分;
进而可根据每隔设定数量帧更新的高度场记录的待仿真三维液体相应的液面高度,确定出划分成的各三角形的各顶点对应的液面高度,从而将各三角形的各顶点的高度与对应的液面高度相加,进行顶点偏移,得到各三角形的各顶点偏移后的顶点位置;从而在每隔设定数量帧,根据各三角形的各顶点偏移后的顶点位置绘制出三维液体,得到液体仿真结果。
需要说明的是,待仿真三维液体的流动信息(如流速、压强)的更新计算可以由GPU在二维空间基于流体力学方程进行,根据流体力学方程更新计算流速场,从而基于更新的流速场,以SWE公式更新目标网格的各格点中记录的待仿真三维液体相应的液面高度(即更新高度场);
即在二维网格中进行待仿真三维液体的仿真之后,最终会基于计算的待仿真三维液体的流动信息,对目标网格的每个格点上记录的液面高度值进行更新,这样就可以根据所有格点的液面高度值把三维的液体还原出来,完成二维网格到三维液体的反投影,实现三维液体的流动效果仿真。
进一步,在涉及到交互体(如用户手指,鱼竿等固体)与三维液体的交互时,待仿真三维液体的流动信息(如流速、压强)的更新还可基于交互体对三维液体的作用力实现;可选的,除考虑基于流体力学方程进行待仿真三维液体的流动信息更新外,还可结合考虑交互体对三维液体的作用力,更新待仿真三维液体的流动信息,进而更新高度场。
可选的,目标网格的各格点除可记录该格点对应的液面高度外,还可记录:该格点与周围相邻格点之间的流速、压强等流动信息;目标网格的各格点所记录的与相邻格点之间的流速、压强等流动信息,可形成待仿真三维液体在二维网格中相应的流速场;
即目标网格的各格点中所记录的液面高度信息可形成高度场,而目标网格的各格点中记录的流速、压强等流动信息可形成流速场。
相应的,每隔设定数量帧更新高度场的方式可以是:每隔设定数量帧更新流速场;每隔设定数量帧,根据更新的流速场更新所述高度场。
而流速场的更新可以根据流体力学方程进行;在存在交互体与液体交互的情况下,还可结合交互体与三维液体交互情况,更新流速场。
进一步,GPU通过每帧的实时更新的高度场进行三维液体绘制,可得到液体的流动仿真效果。
需要说明的是,根据初始化信息所确定的二维网格越细,则液体仿真结果与实际的待仿真液体的近似度越高,但计算开销也将相应的提升,因此二维网格可以选取一个适中的细化程度,以平衡液体仿真结果的逼真度和涉及的计算开销;当然,二维网格的细化程度可以根据实际情况调整设定。
可选的,为进一步降低计算开销,GPU可利用Compute Shader(计算着色器)的并行计算机制,进行液体仿真处理;在Compute Shader的帮助下,可将GPU作为并行处理器加以利用,GPU将不仅具有3D渲染能力,也具有其他的运算能力;可选的,GPU可利用Compute Shade每隔设定数量帧的更新高度场,进一步降低液体仿真涉及的计算开销。
可选的,GPU在进行液体仿真时,可优选使用图6所示方法流程,图6为本发明实施例提供的液体仿真方法的另一流程图,该液体仿真方法可应用于GPU中,由GPU负责执行,参照图6,该液体仿真方法可以包括:
步骤S200、获取初始化信息。
步骤S210、根据所述初始化信息确定二维网格。
步骤S220、将待仿真三维液体的平面映射到所述二维网格中,确定所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格。
步骤S230、在目标网格的各格点记录,格点对应的待仿真三维液体的平面坐标相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场。
可选的,步骤S230可以认为是图2所示步骤S130的一种优选实现。
步骤S240、每隔设定数量帧更新所述高度场。
可选的,本发明实施例可每隔设定数量帧更新流速场,进而每隔设定数量帧,根据更新的流速场更新所述高度场;
可选的,流速场的更新可根据流体力学方程实现;当存在交互体与液体的情况时,还可结合交互体与三维液体交互情况,更新流速场;关于结合交互体与三维液体的交互情况,更新流速场的内容,将在下文的液体交互方法内容部分进行介绍。
步骤S250、将待仿真三维液体预置的Mesh使用曲面细分技术,动态划分成由多个三角形拼接的网格。
步骤S260、每隔设定数量帧,根据更新的高度场记录的待仿真三维液体相应的液面高度,确定划分成的各三角形的各顶点对应的液面高度,将各三角形的各顶点的高度与对应的液面高度相加,得到各三角形的各顶点偏移后的顶点位置。
步骤S270、每隔设定数量帧,根据各三角形的各顶点偏移后的顶点位置绘制三维液体,得到液体仿真结果。
可选的,步骤S240至步骤S270可以认为是图2所示步骤S140的一种可选实现,本发明实施并不排除根据每隔设定数量帧更新的高度场绘制三维液体的其他方式,比如每隔设定数量帧,先根据更新的高度场绘制初始的三维液体,初始的三维液体的液面高度与高度场中目标网格的各格点记录的待仿真三维液体相应的液面高度相应;进而每隔设定数量帧,根据待仿真三维液体预置的Mesh细分的各三角形的各顶点的高度,调整初始的三维液体中各顶点相应的液面高度,绘制出三维液体。
可选的,在实现液体仿真的基础上,本发明实施例还可实现交互体与液体的交互,如与液体交互的固体、用户操作液体的物品等,,以使得用户可基于高逼真且计算开销较低的液体仿真结果,实现逼真的交互体验;以液体为水体为例,图7a和图7b示出了水池的水体仿真效果以及用户的交互示意,用户可以在水面上划出波浪甚至搅动整池的水,漂浮在水面上的白色立方体会随着波浪上下起伏并来回浮动,可见,基于本发明实施例所进行的水体仿真,其水面效果细腻真实;
图7c展示了基于本发明实施例提供的液体仿真方法,所制作的一个钓鱼小游戏,可以看出基于本发明实施例所实现的水体仿真效果非常真实,真实的水面效果能够提升用户的沉浸感;
需要说明的是,经测试,图7a、图7b和图7c的示例中,本发明实施例进行水体仿真在CPU和GPU端仅仅各占用了0.5ms左右的时间,相比于高逼真的水面效果,本发明实施例的计算时间开销是极低的。
可选的,本发明实施例为实现液体交互,需要计算三维液体与交互体的相互作用力(如三维液体对交互体的作用力,交互体对三维液体的作用力),在本发明实施例中,三维液体与交互体的相互作用力的计算可由CPU执行,以降低GPU的计算开销,而GPU可基于CPU所计算的三维液体与交互体的相互作用力进行液体交互效果的展示;
可选的,图8示出了本发明实施例提供的液体交互方法的流程图,该液体交互方法主要介绍了三维液体与交互体的相互作用力的计算过程,该液体交互方法可应用于CPU,由CPU负责执行;参照图8,该方法可以包括:
步骤S300、将交互体的模型使用立方体组进行近似,所述立方体组包括多个立方体。
在液体交互方式中确定三维液体与交互体的相互作用力时,首先需要解决的问题是将交互体抽象为何种形式,传统的液体交互方式主要是直接使用交互体的表面Mesh来表示交互体,从而针对交互体的表面Mesh上的每一个三角形去计算交互体与三维液体的相互作用力,来实现三维液体与交互体的相互作用力的确定;然而这种使用交互体的表面Mesh来表示交互体的方式,涉及到大量的计算开销,并不适用于计算机游戏等对于实时性要求较高的场景;
因此本发明实施例提出改进方案,使用一组立方体组(立方体组可包括多个立方体)来近似表示交互体,从而避免了传统方式中因使用交互体的表面Mesh来表示交互体,针对交互体的表面Mesh上的每一个三角形去计算,而造成的计算交互体与三维液体的相互作用力时需要耗费大量计算开销。
可选的,本发明实施例将交互体使用立方体组进行近似的方式可以是:将交互体的模型周围空间划分成三维网格,可选的,三维网格的长宽高应能容纳该交互体;对于该三维网格中的每一个格点,判断格点的位置是否位于交互体的模型内部,若是,则在该格点处生成与该格点对应的立方体,若否,则忽略该格点;即可在三维网格中确定出位于交互体的模型内部的各格点,根据位于交互体的模型内部的各格点对应的立方体,生成与交互体的模型近似的立方体组。
相应的,本发明实施例可确定出交互体所包含的所有立方体,以及每个立方体的边长、立方体在交互体的相对位置。
进一步,为了在液体仿真结果中展示交互体,CPU可将用于近似交互体的立方体组的信息传输给GPU,以便GPU在液体仿真结果中进行交互体的展示,该立方体组的信息可以包括:每个立方体的边长、每个立方体相对于交互体的模型的相对位置等。
步骤S310、获取待仿真三维液体在二维网格中相应的高度场,其中,所述高度场对应有目标网格,所述目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且所述目标网格的各格点记录有所述待仿真 三维液体相应的液面高度。
可选的,目标网格的各格点可以记录,各个格点对应的待仿真三维液体的平面坐标相应的液面高度。
可选的,所述高度场可由GPU根据上文提供的液体仿真方法确定,GPU在确定所述高度场后可反馈给CPU,以便CPU进行三维液体与交互体的相互作用力计算。
步骤S320、根据各立方体的水平位置坐标及所述高度场,确定各立方体对应的液面高度。
可选的,高度场可以表示待仿真液体的二维的平面坐标与液面高度的函数关系,而各立方体所位于的空间位置坐标是已知的,通过将各立方体的空间位置坐标中的水平位置坐标代入到所述高度场表示的函数关系中,则可得出各立方体的水平位置坐标相应的液面高度,得到各立方对应的液面高度;
可假设高度场表示的函数关系为f(x,y)→z,即通过水平坐标x,y可确定相应的液面高度;假设一立方体的空间位置坐标为(x,y,z),则将该立方体的空间位置坐标中的水平位置坐标x,y代入f(x,y)→z的函数关系,可得到该立方体对应的液面高度。
步骤S330、根据各立方体对应的液面高度,确定所述待仿真三维液体与各立方体的相互作用力。
步骤S340、将所述待仿真三维液体与各立方体的相互作用力相综合,确定所述待仿真三维液体与交互体的相互作用力。
可选的,对于每个立方体,设立方体的中心空间坐标为p,算出立方体与三维液体的相互作用力后,则可以直接在立方体所属交互体的模型上的p的相对位置处,确定出与三维液体的相互作用力;在指定点确定相互作用力的过程在一般的物理引擎里都提供了函数接口,此处可直接调用。综合三维液体与各立方体的相互作用力,意味着对所有的立方体执行都这一操作后,这样就可得到交互体的模型在不同位置的与三维液体的相互作用力,从而可根据相互作用力来确定液体交互效果;
即本发明实施例可根据各立方体的中心空间坐标对应的与三维液体的相互作用力,确定出交互体的模型与各立方体的中心空间坐标相应位置,所对应的与三维液体的相互作用力,得到三维液体与交互体的相互作用力;
如在确定三维液体对立方体的作用力时,本发明实施例可确定每个立方体的中心空间坐标相应的三维液体受力,从而在交互体的模型上与各立方体的中心空间坐标相应的位置,确定出相应的三维液体受力,得到交互体的模型在不同位置的一组三维液体受力,即得出三维液体对交互体的作用力。确定交互体对三维液体的作用力的原理类似。
可选的,在确定三维液体与交互体的相互作用力后,CPU可进一步根据三维液体与交互体的相互作用力,确定三维液体与交互体的交互影响结果, 并传输给GPU,由GPU根据三维液体与交互体的交互影响结果,展示三维液体与交互体的交互结果;
例如,在确定三维液体对交互体的作用力后,CPU可进一步确定交互体在三维液体作用下的影响结果,并传输至GPU,由GPU展示三维液体对交互体的交互结果。
而在确定交互体对三维液体的作用力后,GPU可更新流速场,从而进一步更新高度场,更新三维液体的仿真结果。
可选的,在确定各立方体对应的液面高度后,本发明实施例可相应确定各立方体浸入三维液体的深度,从而根据各立方体浸入三维液体的深度,确定三维液体与各立方体的相互作用力;
相应的,图9示出了本发明实施例提供的确定三维液体与各立方体的相互作用力的方法流程图,该方法可应用于CPU,参照图9,该方法可以包括:
步骤S400、根据各立方体的垂直高度坐标,与对应的液面高度,确定各立方体浸入三维液体的深度。
可选的,本发明实施例可根据各立方体的垂直高度坐标,与各立方体的高度,确定出各立方体的下底面高度;从而将各立方体对应的液面高度减去下底面高度,可得出各立方体浸入三维液体的深度。
步骤S410、根据各立方体浸入三维液体的深度,确定三维液体与各立方体的相互作用力。
可选的,本发明实施例可根据各立方体浸入三维液体的深度,确定各立方体浸入三维液体的体积,从而根据各立方体浸入三维液体的体积,各立方体的速度,三维液体的速度确定三维液体与各立方体的相互作用力。
可选的,三维液体与各立方体的相互作用力可以由三维液体对各立方体的作用力,和各立方体对三维液体的作用力表示;
对于一立方体,三维液体对立方体的作用力可由三维液体对立方体的浮力和阻力表示,本发明实施例可根据立方体浸入三维液体的深度,确定立方体浸入三维液体的体积,进而根据立方体浸入三维液体的体积,立方体的速度、三维液体的速度,计算出三维液体对立方体的浮力和阻力,得到三维液体对立方体的作用力;如图10所示,图10所示方框表示立方体,波浪状图形表示三维液体,虚拟箭头分割开的一个区域对应一个格点,箭头表示了三维液体对立方体的作用力。
在计算立方体对三维液体的作用力时,对于每一立方体,可根据立方体浸入三维液体的深度,确定立方体浸入三维液体的体积,进而根据立方体浸入三维液体的体积,立方体相对于三维液体的速度,计算出立方体对三维液体的作用力;可选的,各立方体与三维液体的相对速度可由三维液体的速度和立方体的速度确定,其中,三维液体的速度可由GPU传输的流速场确定(相应的,CPU还可获取GPU传输的流速场,所述流速场对应有目标网格,所述 目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且各目标网格的格点上记录有与相邻格点的相对流速),而立方体的速度是由物理引擎计算得出,物理引擎如PhysX。
如图11所示,方框表示立方体,虚拟箭头分割开的一个区域对应一个格点,则该立方体占据了两个格点,需要根据这两个格点上的立方体各自的浸入深度以及,相对于三维液体的速度,计算该立方体对三维液体的作用力,立方体对三维液体的作用力如图11箭头所示。
如图12所示,相比于使用交互体的表面Mesh来表示交互体,从而针对交互体的表面Mesh上的每一个三角形去计算与三维液体的相互作用力的方式,本发明实施例可在交互体的模型上采样立方体,从而以细分的立方体进行与三维液体的相互作用力的确定,相对于以表面Mesh整体的进行与三维液体的相互作用力的计算,本发明实施例可极大的降低计算开销。
可选的,立方体对三维液体的作用力将影响三维液体的运动状态,因此本发明实施例中,CPU可将计算立方体与三维液体的相互作用力的过程中,各立方体与三维液体的相对速度,各立方体浸入三维液体的深度传输给GPU,由GPU根据各立方体与三维液体的相对速度,以及各立方体浸入三维液体的深度,对流速场进行更新,即对各立方体对应的目标网格的格点上记录的相对流速进行更新;
可选的,高度场对应的每个目标网格的格点上可记录对应的液面高度,流速场对应的每个目标网格的格点上可记录与相邻格点的相对流速;
GPU基于CPU的传输,确定交互体的模型采样的每一个立方体与三维液体的相对速度,以及立方体浸入三维液体的深度后,对于每一立方体,GPU可将立方体与三维液体的相对速度乘以设定系数,将相乘结果加上流速场中与该立方体对应的目标网格的格点上记录的相对流速,将相加结果记录在该立方体对应的目标网格的格点上,从而更新流速场中该立方体对应的目标网格的格点上记录的相对流速;其中,所述设定系数与立方体浸入三维液体的深度相关。
相应的,GPU可根据更新的流速场中各目标网格的格点所更新记录的相对流速,更新高度场,即更新高度场中目标网格的各格点对应记录的液面高度;如可将更新的目标网格的格点上记录的相对流速,纳入SWE(Shallow Water Equation,浅水方程算法)公式,计算出目标网格的各格点对应记录的液面高度,从而确定交互体对三维液体的运动状态影响;
需要说明的是,SWE的核心公式表示了液面高度和流速的互相影响,即液面高度的变化受流速的影响,流速的变化又受到液面高度值的影响。举例来说,一个格点与相邻格点的相对流速都是从这个格点流出,那么流出速度越大,该格点的液面高度下降就越快。而流出速度又与该格点和周围格点的 高度差相关,高度相差越大,流出速度也越大;即SWE公式表示的液面高度与相对流速的关系为:一个格点记录的液面高度的变化速率,与所记录的与相邻格点的相对流速反应的流出速度为负相关关系,一个格点所记录的与相邻格点的相对流速反应的流出速度,与该格点记录的液面高度和相邻格点记录的液面高度的高度差为正相关关系。
进一步,GPU可基于更新的高度场进行液体仿真更新,更新液体仿真结果。
可选的,GPU更新流速场和高度场,以及确定液体仿真结果的过程可由Compute Shader提供的并行运算机制,并行处理进行。
可选的,上文描述的本发明实施例提供的液体仿真方法主要由GPU实现,液体交互方法涉及的交互体与三维液体的相互作用力计算由CPU实现;
需要说明的是,由于交互体对受力很敏感,一般情况下需要每帧得到最新的作用力,如果在GPU端计算交互体与三维液体的相互作用力,则需要每帧都从GPU往CPU回传高度场等数据,造成CPU端大量的计算开销和时间浪费;因此可将交互体与三维液体的相互作用力的计算(如交互体的受力计算)放到CPU端每帧计算,GPU每隔若干帧将最新的高度场等液体数据传给CPU,以使CPU进行交互体与三维液体的相互作用力计算;GPU不用每帧都回传液体数据的原因是在几帧的时间内液体高度和速度不会发生显著变化,因此可以沿用旧的液体数据来计算固体受力;
相应的,本发明实施例提供的液体仿真方法和液体交互方法,涉及的CPU和GPU处理走向可如图13所示,CPU可将初始化信息,用于近似交互体的立方体组的信息传输给GPU,GPU可通过Compute Shader更新高度场和流速场,并传输给CPU,由CPU基于高度场和流速场以及交互体的模型,执行本发明实施例提供的液体交互方法,进行交互体与三维液体的相互作用力计算;同时,GPU可基于所更新的高度场进行Pixe Shader(像素着色器)进行渲染绘制,得到液体仿真结果,并在液体仿真结果中渲染交互体。
本发明实施例提供的液体仿真方法,可由GPU使用Compute Shader并行处理,将待仿真三维液体的仿真简化到二维网格中实现,极大的减少计算量,降低计算开销,从而使实时流动的液体仿真成为可能;同时,使用基于空间网格的方式实现液体仿真可继承基于空间网格进行液体仿真所带来的较高逼真度的效果,从而在保障液体仿真结果逼真度的情况下,降低液体仿真的计算开销。
并且,本发明实施例提供的液体交互方法,可由CPU使用交互体的模型近似的立方体组,基于高度场进行三维液体与交互体的相互作用力的计算,降低液体交互方法处理过程中,三维液体与交互体的相互作用力的计算开销;并且GPU可根据立方体与三维液体的相对速度,以及立方体浸入三维液体的 深度,更新流速场,进而以更新的流速场通过SWE公式更新高度场,从而使得GPU能够基于实时更新的高度场对液体仿真结果进行实时更新。
下面对本发明实施例提供的液体仿真装置进行介绍,下文描述的液体仿真装置,可以认为是GPU为实现本发明实施例提供的液体仿真方法所需设置的程序模块。下文描述的液体仿真装置可与上文描述的液体仿真方法相互对应参照。
图14为本发明实施例提供的液体仿真装置的结构框图,该液体仿真装置可应用于GPU,参照图14,该液体仿真装置可以包括:
初始化信息获取模块100,用于获取初始化信息;
二维网格确定模块110,用于根据所述初始化信息确定二维网格;
平面映射模块120,用于将待仿真三维液体的平面映射到所述二维网格中,确定所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格;
高度映射模块130,用于在所述目标网格的各格点记录所述待仿真三维液体的平面坐标相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场;
仿真结果绘制模块140,用于根据所述高度场的更新,绘制三维液体,得到液体仿真结果。
可选的,仿真结果绘制模块140,用于根据所述高度场的更新,绘制三维液体,得到液体仿真结果,具体包括:
每隔设定数量帧更新所述高度场;
每隔设定数量帧,根据更新的高度场绘制三维液体,得到液体仿真结果。
可选的,高度映射模块130,用于将待仿真三维液体的液面高度映射到所述二维网格中,在目标网格的各格点记录所述待仿真三维液体相应的液面高度,具体包括:
在目标网格的各格点记录,格点对应的待仿真三维液体的平面坐标相应的液面高度。
可选的,仿真结果绘制模块140,用于每隔设定数量帧,根据更新的高度场绘制三维液体,得到液体仿真结果,具体包括:
将待仿真三维液体对应的Mesh,划分成由多个三角形拼接的网格;
每隔设定数量帧,根据更新的高度场对各三角形的各顶点的高度进行顶点偏移,得到各三角形的各顶点偏移后的顶点位置;
每隔设定数量帧,根据各三角形的各顶点偏移后的顶点位置绘制三维液体,得到液体仿真结果。
可选的,仿真结果绘制模块140,用于将待仿真三维液体对应的Mesh,划分成由多个三角形拼接的网格,具体包括:
将待仿真三维液体对应的Mesh使用曲面细分技术,动态划分成由多个三 角形拼接的网格;
可选的,仿真结果绘制模块140,用于根据更新的高度场对各三角形的各顶点的高度进行顶点偏移,得到各三角形的各顶点偏移后的顶点位置,具体包括:
根据每隔设定数量帧更新的高度场记录的待仿真三维液体相应的液面高度,确定出划分成的各三角形的各顶点对应的液面高度;
将各三角形的各顶点的高度与对应的液面高度相加,得到各三角形的各顶点偏移后的顶点位置。
可选的,平面映射模块120,用于将待仿真三维液体的平面映射到所述二维网格中,确定所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格,具体包括:
确定待仿真三维液体的底面的平面坐标,根据所述底面的平面坐标,将待仿真三维液体的平面映射到二维网格中与所述底面的平面坐标相应的区域,确定出二维网格中被该待仿真三维液体的平面所占据的网格,得到待仿真三维液体的平面在所述二维网格中相应映射的目标网格。
可选的,图15示出了本发明实施例提供的液体仿真装置的另一结构框图,结合图14和图15所示,该液体仿真装置还可以包括:
流速场确定模块150,用于确定目标网格的各格点与周围相邻格点之间的流动信息,得到待仿真三维液体在二维网格中相应的流速场;所述流动信息包括:各格点与周围相邻格点之间的相对流速;
相应的,仿真结果绘制模块140,用于每隔设定数量帧更新所述高度场,具体包括:
每隔设定数量帧更新所述流速场;
每隔设定数量帧,根据更新的流速场更新所述高度场。
可选的,仿真结果绘制模块140,用于每隔设定数量帧更新所述流速场,具体包括:
根据流体力学方程,每隔设定数量帧更新流速场;
或者,获取交互体与三维液体交互情况下,近似交互体的各立方体与三维液体的相对速度,各立方体浸入三维液体的深度,每隔设定数量帧,根据各立方体与三维液体的相对速度,以及各立方体浸入三维液体的深度,更新流速场。
可选的,仿真结果绘制模块140,用于每隔设定数量帧,根据更新的流速场更新所述高度场,具体包括:
每隔设定数量帧,根据更新的流速场以及浅水方程算法SWE公式,更新高度场;
其中,SWE公式表示的液面高度与相对流速的关系为:一个格点记录的液面高度的变化速率,与所记录的与相邻格点的相对流速反应的流出速度为 负相关关系,一个格点所记录的与相邻格点的相对流速反应的流出速度,与该格点记录的液面高度和相邻格点记录的液面高度的高度差为正相关关系。
可选的,仿真结果绘制模块140,用于根据各立方体与三维液体的相对速度,以及各立方体浸入三维液体的深度,更新流速场,具体包括:
对于每一立方体,将立方体与三维液体的相对速度乘以设定系数,将相乘结果加上流速场中与该立方体对应的目标网格的格点记录的相对流速,将相加结果记录在该立方体对应的目标网格的格点上,以更新流速场中该立方体对应的目标网格的格点上记录的相对流速;其中,所述设定系数与立方体浸入三维液体的深度相关。
可选的,该液体仿真装置还可用于调用Compute Shade;
相应的,仿真结果绘制模块140可利用Compute Shade每隔设定数量帧更新所述高度场。
本发明实施例还提供一种液体交互装置,该液体交互装置可以认为是,CPU为实现本发明实施例提供的液体交互方法所需设置的程序模块。下文描述的液体交互装置可与上文描述的液体交互方法相互对应参照。
图16为本发明实施例提供的液体交互装置的结构框图,参照图16,该液体交互装置可以包括:
模型近似模块200,用于将交互体的模型使用立方体组进行近似,所述立方体组包括多个立方体;
高度场获取模块210,用于获取待仿真三维液体在二维网格中相应的高度场,其中,所述高度场对应有目标网格,所述目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且目标网格的各格点记录有所述待仿真三维液体相应的液面高度;
液面高度确定模块220,用于根据各立方体的水平位置坐标及所述高度场,确定各立方体对应的液面高度;
相互作用力确定模块230,用于根据各立方体对应的液面高度,确定所述待仿真三维液体与各立方体的相互作用力;
综合模块240,用于将所述待仿真三维液体与各立方体的相互作用力相综合,确定所述待仿真三维液体与交互体的相互作用力。
可选的,模型近似模块200,用于将交互体的模型使用立方体组进行近似,具体包括:
将交互体的模型周围空间划分成三维网格;
确定三维网格中位于交互体的模型内部的各格点;
根据位于交互体的模型内部的各格点生成对应的立方体,得到与交互体的模型近似的立方体组。
可选的,液面高度确定模块220,用于根据各立方体的水平位置坐标及所 述高度场,确定各立方体对应的液面高度,具体包括:
将各立方体的空间位置坐标中的水平位置坐标代入到所述高度场表示的函数关系中,确定各立方体的水平位置坐标相应的液面高度,得到各立方对应的液面高度;其中,所述高度场表示待仿真液体的二维的平面坐标与液面高度的函数关系。
可选的,相互作用力确定模块230,用于根据各立方体对应的液面高度,确定三维液体与各立方体的相互作用力,具体包括:
根据各立方体的垂直高度坐标,与对应的液面高度,确定各立方体浸入所述待仿真三维液体的深度;
根据各立方体浸入所述待仿真三维液体的深度,确定所述待仿真三维液体与各立方体的相互作用力。
可选的,该液体交互装置还可用于:获取流速场;所述流速场对应有目标网格,所述目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且各目标网格的格点上记录有与相邻格点的相对流速;
相应的,相互作用力确定模块230,用于根据各立方体浸入三维液体的深度,确定三维液体与各立方体的相互作用力,具体包括:
根据各立方体浸入所述待仿真三维液体的深度,确定各立方体浸入所述待仿真三维液体的体积;
根据各立方体浸入所述待仿真三维液体的体积,各立方体的速度,所述待仿真三维液体的速度确定所述待仿真三维液体与各立方体的相互作用力;其中,所述待仿真三维液体的速度由所述流速场确定,各立方体的速度由物理引擎确定。
可选的,综合模块240,用于将所述待仿真三维液体与各立方体的相互作用力相综合,确定所述待仿真三维液体与交互体的相互作用力,具体包括:
根据各立方体的中心空间坐标对应的相互作用力,确定交互体的模型与各立方体的中心空间坐标相应位置,所对应的相互作用力,得到所述待仿真三维液体与交互体的相互作用力。
可选的,所述待仿真三维液体与各立方体的相互作用力包括:所述待仿真三维液体对各立方体的作用力,以及,各立方体对所述待仿真三维液体的作用力。
可选的,该液体交互装置还可用于:将各立方体与所述待仿真三维液体的相对速度,各立方体浸入所述待仿真三维液体的深度传输给GPU,以便GPU更新流速场;其中,各立方体与所述待仿真三维液体的相对速度由所述待仿真三维液体的速度和各立方体的速度确定。
本发明实施例还提供一种实现液体仿真方法的仿真设备,该仿真设备的结构可类似图1所示,包括:存储器和GPU;
其中,存储器存储有程序,GPU调用所述程序,所述程序用于:
获取初始化信息;
根据所述初始化信息确定二维网格;
将待仿真三维液体的平面映射到所述二维网格中,确定所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格;
将待仿真三维液体的液面高度映射到所述二维网格中,在目标网格的各格点记录所述待仿真三维液体相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场;
根据所述高度场的更新,绘制三维液体,得到液体仿真结果。
该程序的功能实现细节,以及扩展功能可参照上文相应部分的描述。
本发明实施例还提供一种实现液体交互方法的仿真设备,该仿真设备的结构可类似图1所示,包括:存储器和CPU;
其中,存储器存储有程序,CPU调用所述程序,所述程序用于:
将交互体的模型使用立方体组进行近似,所述立方体组包括多个立方体;
获取待仿真液体在二维网格中相应的高度场,其中,所述高度场对应有目标网格,所述目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且目标网格的各格点记录有待仿真三维液体相应的液面高度;
根据各立方体的水平位置坐标及所述高度场,确定各立方体对应的液面高度;
根据各立方体对应的液面高度,确定三维液体与各立方体的相互作用力;
将三维液体与各立方体的相互作用力相综合,确定三维液体与交互体的相互作用力。
该程序的功能实现细节,以及扩展功能可参照上文相应部分的描述。
本发明实施例还提供一种存储介质,用于存储程序代码,该程序代码用于执行前述各个实施例所述的一种液体仿真方法中的任意一种实施方式,或者执行前述各个实施例所述的一种液体交互方法中任意一种实施方式。
本申请实施例还提供一种包括指令的计算机程序产品,当其在计算机上运行时,使得计算机执行前述各个实施例所述的一种液体仿真方法中的任意一种实施方式,或者执行前述各个实施例所述的一种液体交互方法中任意一种实施方式。
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现, 为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的核心思想或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。

Claims (19)

  1. 一种液体仿真方法,应用于图形处理器GPU,所述方法包括:
    获取初始化信息;
    根据所述初始化信息确定二维网格;
    将待仿真三维液体的平面映射到所述二维网格中,确定所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格;
    在所述目标网格的各格点记录所述待仿真三维液体的平面坐标相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场;
    根据所述高度场的更新,绘制三维液体,得到液体仿真结果。
  2. 根据权利要求1所述的液体仿真方法,所述根据所述高度场的更新,绘制三维液体,得到液体仿真结果包括:
    每隔设定数量帧更新所述高度场;
    每隔设定数量帧,根据更新的高度场绘制三维液体,得到液体仿真结果。
  3. 根据权利要求2所述的液体仿真方法,所述每隔设定数量帧,根据更新的高度场绘制三维液体,得到液体仿真结果包括:
    将待仿真三维液体对应的三维网格模型Mesh,划分成由多个三角形拼接的网格;
    每隔设定数量帧,根据更新的高度场对各三角形的各顶点的高度进行顶点偏移,得到各三角形的各顶点偏移后的顶点位置;
    每隔设定数量帧,根据各三角形的各顶点偏移后的顶点位置绘制三维液体,得到液体仿真结果。
  4. 根据权利要求3所述的液体仿真方法,所述将待仿真三维液体对应的三维网格模型Mesh,划分成由多个三角形拼接的网格包括:
    将待仿真三维液体对应的Mesh使用曲面细分技术,动态划分成由多个三角形拼接的网格;
    所述根据更新的高度场对各三角形的各顶点的高度进行顶点偏移,得到各三角形的各顶点偏移后的顶点位置包括:
    根据每隔设定数量帧更新的高度场记录的待仿真三维液体相应的液面高度,确定出划分成的各三角形的各顶点对应的液面高度;
    将各三角形的各顶点的高度与对应的液面高度相加,得到各三角形的各顶点偏移后的顶点位置。
  5. 根据权利要求2所述的液体仿真方法,所述方法还包括:
    确定目标网格的各格点与周围相邻格点之间的流动信息,得到待仿真三维液体在二维网格中相应的流速场;所述流动信息包括:各格点与周围相邻格点之间的相对流速;
    所述每隔设定数量帧更新所述高度场包括:
    每隔设定数量帧更新所述流速场;
    每隔设定数量帧,根据更新的流速场更新所述高度场。
  6. 根据权利要求5所述的水体仿真方法,所述每隔设定数量帧更新所述流速场包括:
    根据流体力学方程,每隔设定数量帧更新流速场;
    或者,获取交互体与三维液体交互情况下,近似交互体的各立方体与三维液体的相对速度,各立方体浸入三维液体的深度,每隔设定数量帧,根据各立方体与三维液体的相对速度,以及各立方体浸入三维液体的深度,更新流速场。
  7. 根据权利要求5所述的液体仿真方法,所述每隔设定数量帧,根据更新的流速场更新所述高度场包括:
    每隔设定数量帧,根据更新的流速场以及浅水方程算法SWE公式,更新高度场;
    其中,SWE公式表示的液面高度与相对流速的关系为:一个格点记录的液面高度的变化速率,与所记录的与相邻格点的相对流速反应的流出速度为负相关关系,一个格点所记录的与相邻格点的相对流速反应的流出速度,与该格点记录的液面高度和相邻格点记录的液面高度的高度差为正相关关系。
  8. 根据权利要求6所述的液体仿真方法,所述根据各立方体与三维液体的相对速度,以及各立方体浸入三维液体的深度,更新流速场包括:
    对于每一立方体,将立方体与三维液体的相对速度乘以设定系数,将相乘结果加上流速场中与该立方体对应的目标网格的格点记录的相对流速,将相加结果记录在该立方体对应的目标网格的格点上,以更新流速场中该立方体对应的目标网格的格点上记录的相对流速;其中,所述设定系数与立方体浸入三维液体的深度相关。
  9. 一种液体交互方法,应用于中央处理器CPU,所述方法包括:
    将交互体的模型使用立方体组进行近似,所述立方体组包括多个立方体;
    获取待仿真三维液体在二维网格中相应的高度场,其中,所述高度场对应有目标网格,所述目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且所述目标网格的各格点记录有所述待仿真三维液体相应的液面高度;
    根据各立方体的水平位置坐标及所述高度场,确定各立方体对应的液面高度;
    根据各立方体对应的液面高度,确定所述待仿真三维液体与各立方体的相互作用力;
    将所述待仿真三维液体与各立方体的相互作用力相综合,确定所述待仿真三维液体与交互体的相互作用力。
  10. 根据权利要求9所述的液体交互方法,所述将交互体的模型使用立方体组进行近似包括:
    将交互体的模型周围空间划分成三维网格;
    确定三维网格中位于交互体的模型内部的各格点;
    根据位于交互体的模型内部的各格点生成对应的立方体,得到与交互体的模型近似的立方体组。
  11. 根据权利要求9所述的液体交互方法,所述根据各立方体的水平位置坐标及所述高度场,确定各立方体对应的液面高度包括:
    将各立方体的空间位置坐标中的水平位置坐标代入到所述高度场表示的函数关系中,确定各立方体的水平位置坐标相应的液面高度,得到各立方对应的液面高度;其中,所述高度场表示待仿真液体的二维的平面坐标与液面高度的函数关系。
  12. 根据权利要求9所述的液体交互方法,所述根据各立方体对应的液面高度,确定所述待仿真三维液体与各立方体的相互作用力包括:
    根据各立方体的垂直高度坐标,与对应的液面高度,确定各立方体浸入所述待仿真三维液体的深度;
    根据各立方体浸入所述待仿真三维液体的深度,确定所述待仿真三维液体与各立方体的相互作用力。
  13. 根据权利要求12所述的液体交互方法,所述方法还包括:
    获取流速场;所述流速场对应有目标网格,所述目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且各目标网格的格点上记录有与相邻格点的相对流速;
    所述根据各立方体浸入所述待仿真三维液体的深度,确定所述待仿真三维液体与各立方体的相互作用力包括:
    根据各立方体浸入所述待仿真三维液体的深度,确定各立方体浸入所述待仿真三维液体的体积;
    根据各立方体浸入所述待仿真三维液体的体积,各立方体的速度,所述待仿真三维液体的速度确定所述待仿真三维液体与各立方体的相互作用力;其中,所述待仿真三维液体的速度由所述流速场确定,各立方体的速度由物理引擎确定。
  14. 一种液体仿真装置,应用于图形处理器GPU,包括:
    初始化信息获取模块,用于获取初始化信息;
    二维网格确定模块,用于根据所述初始化信息确定二维网格;
    平面映射模块,用于将待仿真三维液体的平面映射到所述二维网格中,确定所述待仿真三维液体的平面在所述二维网格中相应映射的目标网格;
    高度映射模块,用于在所述目标网格的各格点记录所述待仿真三维液体的平面坐标相应的液面高度,得到所述待仿真三维液体在所述二维网格中相应的高度场;
    仿真结果绘制模块,用于根据所述高度场的更新,绘制三维液体,得到 液体仿真结果。
  15. 一种液体交互装置,应用于中央处理器CPU,包括:
    模型近似模块,用于将交互体的模型使用立方体组进行近似,所述立方体组包括多个立方体;
    高度场获取模块,用于获取待仿真三维液体在二维网格中相应的高度场,其中,所述高度场对应有目标网格,所述目标网格为所述待仿真三维液体的平面在所述二维网格中相应映射的网格,且目标网格的各格点记录有所述待仿真三维液体相应的液面高度;
    液面高度确定模块,用于根据各立方体的水平位置坐标及所述高度场,确定各立方体对应的液面高度;
    相互作用力确定模块,用于根据各立方体对应的液面高度,确定所述待仿真三维液体与各立方体的相互作用力;
    综合模块,用于将所述待仿真三维液体与各立方体的相互作用力相综合,确定所述待仿真三维液体与交互体的相互作用力。
  16. 一种液体仿真设备,所述液体仿真设备包括:存储器和GPU;
    其中,所述存储器用于存储程序代码,并将所述程序代码传输给所述GPU;
    所述GPU用于根据所述程序代码中的指令执行权利要求1-8任一项所述的液体仿真方法。
  17. 一种液体交互设备,所述液体交互设备包括:存储器和CPU;
    其中,所述存储器用于存储程序代码,并将所述程序代码传输给所述CPU;
    所述CPU用于根据所述程序代码中的指令执行权利要求9-13任一项所述的液体交互方法。
  18. 一种存储介质,所述存储介质用于存储程序代码,所述程序代码用于执行权利要求1-8任一项所述的液体仿真方法,或者,权利要求9-13任一项所述的液体交互方法。
  19. 一种包括指令的计算机程序产品,当其在计算机上运行时,使得所述计算机执行权利要求1-8任一项所述的液体仿真方法,或者,权利要求9-13任一项所述的液体交互方法。
PCT/CN2018/101329 2017-09-13 2018-08-20 一种液体仿真方法、液体交互方法及装置 WO2019052313A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/601,736 US11062513B2 (en) 2017-09-13 2019-10-15 Liquid simulation method, liquid interaction method and apparatuses

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710823492.8A CN109509243B (zh) 2017-09-13 2017-09-13 一种液体仿真方法、液体交互方法及装置
CN201710823492.8 2017-09-13

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/601,736 Continuation US11062513B2 (en) 2017-09-13 2019-10-15 Liquid simulation method, liquid interaction method and apparatuses

Publications (1)

Publication Number Publication Date
WO2019052313A1 true WO2019052313A1 (zh) 2019-03-21

Family

ID=65723236

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/101329 WO2019052313A1 (zh) 2017-09-13 2018-08-20 一种液体仿真方法、液体交互方法及装置

Country Status (3)

Country Link
US (1) US11062513B2 (zh)
CN (1) CN109509243B (zh)
WO (1) WO2019052313A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112214921A (zh) * 2020-10-27 2021-01-12 上海工程技术大学 一种基于应力矢量的三维边坡稳定性评价方法
CN112446942A (zh) * 2020-11-09 2021-03-05 北京达佳互联信息技术有限公司 特效渲染方法、装置、电子设备及存储介质

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109598777B (zh) * 2018-12-07 2022-12-23 腾讯科技(深圳)有限公司 图像渲染方法、装置、设备及存储介质
CN112044077B (zh) * 2020-09-02 2022-02-11 北京冰封互娱科技有限公司 水体配置方法、装置、设备和存储介质
CN112862942B (zh) * 2021-02-08 2024-04-09 腾讯科技(深圳)有限公司 物理特效模拟方法、装置、电子设备和存储介质
CN112926252B (zh) * 2021-02-09 2024-03-26 北京工业大学 液体与布料交互现象模拟方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102870087A (zh) * 2010-04-30 2013-01-09 埃克森美孚上游研究公司 流体有限体积仿真的方法和系统
CN104268943A (zh) * 2014-09-28 2015-01-07 北京航空航天大学 一种基于欧拉-拉格朗日耦合方法的流体仿真方法
CN104778754A (zh) * 2015-03-10 2015-07-15 复旦大学 水下目标动态尾迹与流体微元轨道速度的数值仿真方法
CN106202806A (zh) * 2016-07-25 2016-12-07 西南科技大学 一种用于虚拟实验的液体柱模拟方法
US20170124679A1 (en) * 2015-11-02 2017-05-04 Nvidia Corporation Latency-resistant sparse simulation technique, system and method

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001109910A (ja) * 1999-10-14 2001-04-20 Fuji Photo Film Co Ltd 画像処理装置及び画像撮影装置
WO2003044720A1 (en) * 2001-11-15 2003-05-30 Nintendo Software Technology Corporation System and method of simulating and imaging realistic water surface
JP3853329B2 (ja) * 2004-03-31 2006-12-06 株式会社コナミデジタルエンタテインメント ゲームプログラム及びゲーム装置
US8204725B1 (en) * 2008-07-25 2012-06-19 Nvidia Corporation Real-time breaking waves for shallow water simulations
US8638330B1 (en) * 2009-10-28 2014-01-28 Google Inc. Water surface generation
US20180031719A1 (en) * 2016-07-29 2018-02-01 Hao Huang Method and System for Generating a Subsurface Model
CN106446425A (zh) * 2016-09-29 2017-02-22 华东师范大学 一种基于视频重建与sph模型的流固交互仿真方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102870087A (zh) * 2010-04-30 2013-01-09 埃克森美孚上游研究公司 流体有限体积仿真的方法和系统
CN104268943A (zh) * 2014-09-28 2015-01-07 北京航空航天大学 一种基于欧拉-拉格朗日耦合方法的流体仿真方法
CN104778754A (zh) * 2015-03-10 2015-07-15 复旦大学 水下目标动态尾迹与流体微元轨道速度的数值仿真方法
US20170124679A1 (en) * 2015-11-02 2017-05-04 Nvidia Corporation Latency-resistant sparse simulation technique, system and method
CN106202806A (zh) * 2016-07-25 2016-12-07 西南科技大学 一种用于虚拟实验的液体柱模拟方法

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112214921A (zh) * 2020-10-27 2021-01-12 上海工程技术大学 一种基于应力矢量的三维边坡稳定性评价方法
CN112214921B (zh) * 2020-10-27 2022-02-18 上海工程技术大学 一种基于应力矢量的三维边坡稳定性评价方法
CN112446942A (zh) * 2020-11-09 2021-03-05 北京达佳互联信息技术有限公司 特效渲染方法、装置、电子设备及存储介质
CN112446942B (zh) * 2020-11-09 2023-12-19 北京达佳互联信息技术有限公司 特效渲染方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN109509243B (zh) 2022-11-11
US20200043230A1 (en) 2020-02-06
US11062513B2 (en) 2021-07-13
CN109509243A (zh) 2019-03-22

Similar Documents

Publication Publication Date Title
WO2019052313A1 (zh) 一种液体仿真方法、液体交互方法及装置
US11010509B2 (en) Systems and methods for computer simulation of detailed waves for large-scale water simulation
US7586489B2 (en) Method of generating surface defined by boundary of three-dimensional point cloud
US20210383599A1 (en) Graphics processing using directional representations of lighting at probe positions within a scene
EP2973423B1 (en) System and method for display of a repeating texture stored in a texture atlas
US11436800B2 (en) Interactive system and method providing real-time virtual reality visualization of simulation data
US20080319722A1 (en) Water Particle Manipulation
JPH10302079A (ja) 立体テクスチャマッピング処理装置及びそれを用いた3次元画像生成装置
KR20150093689A (ko) 쉘 메쉬에 기초한 최적화된 다각형을 형성하기 위한 방법
CN106157357B (zh) 一种基于gpu加速的动态光效实现方法及系统
CN110555234B (zh) 一种Web端实时交互洪水演进仿真可视化方法
EP3179390A1 (en) Method and apparatus for modeling movement of air bubble based on fluid particles
CN106355631A (zh) 虚拟现实中实时阴影的显示方法
CN115906703A (zh) 一种用于实时交互应用的gpu流体仿真方法
CN110706149A (zh) 一种闪电粒子的渲染方法及装置
CN115099025A (zh) 在流体模型中计算流体流速的方法、电子设备及存储介质
KR20080098871A (ko) 유체유동 표현 방법 및 그 장치
CN109427084A (zh) 一种地图显示方法、装置、终端及存储介质
CN114676616A (zh) 一种三维场景下流体风场图渲染方法
CN114912303A (zh) 三维流体的展示方法、装置、电子设备及存储介质
CN110738719A (zh) 一种基于视距分层优化的Web3D模型渲染方法
Ottosson Real-time interactive water waves
Kellomäki Rigid body interaction for large-scale real-time water simulation
KR100684558B1 (ko) 텍스쳐 밉매핑 장치 및 방법
CN111506680B (zh) 地形数据生成、渲染方法及装置、介质、服务器、终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18856525

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18856525

Country of ref document: EP

Kind code of ref document: A1