A marine flow field simulation visualization method based on pre-baking and multi-phase dynamic sampling
By using the Gerstner wave model and multi-phase dynamic sampling technology, high-precision wave maps are generated, which solves the problems of insufficient three-dimensional details and high computational cost in traditional ocean flow field visualization methods. This achieves high-fidelity and smooth visualization of ocean flow fields, improving visual effects and real-time performance.
Patent Information
- Application Number
- CN202511329391.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-17
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-09-17
AI Technical Summary
Traditional ocean current field visualization methods suffer from insufficient representation of three-dimensional details, monotonous visual effects, high computational costs, and difficulty in capturing the dynamic characteristics of multiple wave components, resulting in unrealistic visual effects and insufficient real-time performance.
The Gerstner wave model is used to calculate multiple sets of superimposed wave textures offline. Combined with Jacobi matrix analysis of local deformation, multi-scale high-precision wave maps are generated. High-fidelity and smooth visualization of ocean current fields is achieved through multi-phase dynamic sampling and pre-baking technology.
It improves the realism and continuity of ocean current field visualization, reduces computational overhead, and provides an immersive interactive experience, making it suitable for ship navigation assistance and marine environmental monitoring.
Smart Images

Figure CN120822260B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of marine science and engineering technology, specifically to a method for simulating and visualizing ocean current fields based on pre-baking and multi-phase dynamic sampling. Background Technology
[0002] Ocean currents are one of the core elements of ocean dynamics. Through simulation and visualization, scientists can simulate various complex flow field phenomena in the ocean, such as the formation, movement, and interaction of ocean currents. With the help of simulation and visualization, the complex three-dimensional flow field structure of ocean currents can be clearly displayed, which helps to understand ocean dynamic processes.
[0003] Traditional methods for visualizing ocean current fields suffer from insufficient three-dimensional detail of the sea surface and monotonous visual effects, making it difficult to meet the demands for high-quality ocean current field visualization in fields such as ship navigation assistance, marine environmental monitoring, and immersive simulation. Specifically, the following technical problems exist:
[0004] 1. Traditional flow field visualization methods lack sufficient representation of the three-dimensional details of the sea surface, resulting in a relatively simple visual effect and a lack of subtle ripple effects and local dynamic features, leading to an overall visual effect that is not realistic enough;
[0005] 2. When processing fluid motion transitions, traditional flow mapping technology often results in discontinuous jumps or stretching of textures, leading to breakpoints or stretching distortion, which affects the continuity and realism of flow field visualization and disrupts the natural transition effect of the flow field.
[0006] 3. Traditional methods require a large number of wavefront deformation calculations during real-time rendering, resulting in huge computational overhead, making it difficult to meet real-time requirements and affecting the interactive experience;
[0007] 4. In actual ocean current fields, waves are often composed of superposition of waves with multiple frequencies, amplitudes and directions. Traditional methods are difficult to capture the dynamic characteristics of multiple wave components at the same time, resulting in an insufficiently complex and realistic representation of sea surface morphology.
[0008] To address the aforementioned issues, this invention proposes a method for simulating and visualizing ocean flow fields based on pre-baking and multi-phase dynamic sampling. It generates high-precision wave textures through offline pre-baking technology and combines this with a multi-phase dynamic sampling strategy to enhance the realism, continuity, and real-time performance of flow field visualization. Summary of the Invention
[0009] The purpose of this invention is to provide a method for simulating and visualizing ocean current fields based on pre-baking and multi-phase dynamic sampling, so as to solve the problems mentioned in the background art.
[0010] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0011] A method for simulating and visualizing ocean current fields based on pre-baking and multi-phase dynamic sampling includes the following steps:
[0012] Step 1: Use the Gerstner wave model to calculate multiple sets of wave superposition textures offline, determine the final displacement, and obtain the surface waveform simulation results based on Gerstner waves;
[0013] Step 2: Analyze the degree of local deformation of the water surface through the Jacobian matrix, determine the position of the wave crest and calculate the foam intensity, enhance the visual effect of wave breaking, and generate a multi-scale high-precision wave map containing wave height, normal and foam intensity data.
[0014] Step 3: The flow field data is split into multiple phase layers according to motion characteristics, and sampled and mixed separately in each rendering frame to provide an independent vector information source for dynamic sampling;
[0015] Step 4: Combine flow field velocity, time offset and spatial position to calculate UV coordinates at each time point and each sampling position to achieve continuous sampling and dynamic updating of wave texture;
[0016] Step 5: Extract the normals, heights, and foam intensities of different phase layers from the texture, perform sea surface morphology calculation through weighted mixing, generate the final water surface calculation result, and achieve multi-frequency wave overlay effect;
[0017] Step 6: During the real-time rendering stage, pre-baked textures are dynamically invoked and combined with the water surface solution results obtained by weighted blending to perform high-fidelity and smooth ocean flow field visualization.
[0018] A further improvement to the technical solution of the present invention is that step 1 specifically includes:
[0019] Based on the Gerstner wave model, parameters are set for each wave, including amplitude, wave vector, angular frequency, initial phase and wave steepness parameters, and the horizontal and vertical displacements of each water particle under the action of the wave are calculated.
[0020] For each wave, the corresponding wave phase is calculated. Multiple independent Gerstner waves are synthesized. The wave phase and displacement contribution of each wave are calculated separately. The displacements of all waves at each point are superimposed to obtain the final displacement. Through multi-wave synthesis, a complex and realistic water surface undulation effect is presented.
[0021] A further improvement to the technical solution of the present invention is that the process of obtaining the final displacement is as follows:
[0022] Let the initial position on the water surface be... Water particles, under the influence of waves, change their new positions. Composed of horizontal and vertical displacements, water particles undergo periodic motion along the wave propagation direction. Their trajectories are described as circular (or elliptical) motions, and their wave phase is defined as:
[0023] ;
[0024] in, The wave phase is represented by the angle between the wave vector and the horizontal plane, and k is the wave vector, describing the direction of wave propagation and the wave's direction of propagation. Angular frequency, Let t be the initial phase and t be the time.
[0025] According to the Gerstner wave model, the horizontal displacement of water particles along the wave propagation direction is defined as:
[0026] ;
[0027] ;
[0028] Where A is the wave amplitude and Q is the wave steepness parameter (satisfying 0) <Q≤1), Let the magnitude of the wave vector be . and These are the components of the wave vector k in the x and y directions;
[0029] To generate distinct peaks and troughs, the vertical displacement is calculated using a sine function:
[0030] ;
[0031] Among them, when When, it reaches its maximum increase value, and when When the time is right, the minimum value is reached;
[0032] Under the influence of a single Gerstner wave, the new position of each water particle is:
[0033] ;
[0034] Suppose there are M independent waves, each with parameters including amplitude. Wave vector angular frequency Initial phase and wave steepness parameters For each wave, calculate the corresponding wave phase:
[0035] ;
[0036] This allows us to obtain the contribution of each wave to the horizontal and vertical displacements. The displacements at each point are then superimposed to obtain the final displacement, as follows:
[0037] .
[0038] A further improvement to the technical solution of the present invention is that step 2 specifically includes:
[0039] The partial derivatives of the displacement transformation of the water surface are calculated to construct the Jacobian matrix. The Jacobian matrix reflects the local linear transformation relationship of the water surface from its original position to its deformed position. The partial derivatives of the displacement function of each water particle with respect to x and y are calculated to obtain the four elements of the Jacobian matrix.
[0040] The degree of local deformation of the water surface is quantified by the determinant of the Jacobian matrix, and the compression or stretching of local areas is analyzed. The degree of local deformation of the water surface is determined by the Jacobian determinant value of each water particle position, and the area where white foam appears at the crest of the wave is initially located. Based on the value of the Jacobian determinant, a foam intensity function is defined. When the Jacobian determinant value is significantly less than 1, it indicates that there is significant compression in the local area. When the determinant value is close to 1, it indicates that there is no significant compression in the local area and the foam intensity tends to 0. Then, the foam intensity of each water particle position is calculated and stored in the Alpha channel of the pre-baked texture. During rendering, the white foam effect is superimposed on the crest area according to the foam intensity, thereby enhancing the visual effect of the breaking waves.
[0041] Based on wave displacement results, the water surface normal vector is calculated through local partial derivatives. The tangent vector is obtained by taking partial derivatives in the x and y directions respectively. After cross product and normalization, the unit normal is obtained, which enhances the realism of light reflection. Wave height, normal components and foam intensity data are integrated into an RGBA texture map. The R channel records the normal component of the wave surface in the x direction, the G channel records the normal component of the wave surface in the y direction, the B channel stores the wave height information, and the A channel stores the foam intensity data, which represents the distribution of white foam at the wave crest. Then, a multi-scale texture is generated through pre-baking technology.
[0042] A further improvement to the technical solution of this invention lies in: Let the two-dimensional coordinates of each point on the water surface in the initial state be p. After displacement transformation by Gerstner waves, the foam intensity at the new position is denoted as... , for mapping Find the partial derivative, i.e., construct the Jacobian matrix:
[0043] ;
[0044] The Jacobian matrix reflects a local linear approximation from the original horizontal position to the deformed horizontal position, and its determinant is: This describes the scaling of a local area. A value less than 1 indicates that the region has undergone compression. To visually represent the local concentration of energy and wave breaking phenomena in the flow field, foam strength... Defined as a function of the degree of regional compression, the specific formula is:
[0045] ;
[0046] Among them, when When the strength approaches 1, there is no significant compression in local areas, and the foam strength tends to 0. When the value is significantly less than 1, it indicates that a significant compression has occurred in a local area. At this time, the foam strength increases, thus creating a stronger white foam effect in that area.
[0047] A further improvement to the technical solution of the present invention is that step 3 specifically includes:
[0048] The flow field data is divided into multiple phase layers according to motion characteristics. Each phase layer corresponds to a different flow field motion state and time offset, providing an independent vector information source for dynamic sampling. Among them, a periodic function is defined to analyze the time offset, ensuring that the phase of the data gradually shifts over time. Through the multi-phase offset design, the data phases in each cycle are staggered, avoiding excessive repetition or distortion of sample data between different time points.
[0049] Within each rendering frame, different phase layers are sampled separately. Based on the current time point and flow field velocity, the sampling position of each phase layer is calculated, and the corresponding vector information is obtained from the pre-baked wave texture. Through multi-phase sampling, the breakpoint or stretching distortion problems that occur during the fluid motion transition process in traditional single-phase sampling are avoided.
[0050] The sampling results of different phase layers are weighted and mixed, and the weight value of each time offset point is calculated using the cosine interpolation weight calculation method. Based on the time offset and weight allocation strategy, the vector information of each phase layer is fused to generate the final flow field vector field, ensuring that the mapping of the flow field vector information on the sea surface texture remains coherent and smooth.
[0051] A further improvement to the technical solution of the present invention is that step 4 specifically includes:
[0052] Initialize the UV coordinates based on the spatial position of the current sampling point. At the same time, obtain the flow field velocity and time offset. The flow field velocity determines the flow direction and speed of the texture, and the time offset is used to simulate the changes of the texture over time, ensuring that the texture sampling can dynamically reflect the changes in time and space.
[0053] Based on the flow field velocity, time offset, and weight allocation mechanism, the UV offset at each time point is calculated. The calculated dynamic UV offset is then added to the initial UV coordinates to obtain the final dynamic UV coordinates. The dynamic UV coordinates are used to sample from the pre-baked wave texture, so that the texture information of each sampling point is dynamically updated as time and flow field velocity change.
[0054] A further improvement to the technical solution of this invention lies in the following: For multi-phase sampling, each sampling point needs to correspond to a different time offset (phase), and the UV coordinates of each sampling point need to be dynamically updated according to the velocity of the flow field and the current position. The formula for calculating the dynamic UV coordinates is as follows:
[0055] ;
[0056] in, These are the dynamic UV coordinates calculated at each time offset stage; It is a periodic function, namely a time offset function, used to simulate the UV offset at different time phases, and can ensure that the UV coordinates of each phase change with time. The velocity vector of the flow field is affected by the change in UV coordinates as the flow field is dynamically sampled. is the spatial coordinate position, i.e., the initial UV coordinates, representing the origin of texture sampling; L is the scaling factor of the wave texture, which is often related to the wavelength of the wave and controls the scale of the wave texture coordinates. It is a constant offset, which is key to ensuring the dynamic phase is maintained in the zero-velocity region, where: .
[0057] A further improvement to the technical solution of the present invention is that step 5 specifically includes:
[0058] Within each rendering frame, the normal, height, and foam intensity data of different phase layers are extracted from the pre-baked wave texture, and the texture data corresponding to each phase layer is obtained through dynamic UV coordinate sampling.
[0059] The planar normal components of the water surface in a local area are obtained by calculating the derivative of the normal. Based on the wave height information, spatial vertical offset calculation is performed to realize the dynamic deformation of the water surface vertices in the world coordinate system. The foam intensity is extracted from the texture to add visual effects of white foam or surging to the surface details. Then, the data are integrated with the additional normal synthesis, world space offset and foam enhancement to generate the final water surface solution. The final result is used for real-time rendering to realize the multi-frequency wave superposition effect, so that the sea surface presents rich, delicate and realistic dynamic changes.
[0060] A further improvement to the technical solution of the present invention is that step 6 specifically includes:
[0061] The synthesized water surface solution is passed to the rendering pipeline for final high-fidelity rendering.
[0062] The calculated normal information is used for lighting calculations to enhance the three-dimensionality and realism of the water surface. Ambient light, diffuse light, and specular light are analyzed, and then these three types of light are added together to obtain the final lighting result. Ambient light provides the basic lighting for the entire scene and is obtained by multiplying the ambient light reflectivity of the material by the ambient light intensity. Diffuse light is calculated based on the normal direction and the direction of the light source. Specular light is calculated based on the normal direction, the direction of the light source, and the viewing direction.
[0063] Based on the spatial vertical offset to present the undulating dynamics of waves, the vertex shader passes the vertex position to the fragment shader to calculate the final position of each pixel. Combined with the foam intensity, a white foam effect is superimposed on the wave crest area. In the fragment shader, the color and transparency are adjusted according to the foam intensity value to enhance the visual effect of the wave crest area and further improve the visual effect. Through an efficient rendering process, the visualization of ocean currents runs smoothly at high frame rates, providing users with an immersive visual experience.
[0064] Due to the adoption of the above technical solution, the technical progress achieved by this invention compared to the prior art is as follows:
[0065] This invention provides a method for simulating and visualizing ocean flow fields based on pre-baking and multi-phase dynamic sampling. By cosine-weighted mixing of the sampling results of multiple phases, it effectively eliminates the jump and flow discontinuity problems that may still occur in the phase superposition region of double sampling, so that the texture can achieve a smooth transition throughout the entire cycle, enhancing the naturalness of the sea surface flow and the continuity of the rendering.
[0066] This invention provides a method for simulating and visualizing ocean current fields based on pre-baking and multi-phase dynamic sampling. In the process of generating multi-layer wave textures, wave height sampling accurately reflects the amplitude of wave undulations, providing macroscopic change information for sea surface morphology. Normal sampling captures sufficient local details, making lighting calculations more realistic. Foam sampling closely corresponds to the actual wave state, naturally superimposing the foam effect at the wave crest, greatly enhancing the richness and realism of visual details. Through offline pre-baking technology, multi-layer wave textures and sampling information are pre-calculated and stored. During real-time rendering, only the pre-baking results need to be dynamically called, which ensures high-fidelity visual performance and significantly reduces runtime computational overhead.
[0067] This invention provides a method for simulating and visualizing ocean current fields based on pre-baking and multi-phase dynamic sampling. The multi-phase dynamic sampling and texture blending technology not only solves the visual defects caused by abrupt changes in traditional periodic sampling, but also enables deep integration of current field data and sea surface dynamics at both the visual and logical levels. With the help of pre-baked multi-scale high-precision wave maps, current field vector information can be seamlessly mapped onto delicate sea surface textures, realizing a realistic presentation of the synchronous changes in ocean current movement, eddy characteristics, and wave undulations. At the same time, real-time rendering efficiency is guaranteed, and a smooth interactive experience can be provided at high frame rates. This invention breaks through the bottlenecks of existing ocean visualization in terms of continuity, realism, and interactivity, and is of great significance for improving the application value of scenarios such as ship navigation assistance, marine environmental monitoring, and immersive simulation display. Attached Figure Description
[0068] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0069] Figure 1 The above are simulation diagrams of a single Gerstner wave function of the present invention, wherein (a) is a wave texture diagram of a single Gerstner wave function, and (b) is a simulation diagram of a single Gerstner wave function;
[0070] Figure 2 The images shown are the combined results of multiple Gerstner waves in this invention, where (c) is the texture image after combining multiple Gerstner waves, and (d) is the simulation result image after combining multiple Gerstner waves.
[0071] Figure 3 This is a graph showing the calculation results of the wave crest foam strength according to the present invention;
[0072] Figure 4 This is a diagram showing the calculation results of the wave normal in this invention;
[0073] Figure 5 This is the multi-phase improved weight allocation diagram of the present invention;
[0074] Figure 6 This is a wave texture sampling result image of the present invention, wherein (e) is the wave height sampling result image, (f) is the normal sampling result image, and ( ( ) is a diagram of the foam sampling results. Detailed Implementation
[0075] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0076] Example 1, such as Figures 1 to 6 As shown, this invention provides a method for simulating and visualizing ocean current fields based on pre-baking and multi-phase dynamic sampling, comprising the following steps:
[0077] Step 1: Using the Gerstner wave model, multiple sets of wave superposition textures are calculated offline to determine the final displacement and obtain the surface waveform simulation results based on the Gerstner wave. According to the Gerstner wave model, parameters are set for each wave, including amplitude, wave vector, angular frequency, initial phase and wave steepness parameters. The horizontal and vertical displacements of each water particle under the action of the wave are calculated. For each wave, the corresponding wave phase is calculated. Multiple independent Gerstner waves are synthesized. The wave phase and displacement contribution of each wave are calculated separately. The displacements of all waves at each point are superimposed to obtain the final displacement. Through the multi-wave synthesis method, a complex and realistic water surface undulation effect is presented, so that the motion trajectory of each water particle can retain the periodicity characteristics of a single wave and comprehensively reflect the interference effect produced by the superposition of multiple waves, thus forming a delicate and rich sea surface morphology.
[0078] Furthermore, the process of obtaining the final displacement is as follows:
[0079] Let the initial position on the water surface be... Water particles, under the influence of waves, change their new positions. Composed of horizontal and vertical displacements, water particles undergo periodic motion along the wave propagation direction. Their trajectories are described as circular (or elliptical) motions, and their wave phase is defined as:
[0080] ;
[0081] in, The wave phase is represented by the angle between the wave vector and the horizontal plane, and k is the wave vector, describing the direction of wave propagation and the wave's direction of propagation. Angular frequency, Let t be the initial phase and t be the time.
[0082] According to the Gerstner wave model, the horizontal displacement of water particles along the wave propagation direction is defined as:
[0083] ;
[0084] ;
[0085] Where A is the wave amplitude and Q is the wave steepness parameter (satisfying 0) <Q≤1), Let be the magnitude of the wave vector. and These are the components of the wave vector k in the x and y directions, and the magnitude of the horizontal displacement is determined by... Controlling and ensuring that water particles periodically deflect along the wave propagation direction on the horizontal plane;
[0086] To generate distinct peaks and troughs, the vertical displacement is calculated using a sine function:
[0087] ;
[0088] Among them, when When, it reaches its maximum increase value, and when When the time is right, the minimum value is reached;
[0089] Under the influence of a single Gerstner wave, the new position of each water particle is:
[0090] ;
[0091] In reality, ocean waves are often composed of waves of various frequencies, amplitudes, and directions. Therefore, it is necessary to synthesize multiple independent Gerstner waves to obtain a more realistic and complex water surface effect.
[0092] Suppose there are M independent waves, each with parameters including amplitude. Wave vector angular frequency Initial phase and wave steepness parameters For each wave, calculate the corresponding wave phase:
[0093] ;
[0094] This allows us to obtain the contribution of each wave to the horizontal and vertical displacements. The displacements at each point are then superimposed to obtain the final displacement, as follows:
[0095] ;
[0096] Step 2: Analyze the local deformation of the water surface using the Jacobian matrix to determine the wave crest position and calculate foam intensity, enhancing the visual effect of wave breaking. Generate a multi-scale, high-precision wave map containing wave height, normal, and foam intensity data. Calculate the partial derivatives of the water surface displacement transformation to construct the Jacobian matrix. The Jacobian matrix reflects the local linear transformation relationship of the water surface from its original position to its deformed position. Calculate the partial derivatives of the displacement function of each water particle with respect to x and y to obtain the four elements of the Jacobian matrix. The determinant of the Jacobian matrix represents the scaling of the local area; a smaller determinant value indicates a greater degree of tearing in that area. The larger the value, the easier it is to generate white foam. The determinant of the Jacobian matrix is used to quantify the degree of local deformation of the water surface, analyzing the compression or stretching of local areas. The degree of local deformation of the water surface is determined by calculating the Jacobian determinant value at each water particle location, initially locating the areas where white foam appears at the crests. Based on the value of the Jacobian determinant, a foam intensity function is defined. When the Jacobian determinant value is significantly less than 1, it indicates significant compression in the local area; when the determinant value is close to 1, it indicates no significant compression in the local area, and the foam intensity tends to 0. The foam intensity at each water particle location is then calculated and stored in the Alpha of the pre-baked texture. In the rendering process, a white foam effect is superimposed on the wave crest area based on the foam intensity, thereby enhancing the visual effect of wave breaking. Based on the wave displacement results, the water surface normal vector is calculated through local partial derivatives. The tangent vector is obtained by taking partial derivatives with respect to the x and y directions, and then normalized after cross product to obtain the unit normal, which enhances the realism of light reflection. The wave height, normal components, and foam intensity data are integrated into the RGBA texture map. The R channel records the normal components of the wave surface in the x direction, the G channel records the normal components of the wave surface in the y direction, the B channel stores the wave height information, and the A channel stores the foam intensity data to represent the distribution of white foam at the wave crest. Then, a multi-scale texture is generated through pre-baking technology to ensure consistent visual performance under different viewing angles and lighting conditions. The texture is directly called during real-time rendering to avoid repeated calculations, balancing high fidelity and running efficiency.
[0097] The calculation of the water surface normal vector is based on the local partial derivative of the Gerstner wave function, through the... and Taking the partial derivatives separately yields two tangent vectors, and then the unnormalized normal is calculated using their cross product:
[0098] ;
[0099] The contributions of each independent wave are accumulated and then normalized to N to obtain the unit normal vector of each water surface point. The calculation of the normal can fully reflect the local geometric details of the water surface caused by the wave, providing support for the lighting calculation in the real-time rendering stage.
[0100] Furthermore, in the real ocean, the white foam at the wave crest not only significantly enhances the visual realism of the water surface but also provides observers with a direct view of dynamic phenomena such as wave breaking and energy dissipation. It also makes the motion state of the flow field clearer. Sea surface simulations relying solely on the geometric undulations of waveforms are insufficient to fully express the detailed characteristics of intense local motion. When wave amplitude is extremely large or water particle motion is violent, local compression can lead to wave breaking or splashing, thus producing white foam. The appearance of white foam not only makes wave crests more prominent and layered but also effectively highlights energy concentration and changes in motion direction within the flow field, enhancing the intuitiveness of flow field visualization and the overall rendering effect. To determine the wave crest region and calculate foam intensity, a Jacobian matrix-based method is used to quantify the degree of local deformation of the water surface. The Jacobian determinant is used to calculate the tearing degree at the current point; the smaller the Jacobian determinant, the greater the tearing degree, thus generating foam.
[0101] Let p be the two-dimensional coordinates of each point on the water surface in the initial state. After the displacement transformation by the Gerstner wave, the foam intensity at the new position is denoted as p. , for mapping Find the partial derivative, i.e., construct the Jacobian matrix:
[0102] ;
[0103] The Jacobian matrix reflects a local linear approximation from the original horizontal position to the deformed horizontal position, and its determinant is: This describes the scaling of a local area. A value less than 1 indicates that the region has undergone compression. To visually represent the local concentration of energy and wave breaking phenomena in the flow field, foam strength... Defined as a function of the degree of regional compression, the specific formula is:
[0104] ;
[0105] Among them, when When the strength approaches 1, there is no significant compression in local areas, and the foam strength tends to 0. When the value is significantly less than 1, it indicates that a significant compression has occurred in a local area. At this time, the foam strength increases, thus creating a stronger white foam effect in that area.
[0106] Step 3: The flow field data is split into multiple phase layers according to motion characteristics. Each phase layer is sampled and blended separately within each rendering frame, providing an independent vector information source for dynamic sampling and resolving the single-phase transition distortion problem. The flow field data is split into multiple phase layers based on motion characteristics, with each phase layer corresponding to a different flow field motion state and time offset. A periodic function is defined to analyze the time offset, ensuring that the data phase gradually shifts over time. Through multi-phase offset design, the data phases within each period are staggered, avoiding excessive repetition or distortion of sample data between different time points. Within each rendering frame, different phase layers are sampled separately according to the current time... The sampling positions for each phase layer are calculated based on the time points and flow field velocities. Corresponding vector information is obtained from pre-baked wave textures. Multi-phase sampling avoids the discontinuities or stretching distortion problems that occur during fluid motion transitions in traditional single-phase sampling. The sampling results from different phase layers are weighted and mixed, and the weight value for each time offset is calculated using a cosine interpolation weighting method. Based on the time offset and weight allocation strategy, the vector information of each phase layer is fused to generate the final flow field vector field. This ensures that the mapping of flow field vector information on the sea surface texture remains coherent and smooth, enabling a true visual "adhesion" between ocean current motion and sea surface dynamics, improving the smoothness and realism of flow field visualization. This is achieved through periodic functions. To ensure that the phase of the data gradually shifts over time, a multi-phase offset design is used to stagger the phase of the data in each cycle, thus avoiding excessive repetition or distortion of sample data between different time points.
[0107] ;
[0108] In the formula, This is a periodic function used to describe time offset, ensuring that the phase of the data gradually shifts over time. Here, i represents different phase offsets, and t represents the time variable. This represents time from 0 to positive infinity. This indicates rounding down the time interval t, i.e., taking the largest integer not greater than t. This is used to stagger the phases of data within each period, so as to avoid excessive repetition or distortion of sample data between different time points;
[0109] This makes dynamic texture sampling more in line with the actual time evolution, appearing more natural and smooth in dynamic scenes. By adjusting the time offset of each sampling point, the fluidity and changes of the data are controlled, avoiding the tiling phenomenon caused by static textures.
[0110] Then, when merging multiple data sources, based on the time offset results, the cosine interpolation weight calculation method is used to calculate the weight value at each time offset point:
[0111] ;
[0112] In the formula, This is a weighting function used to reasonably allocate weights when merging multiple data sources, ensuring a smooth and natural data transition.
[0113] This allows the weight values to transition smoothly over time and ensures a proper mix of data from different time offsets. The weight function... It changes periodically. At each moment, the sum of the three weight values is always 1, thus ensuring that the total weight of the data remains consistent at each time point, thereby avoiding excessive superposition or data distortion. This allows the weight values to be smoothly adjusted according to the changes in time offset, thereby achieving a natural transition between data layers. It can effectively avoid the hard switching of traditional linear interpolation, making the integration between different data sources more delicate and coherent.
[0114] Step 4: Combine flow field velocity, time offset and spatial position to calculate the UV coordinates of each time point and each sampling position, realize continuous sampling and dynamic update of wave texture, and ensure the accuracy of texture mapping;
[0115] Step 5: Extract the normals, heights, and foam intensities of different phase layers from the texture, perform sea surface morphology calculation through weighted mixing, generate the final water surface calculation result, and achieve multi-frequency wave overlay effect;
[0116] Step 6: During the real-time rendering stage, pre-baked textures are dynamically invoked and combined with the water surface solution results obtained by weighted blending to perform high-fidelity and smooth ocean flow field visualization.
[0117] Example 2, as Figures 1 to 6 As shown, based on Embodiment 1, the present invention provides a technical solution: preferably, step 4 specifically includes:
[0118] Initialize the UV coordinates based on the spatial position of the current sampling point. At the same time, obtain the flow field velocity and time offset. The flow field velocity determines the flow direction and speed of the texture, and the time offset is used to simulate the change of the texture over time, ensuring that the texture sampling can dynamically reflect the changes in time and space. Based on the flow field velocity, time offset and weight allocation mechanism, calculate the UV offset at each time point, and then add the calculated dynamic UV offset to the initial UV coordinates to obtain the final dynamic UV coordinates. Use the dynamic UV coordinates to sample from the pre-baked wave texture, so that the texture information of each sampling point is dynamically updated with the changes in time and flow field velocity, thereby realizing continuous sampling and dynamic updating of the wave texture, ensuring the accuracy of texture mapping and the naturalness of visual effects.
[0119] Furthermore, for multi-phase sampling, each sampling point needs to correspond to a different time offset (phase). The UV coordinates of each sampling point need to be dynamically updated based on the flow field velocity and the current position. The formula for calculating the dynamic UV coordinates is as follows:
[0120] ;
[0121] in, These are the dynamic UV coordinates calculated at each time offset stage; It is a periodic function, namely a time offset function, used to simulate the UV offset at different time phases, and can ensure that the UV coordinates of each phase change with time. The velocity vector of the flow field is affected by the change in UV coordinates as the flow field is dynamically sampled. is the spatial coordinate position, i.e., the initial UV coordinates, representing the origin of texture sampling; L is the scaling factor of the wave texture, which is often related to the wavelength of the wave and controls the scale of the wave texture coordinates. It is a constant offset, which is key to ensuring the dynamic phase is maintained in the zero-velocity region, where: ;
[0122] The calculated UV coordinates change dynamically according to time and flow field velocity. The UV value of each sampling point is continuously updated over time. Then, by calculating the three UV coordinates at different time phases, the same texture area is sampled at the same time to obtain different wave characteristics. Since the pre-baked data of the wave texture already stores information about wave normals, foam intensity, and local wave height, the sampling process only needs to sample the texture with dynamic UV to obtain multi-dimensional wave attributes at the same time. This fully utilizes the temporal changes brought about by dynamic UV and avoids high-overhead real-time calculations of wave dynamics during runtime. As the flow field velocity and time progress, the three UV coordinates continuously change and continuously locate new sampling positions in the texture, making the waves present rich animation effects and temporal sequence.
[0123] Step 5 specifically includes:
[0124] Within each rendering frame, normal, height, and foam intensity data for different phase layers are extracted from the pre-baked wave texture. Dynamic UV coordinate sampling is used to obtain texture data corresponding to each phase layer. The planar normal components of the water surface in a local region are obtained through normal derivative calculation. Spatial vertical offset calculation is performed based on wave height information to achieve dynamic deformation of the water surface vertices in the world coordinate system. Foam intensity is extracted from the texture to add visual effects of white foam or churning to the surface details. These data are then integrated with additional normal composition, world space offset, and foam enhancement to generate the final water surface solution. The final result is used for real-time rendering to achieve a multi-frequency wave overlay effect, making the sea surface present rich, delicate, and realistic dynamic changes. For the planar normal components, since the pre-baked texture stores multiple wave information, three sets of normal components can be obtained by sampling the pre-baked texture three times. These are then further weighted and fused to form a more detailed composite wave normal. At each sampling point, the R and G channels of the texture each store the planar components of the local normal (denoted as...). ,in and (Representing three phases), ensuring the original values returned by texture sampling are within the interval [0,1] (corresponding to the range [0,255] for 8-bit sampling), where 0.5 (corresponding to 128) represents no offset. Inverse normalization is then applied to the planar components to obtain the correct normal direction. Then, we can analyze the wave's offset relative to the center:
[0125] ;
[0126] To visually simulate more realistic and controllable wave undulations, it is necessary to combine overall wave surface parameters (wave texture scaling factor L, wave height H, etc.) and coefficients. Scaling the wave's offset relative to the center and solving for the i-th phase yields... :
[0127] ;
[0128] in, L is the inversely normalized plane component; L is related to wavelength or texture scaling factor and is used to control the mapping relationship between texture coordinates and world coordinates of the wave surface; H is the wave height (or wave surface amplitude) parameter, which is used to amplify or reduce the micro-bumps provided by the texture, making the vertical undulation of the water surface more controllable. This is an empirical coefficient used to enhance or weaken local normals, resulting in sharper or smoother wave undulations.
[0129] To determine the wave characteristics of composite multi-phase systems, the weighting distribution results are used. (and Three normal lines , , Perform weighted mixing:
[0130] ;
[0131] By using a linear blending method, the contributions of the three phases to the local normal undulations are combined, ultimately yielding the normal result on the plane component. Then, it is fused with the vertical unit vector and normalized to obtain the final normal, thus showing a multi-frequency, multi-period wave superposition effect at the same position, which is convenient for the rendering pipeline to perform lighting calculations.
[0132] Corresponding to the spatial vertical offset, in the sampling of multi-phase wave textures, each texture sample provides local height information stored in the B channel, which is combined with the overall wave height parameter to dynamically change the vertical position of the water surface in the world coordinate system. In the synthesis stage, distance attenuation and normal scaling are further introduced to match the final effect with factors such as viewpoint distance and normal direction.
[0133] After sampling the texture three times, three sets of color values were obtained. ,in Corresponding to the three phases, channel B records the normalized height information of the local waves. Multiplying this information by the overall wave height parameter H yields the actual height contribution of that phase at the sampling point.
[0134] ;
[0135] To comprehensively consider the wave contributions of the three phases, a weighted method is used to linearly interpolate the height of each phase;
[0136] ;
[0137] The synthesis height At the current sampling point, the relative peak value of the water surface in the vertical direction after integrating multiple phases is used to convert the synthesized height value into the corresponding vertex (or fragment) displacement. This allows the water surface model to dynamically deform in world space, and then the final height is corrected to ensure that the peaks and troughs float up and down relative to the "average water surface," preventing the overall water surface from rising too high and maintaining a visually balanced range of fluctuation.
[0138] ;
[0139] When the water surface is not perfectly horizontal, scaling is required based on the vertical component of the local normal n to ensure a reasonable distribution of vertical undulations on the local sloping surface, thus correcting the offset magnitude. Simultaneously, in the actual rendering pipeline, an adjustable coefficient WPOScale is introduced to control the global intensity of the water surface offset. The final offset in world coordinates can be expressed as:
[0140] ;
[0141] For foam intensity extraction, in the pre-baked wave texture, the Alpha channel is used to record the local foam intensity to express the white foam effect when the waves break or the water surface surges. Through three samplings and weighted fusion, foam information of the wave surface at different phases can be obtained, and the foam can be enhanced or weakened by combining rendering parameters.
[0142] Similar to normals and heights, for the i-th sample ( The color value obtained from the texture Alpha channel This is the normalized value of foam intensity, which is located in the range of [0,1]. The value represents the probability or degree of foam generation on the local water surface. The closer it is to 1, the more obvious the foam is, and the closer it is to 0, the more stable the water surface is without foam.
[0143] To integrate foam information from multiple phases at the same sampling location, for each Perform weighted mixing,
[0144] ;
[0145] This ensures that the contribution of each phase to the foam characteristics is reasonably incorporated into the final mixing result, and that the foam values of different phases are... By corresponding to different peak states or flow field conditions, the process of "dynamic generation and destruction of bubbles" can be simulated more realistically in terms of time and space.
[0146] In real-world scenarios, to enhance visual impact or highlight the contrast between foam and water, the strength of the mixed foam needs to be appropriately increased or decreased. Therefore, a foam enhancement coefficient needs to be defined. And use it to amplify the bubble signal:
[0147] ;
[0148] The final result It can be passed to the rendering pipeline or materials as a foam channel to overlay foam textures in foam areas and produce visual effects such as surging waves;
[0149] Step 6 specifically includes:
[0150] The synthesized water surface calculation results are passed to the rendering pipeline for final high-fidelity rendering. The calculated normal information is used for lighting calculations to enhance the three-dimensionality and realism of the water surface. Ambient light, diffuse light, and specular light are analyzed and then added together to obtain the final lighting result. Ambient light provides the basic lighting for the entire scene, obtained by multiplying the material's ambient reflectivity and ambient light intensity. Diffuse light is calculated based on the normal direction and the light source direction. Specular light is calculated based on the normal direction, the light source direction, and the viewing direction. The undulating dynamics of the waves are presented based on the spatial vertical offset. In the vertex shader, the vertex position is passed to the fragment shader to calculate the final position of each pixel. Combined with foam intensity, a white foam effect is superimposed on the wave crest area. In the fragment shader, the color and transparency are adjusted based on the foam intensity value to enhance the visual effect of the wave crest area, further improving the overall visual experience. Through an efficient rendering process, the visualization of the ocean flow field runs smoothly at high frame rates, providing users with an immersive visual experience.
[0151] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for simulating and visualizing ocean current fields based on pre-baking and multi-phase dynamic sampling, characterized in that, Includes the following steps: Step 1: Use the Gerstner wave model to calculate multiple sets of wave superposition textures offline, determine the final displacement, and obtain the surface waveform simulation results based on Gerstner waves; Step 2: Analyze the degree of local deformation of the water surface using the Jacobian matrix, determine the position of the wave crest and calculate the foam intensity, and generate a multi-scale high-precision wave map containing wave height, normal and foam intensity data. Step 3: The flow field data is split into multiple phase layers according to motion characteristics, and sampled and blended separately within each rendering frame. Specifically, this includes: The flow field data is divided into multiple phase layers according to motion characteristics. Each phase layer corresponds to a different flow field motion state and time offset, providing an independent vector information source for dynamic sampling. In this process, a periodic function is defined to analyze the time offset, ensuring that the phase of the data gradually shifts over time. Within each rendering frame, different phase layers are sampled separately. Based on the current time point and flow field velocity, the sampling position of each phase layer is calculated, and the corresponding vector information is obtained from the pre-baked wave texture. The sampling results of different phase layers are weighted and mixed, and the weight value of each time offset point is calculated using the cosine interpolation weight calculation method. Based on the time offset and weight allocation strategy, the vector information of each phase layer is fused to generate the final flow field vector field. Step 4: Combine the flow field velocity, time offset, and spatial location to calculate the UV coordinates of each time point and each sampling location; Step 5: Extract the normals, heights, and foam intensities of different phase layers from the texture, and perform sea surface morphology calculation through weighted mixing to generate the final water surface calculation result, specifically including: Within each rendering frame, the normal, height, and foam intensity data of different phase layers are extracted from the pre-baked wave texture, and the texture data corresponding to each phase layer is obtained through dynamic UV coordinate sampling. The planar normal components of the water surface in a local region are obtained by solving the derivative of the normal. Based on the wave height information, the spatial vertical offset calculation is performed to realize the dynamic deformation of the water surface vertex in the world coordinate system. The foam intensity is extracted from the texture. Then, the data are integrated with the additional normal synthesis, world space offset and foam enhancement to generate the final water surface solution result. Step 6: During the real-time rendering stage, pre-baked textures are dynamically invoked and combined with the water surface solution results obtained by weighted blending to perform high-fidelity visualization of the ocean flow field.
2. The ocean current field simulation visualization method based on pre-baking and multi-phase dynamic sampling according to claim 1, characterized in that: Step 1 specifically includes: Based on the Gerstner wave model, parameters are set for each wave, including amplitude, wave vector, angular frequency, initial phase and wave steepness parameters, and the horizontal and vertical displacements of each water particle under the action of the wave are calculated. For each wave, the corresponding wave phase is calculated. Multiple independent Gerstner waves are synthesized. The wave phase and displacement contribution of each wave are calculated separately. The displacements of all waves at each point are superimposed to obtain the final displacement.
3. The ocean current field simulation visualization method based on pre-baking and multi-phase dynamic sampling according to claim 2, characterized in that: The process of obtaining the final displacement is as follows: Let the initial position on the water surface be... Water particles, under the influence of waves, change their new positions. Composed of horizontal and vertical displacements, water particles undergo periodic motion along the wave propagation direction, and its wave phase is defined as: ; in, The wave phase is represented by the angle between the wave vector and the horizontal plane, and k is the wave vector, describing the direction of wave propagation and the wave's direction of propagation. Angular frequency, Let t be the initial phase and t be the time. According to the Gerstner wave model, the horizontal displacement of water particles along the wave propagation direction is defined as: ; ; Where A is the wave amplitude and Q is the wave steepness parameter. Let the magnitude of the wave vector be . and These are the components of the wave vector k in the x and y directions; To generate distinct peaks and troughs, the vertical displacement is calculated using a sine function: ; Among them, when When, it reaches its maximum increase value, and when When the time is right, the minimum value is reached; Under the influence of a single Gerstner wave, the new position of each water particle is: ; Suppose there are M independent waves, each with parameters including amplitude. Wave vector angular frequency Initial phase and wave steepness parameters For each wave, calculate the corresponding wave phase: ; The contribution of each wave to the horizontal and vertical displacements is obtained, and the displacements of all waves at each point are superimposed to obtain the final displacement, as follows: 。 4. The ocean current field simulation visualization method based on pre-baking and multi-phase dynamic sampling according to claim 1, characterized in that: Step 2 specifically includes: The partial derivatives of the displacement transformation of the water surface are calculated to construct the Jacobian matrix. The Jacobian matrix reflects the local linear transformation relationship of the water surface from its original position to its deformed position. The partial derivatives of the displacement function of each water particle with respect to x and y are calculated to obtain the four elements of the Jacobian matrix. The degree of local deformation of the water surface is quantified by the determinant of the Jacobian matrix, and the compression or stretching of the local area is analyzed. The degree of local deformation of the water surface is determined by the Jacobian determinant value of each water particle position, the area where white foam appears at the crest of the wave is initially located, and the foam intensity function is defined according to the value of the Jacobian determinant. Then, the foam intensity of each water particle position is calculated and stored in the Alpha channel of the pre-baked texture. Based on the wave displacement results, the water surface normal vector is calculated through local partial derivatives. The tangent vector is obtained by taking partial derivatives with respect to the x and y directions, and then normalized after cross product to obtain the unit normal. The wave height, normal components, and foam intensity data are integrated into an RGBA texture map. The R channel records the normal components of the wave surface in the x direction, the G channel records the normal components of the wave surface in the y direction, the B channel stores the wave height information, and the A channel stores the foam intensity data. Then, a multi-scale texture is generated through pre-baking technology.
5. The ocean current field simulation visualization method based on pre-baking and multi-phase dynamic sampling according to claim 4, characterized in that: Let p be the two-dimensional coordinates of each point on the water surface in the initial state. After the displacement transformation by the Gerstner wave, the foam intensity at the new position is denoted as p. , for mapping Find the partial derivative, i.e., construct the Jacobian matrix: ; The Jacobian matrix reflects a local linear approximation from the original horizontal position to the deformed horizontal position, and its determinant is: This describes the scaling of a local area. A value less than 1 indicates that the area has undergone compression, and the foam strength... Defined as a function of the degree of regional compression, the specific formula is: ; Among them, when When the strength approaches 1, there is no significant compression in local areas, and the foam strength tends to 0. When the value is significantly less than 1, it indicates that significant compression has occurred in a local area, at which point the foam strength increases.
6. The ocean current field simulation visualization method based on pre-baking and multi-phase dynamic sampling according to claim 1, characterized in that: Step 4 specifically includes: Initialize the UV coordinates based on the spatial position of the current sampling point. At the same time, obtain the flow field velocity and time offset. The flow field velocity determines the flow direction and speed of the texture, and the time offset is used to simulate the change of the texture over time. Based on the flow field velocity, time offset, and weight allocation mechanism, the UV offset at each time point is calculated, and then the calculated dynamic UV offset is added to the initial UV coordinates to obtain the final dynamic UV coordinates.
7. The ocean current field simulation visualization method based on pre-baking and multi-phase dynamic sampling according to claim 6, characterized in that: For multi-phase sampling, corresponding to different time offsets, the UV coordinates of each sampling point need to be dynamically updated based on the flow field velocity and current position. The formula for calculating the dynamic UV coordinates is as follows: ; in, These are the dynamic UV coordinates calculated at each time offset stage; It is a periodic function, i.e., a time offset function; is the velocity vector of the flow field; is the spatial coordinate position, i.e., the initial UV coordinates, representing the origin of texture sampling; L is the scaling factor for the wave texture; It is a constant offset.
8. The ocean current field simulation visualization method based on pre-baking and multi-phase dynamic sampling according to claim 1, characterized in that: Step 6 specifically includes: The synthesized water surface solution is passed to the rendering pipeline for final high-fidelity rendering. The lighting calculation is performed using the calculated normal information. Ambient light, diffuse light and specular light are analyzed. Then, the ambient light, diffuse light and specular light are added together to obtain the final lighting result. Based on the spatial vertical offset to present the undulating dynamics of waves, in the vertex shader, the vertex position is passed to the fragment shader to calculate the final position of each pixel. Combined with the foam intensity, a white foam effect is superimposed in the wave crest area. In the fragment shader, the color and transparency are adjusted according to the foam intensity value to enhance the visual effect of the wave crest area, further improving the visual effect and enabling the visualization of ocean currents to run smoothly at high frame rates.
Citation Information
Patent Citations
Large-range dynamic wave real-time rendering method based on stream computing
CN104143207A
Hybrid screen space global illumination method based on resampling and probe
CN119559317A