Water body rendering method and device, equipment, storage medium and program product

By overlaying waveform and noise data into the water rendering method, dynamic vertex normal vectors and edge intensity data are generated, solving the problem of wave contour distortion and achieving dynamic and realistic water rendering effects.

CN121937602APending Publication Date: 2026-04-28GUANGZHOU SNAP FINGER UNIVERSE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511847894.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing water rendering methods use fixed water ripple maps, resulting in distorted wave contours, a lack of dynamic variation, and poor realism.

Method used

By superimposing periodic and continuous waveform data and noise data onto each vertex of the horizontal grid, a white wave model is generated. The model is then differentiated to obtain the composite gradient and vertex normal vector. Combined with the line of sight, edge intensity data is generated and finally superimposed onto the wave model for rendering.

Benefits of technology

Dynamic rendering of water wave contours was achieved, ensuring consistency in shape for each frame and enhancing the realism of the rendering effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121937602A_ABST
    Figure CN121937602A_ABST
Patent Text Reader

Abstract

The invention relates to a water body rendering method and device, equipment, a storage medium and a program product, and the method comprises the steps: superposing periodically continuous waveform data and noise data to all vertexes of a horizontal grid, and obtaining a wave pattern; coloring the wave white mold to obtain a wave model; respectively carrying out derivation processing on the waveform data and the noise data at each vertex in the wave pattern to obtain a first space gradient corresponding to the waveform data and a second space gradient corresponding to the noise data; performing composite processing on the first space gradient and the second space gradient to obtain a composite gradient of each vertex; obtaining a vertex normal vector of each vertex based on the composite gradient of each vertex; based on the vertex normal vector and the line-of-sight direction vector of each vertex, generating edge intensity data of the wave contour; and superposing the edge strength data to the wave model to obtain a water body rendering result. According to the scheme, the vertex normal vector is dynamically determined based on the composite gradient, so that the rendered water body has a dynamic surge effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of rendering technology, and in particular to water rendering methods, apparatus, equipment, storage media, and program products. Background Technology

[0002] Nowadays, water rendering is a key component in computer graphics applications such as games, virtual reality, and film and television special effects.

[0003] In related technologies, fixed water ripple maps are used to represent water surface details. Pre-made water ripple maps with fixed patterns and orientations are mapped onto the model surface. By sampling the maps, the ripples and lighting effects of the water surface are simulated. In addition, the generated water body outline depends on the general shape of the mesh model itself.

[0004] However, in the solutions provided by related technologies, the direction and texture space of the water ripple map are fixed in advance, resulting in distorted wave contours, lack of dynamic changes, and poor realism when rendered based on this. Summary of the Invention

[0005] This disclosure provides a water rendering method, apparatus, device, storage medium, and program product to at least solve the problems of distorted wave contours and lack of dynamic variation in related technologies. The technical solution of this disclosure is as follows: According to a first aspect of the present disclosure, a water body rendering method is provided, comprising: Periodic and continuous waveform data and noise data are superimposed on each vertex of a horizontal grid to obtain a white wave model; and the white wave model is then colored to obtain a wave model. The waveform data and the noise data at each vertex of the wave white model are respectively differentiated to obtain the first spatial gradient corresponding to the waveform data and the second spatial gradient corresponding to the noise data. The first spatial gradient and the second spatial gradient are combined to obtain the composite gradient of each vertex. Based on the composite gradient of each vertex, the vertex normal vector of each vertex is obtained; Based on the vertex normal vector and the view direction vector of each vertex, the edge intensity data of the wave profile is generated; the view direction vector is a vector pointing from the observation position to the vertex; The edge intensity data is superimposed onto the wave model to obtain the water body rendering result.

[0006] In one possible implementation, generating edge intensity data of the wave profile based on the vertex normal vector and the view direction vector of each vertex includes: The line-of-sight offset direction vector of each vertex is determined based on the line-of-sight direction vector. Based on the vertex normal vector and the view direction vector, generate the edge intensity data of the first edge layer; Based on the vertex normal vector and the view offset direction vector, edge intensity data for the second edge layer is generated; the edge intensity represented by the edge intensity data of the second edge layer is different from the edge intensity represented by the edge intensity data of the first edge layer. The edge intensity data of the first edge layer and the edge intensity data of the second edge layer are fused to obtain the edge intensity data of the wave profile.

[0007] In one possible implementation, generating edge intensity data for the first edge layer based on the vertex normal vector and the view direction vector includes: Perform a dot product operation on the vertex normal vector and the view direction vector to obtain the angle information between the vertex normal vector and the view direction vector of each vertex; Based on the included angle information, determine the basic edge strength data of each vertex; The edge strength data of the first edge layer is obtained by exponentiation of the basic edge strength data based on the preset edge sharpness parameter. The preset edge sharpness parameter is used to control the sharpness of the edge layer.

[0008] In one possible implementation, the method further includes: Obtain a noise map and read the noise intensity value at each vertex of the noise map; The step of fusing the edge intensity data of the first edge layer with the edge intensity data of the second edge layer to obtain the edge intensity data of the wave contour includes: Based on the noise intensity value, interpolation calculation is performed on the edge intensity data of the first edge layer and the edge intensity data of the second edge layer to obtain the edge intensity data of the wave profile, and the noise intensity value is used as the mixing coefficient for the interpolation calculation.

[0009] In one possible implementation, the composite processing of the first spatial gradient and the second spatial gradient to obtain the composite gradient of each vertex includes: Based on the composite gradient function, the first spatial gradient and the second spatial gradient are combined to obtain the composite gradient of each vertex. The composite gradient function is obtained by taking the derivative of the composite function, and the composite function is constructed based on the waveform data and the noise data.

[0010] In one possible implementation, before performing the composite gradient function on the first spatial gradient and the second spatial gradient, the method further includes: The noise data is squared to obtain the first sub-item; The noise data, the waveform data, and the preset coefficients are multiplied to obtain the second sub-item; The waveform data is identified as the third sub-item; The composite function is obtained by summing the first sub-item, the second sub-item, and the third sub-item.

[0011] In one possible implementation, before generating the edge intensity data of the wave profile based on the vertex normal vector and the view direction vector of each vertex, the method further includes: Based on the line-of-sight vector, a slant transformation is performed on each vertex and the vertex normal vector in the wave white model to obtain the wave white model after slant transformation and the vertex normal vector after slant transformation; the slant transformation is used to increase the angle between the vertex normal vector and the line-of-sight vector. The step of generating edge intensity data of the wave profile based on the vertex normal vector and the view direction vector of each vertex includes: generating the edge intensity data based on the vertex normal vector after the slant transformation and the view direction vector of each vertex after the slant transformation. The step of coloring the white wave model to obtain the wave model includes: coloring the white wave model after the slant transformation to obtain the wave model.

[0012] In one possible implementation, the step of performing a skewing transformation on each vertex and its vertex normal vector in the wave white model based on the view direction vector to obtain the skewing-transformed wave white model and its vertex normal vectors includes: The product of the horizontal component of the line-of-sight vector, the vertical component of the line-of-sight vector, and a preset slant factor is determined to obtain the slant transformation parameters; Generate a scissor transformation matrix based on the scissor transformation parameters; Based on the skewing transformation matrix, a skewing transformation is performed on each vertex of the wave white model to obtain the wave white model after the skewing transformation. Based on the slant transformation matrix, the vertex normal vectors of each vertex are subjected to slant transformation to obtain the slant-transformed vertex normal vectors.

[0013] In one possible implementation, the waveform data is obtained by superimposing at least two layers of sine waves, and the wavelength, amplitude and propagation speed of each layer of sine waves are different.

[0014] According to a second aspect of the present disclosure, a water rendering apparatus is provided, comprising: The wave model generation module is configured to superimpose periodic continuous waveform data and noise data onto each vertex of a horizontal grid to obtain a white wave model; and to color the white wave model to obtain the wave model. The differentiation module is configured to perform differentiation processing on the waveform data and the noise data at each vertex of the wave white model to obtain the first spatial gradient corresponding to the waveform data and the second spatial gradient corresponding to the noise data. The composite module is configured to perform composite processing on the first spatial gradient and the second spatial gradient to obtain the composite gradient of each vertex. The normal generation module is configured to obtain the vertex normal vector of each vertex based on the composite gradient of each vertex. The edge generation module is configured to generate edge intensity data of the wave profile based on the vertex normal vector and the view direction vector of each vertex; the view direction vector is a vector pointing from the observation position to the vertex; The rendering module is configured to overlay the edge intensity data onto the wave model to obtain the water body rendering result.

[0015] In one possible implementation, the edge generation module is used to: The line-of-sight offset direction vector of each vertex is determined based on the line-of-sight direction vector. Based on the vertex normal vector and the view direction vector, generate the edge intensity data of the first edge layer; Based on the vertex normal vector and the view offset direction vector, edge intensity data for the second edge layer is generated; the edge intensity represented by the edge intensity data of the second edge layer is different from the edge intensity represented by the edge intensity data of the first edge layer. The edge intensity data of the first edge layer and the edge intensity data of the second edge layer are fused to obtain the edge intensity data of the wave profile.

[0016] In one possible implementation, the edge generation module is used to: Perform a dot product operation on the vertex normal vector and the view direction vector to obtain the angle information between the vertex normal vector and the view direction vector of each vertex; Based on the included angle information, determine the basic edge strength data of each vertex; The edge strength data of the first edge layer is obtained by exponentiation of the basic edge strength data based on the preset edge sharpness parameter. The preset edge sharpness parameter is used to control the sharpness of the edge layer.

[0017] In one possible implementation, the device further includes: The acquisition module is used to acquire a noise map and read the noise intensity value of the noise map at each vertex; The edge generation module is further configured to perform interpolation calculations on the edge intensity data of the first edge layer and the edge intensity data of the second edge layer based on the noise intensity value, so as to obtain the edge intensity data of the wave profile, wherein the noise intensity value is used as the mixing coefficient for the interpolation calculation.

[0018] In one possible implementation, the composite module is used for: Based on the composite gradient function, the first spatial gradient and the second spatial gradient are combined to obtain the composite gradient of each vertex. The composite gradient function is obtained by taking the derivative of the composite function, and the composite function is constructed based on the waveform data and the noise data.

[0019] In one possible implementation, the device further includes a building module for: The noise data is squared to obtain the first sub-item; The noise data, the waveform data, and the preset coefficients are multiplied to obtain the second sub-item; The waveform data is identified as the third sub-item; The composite function is obtained by summing the first sub-item, the second sub-item, and the third sub-item.

[0020] In one possible implementation, the device further includes a beveling module for: Based on the line-of-sight vector, a slant transformation is performed on each vertex and the vertex normal vector in the wave white model to obtain the wave white model after slant transformation and the vertex normal vector after slant transformation; the slant transformation is used to increase the angle between the vertex normal vector and the line-of-sight vector. The edge intensity data is generated based on the vertex normal vector after the slant transformation and the line-of-sight vector of each vertex after the slant transformation. The wave model generation module is also used to color the white wave model after the oblique transformation to obtain the wave model.

[0021] In one possible implementation, the beveling module is used for: The product of the horizontal component of the line-of-sight vector, the vertical component of the line-of-sight vector, and a preset slant factor is determined to obtain the slant transformation parameters; Generate a scissor transformation matrix based on the scissor transformation parameters; Based on the skewing transformation matrix, a skewing transformation is performed on each vertex of the wave white model to obtain the wave white model after the skewing transformation. Based on the slant transformation matrix, the vertex normal vectors of each vertex are subjected to slant transformation to obtain the slant-transformed vertex normal vectors.

[0022] In one possible implementation, the waveform data is obtained by superimposing at least two layers of sine waves, and the wavelength, amplitude and propagation speed of each layer of sine waves are different.

[0023] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the water rendering method as described in the first aspect above.

[0024] According to a fourth aspect of the present disclosure, a computer-readable storage medium, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the water rendering method as described in the first aspect above.

[0025] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the water rendering method as described in the first aspect above.

[0026] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects: In this embodiment, by performing derivative processing on the waveform data and noise data constituting the wave shape respectively, the first spatial gradient of each vertex in the wave model and the second spatial gradient of the noise data are calculated. Then, through composite processing, the vertex normal vector of each vertex is obtained, thereby ensuring that the vertex normal vector of each vertex is dynamically determined based on the geometric shape of the wave model in the current frame, rather than from static texture information. The edge intensity data of the wave contour generated based on the dynamically determined vertex normal vector can remain synchronized with the shape of the wave model in each frame, and has consistency, thereby avoiding distortion of the final water body rendering effect, realizing dynamic rendering of the water body wave contour, and more closely resembling the realistic visual effect.

[0027] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0028] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0029] Figure 1 This is a schematic diagram illustrating an application environment according to an exemplary embodiment.

[0030] Figure 2 This is a flowchart illustrating a water body rendering method according to an exemplary embodiment.

[0031] Figure 3 This is a flowchart illustrating the process of generating edge intensity data according to an exemplary embodiment.

[0032] Figure 4 This is a schematic diagram illustrating a watercolor-style outline effect according to an exemplary embodiment.

[0033] Figure 5 This is a flowchart illustrating a water body rendering process according to an exemplary embodiment.

[0034] Figure 6 This is a schematic diagram illustrating a water body rendering process according to an exemplary embodiment.

[0035] Figure 7 This is a block diagram of a water rendering apparatus according to an exemplary embodiment.

[0036] Figure 8 This is a block diagram illustrating an electronic device for implementing a water body rendering method according to an exemplary embodiment.

[0037] Figure 9 This is a block diagram illustrating an electronic device for implementing a water body rendering method based on an exemplary embodiment. Detailed Implementation

[0038] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0039] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0040] Figure 1 This is a schematic diagram illustrating an application environment according to an exemplary embodiment, such as... Figure 1As shown, the application environment may include server 01 and terminal 02.

[0041] In one optional implementation, the water rendering method is executed on terminal 02. Specifically, terminal 02 may be, but is not limited to, electronic devices such as smartphones, desktop computers, tablets, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, and smart wearable devices. Optionally, the operating system running on the electronic device may include, but is not limited to, Android, iOS, Linux, and Windows.

[0042] In the scenario where the water rendering method is executed independently on terminal 02, the entire rendering process is completed on the local terminal. First, the terminal generates a white wave model and colors it to obtain the wave model. Then, the wave data and noise data at each vertex are differentiated to obtain the first spatial gradient and the second spatial gradient. The first spatial gradient and the second spatial gradient are then combined to obtain the composite gradient of each vertex. Based on the composite calculation of the vertex normal vector, the terminal combines the line-of-sight vector from the viewpoint to each vertex to generate the edge intensity data of the wave contour. Finally, the edge intensity data is superimposed on the colored wave model to complete the output of the water rendering result.

[0043] In an optional implementation, terminal 02 can combine with server 01 to execute the water rendering method. Server 01 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0044] In addition, it should be noted that, Figure 1 The example shown is merely one application environment of the water rendering method provided in this disclosure.

[0045] In the embodiments described in this specification, the server 01 and the terminal 02 can be directly or indirectly connected through wired or wireless communication, and this application does not impose any restrictions on this.

[0046] Figure 2 This is a flowchart illustrating a water body rendering method according to an exemplary embodiment, such as... Figure 1As shown, the execution subject of this method can be an electronic device, which can be a terminal or a server. The following explanation uses a terminal as the execution subject as an example to illustrate the water rendering method. This method includes the following steps.

[0047] In step S21, periodic and continuous waveform data and noise data are superimposed on each vertex of the horizontal grid to obtain a white wave model; and the white wave model is colored to obtain a wave model.

[0048] In the embodiments of this specification, periodically continuous waveform data can refer to waveform functions that exhibit periodic and continuous changes in both time and space, used to simulate the basic morphology of water waves. For example, waveform data may include sine waves, cosine waves, and Gerstner waves, etc.

[0049] The terminal can obtain a periodic continuous waveform by superimposing multiple preset periodic continuous waveform functions. Alternatively, it can acquire waveform data input by the user through an interactive component, such as a command-line component or a data input component in an interactive interface.

[0050] In the embodiments of this specification, noise data may refer to high-frequency noise maps with random and disordered disturbances, in order to change the regularity of waveform data and increase the realism of water surface details.

[0051] The terminal can obtain noise data by sampling predefined noise maps or running noise functions.

[0052] Optionally, the terminal determines noise data based on wave particles, discretizing the continuous wave physics model into a large set of energy-carrying particles. The properties of each wave particle include spatial position, propagation direction, amplitude, wavelength, and radius of influence. By simulating the motion and collision patterns of particles on a horizontal surface, complex water surface waves are synthesized.

[0053] Specifically, the particle field is configured based on the generation requirements. When each frame is updated, the particles move along the propagation direction vector and collide with convenient or dynamic objects in the scene, triggering a realistic wave reflection phenomenon.

[0054] Optionally, the dynamic subdivision mechanism of the particles can be configured as follows: when the distance between adjacent particles exceeds half of their effective radius, a subdivision operation is performed, and a parent particle splits into three child particles. This process strictly follows the law of conservation of energy; the child particles equally share the amplitude of the parent particle but continue to propagate in slightly different directions, thus depicting the diffusion details of the wavefront more precisely while keeping the total energy constant. Finally, for each vertex of the horizontal grid, the terminal calculates the total height offset of that vertex by accumulating the influence of all nearby particles based on distance attenuation. The terminal uses the height field dynamically generated by the particle system as noise data driving water surface deformation.

[0055] In the embodiments of this specification, a horizontal grid can refer to a two-dimensional planar grid composed of vertices and polygons, wherein the polygons can be triangles or quadrilaterals.

[0056] The terminal can directly obtain a preset horizontal grid, or dynamically generate a horizontal grid based on preset parameters such as size and resolution.

[0057] The terminal transforms a static horizontal grid into a wave white model with dynamic wave characteristics by fusing waveform data with noise data.

[0058] Optionally, the terminal can read basic horizontal mesh data and simultaneously overlay two types of displacement data for each vertex: periodically continuous waveform data and noise data obtained through sampling noise maps. Subsequently, the waveform data and noise data are mixed with preset weights and applied to the vertex coordinates of each vertex, causing the horizontal mesh to produce a three-dimensional deformation with natural wave characteristics, forming a wave-like white model containing geometric details.

[0059] The terminal performs complete material coloring calculations based on the generated white wave model to obtain the wave model.

[0060] Optionally, to make the water rendering results more realistic, the white wave model can be subjected to gradient coloring. The terminal first obtains the height information of each vertex of the white wave model, and converts the absolute height into a relative height coefficient through normalization processing to form a unified coloring benchmark.

[0061] Subsequently, the terminal uses a preset multi-layered gradient color scheme, employing a transition from dark to light blue to simulate changes in water depth. For example, in the trough area, dark blue or dark green is used to simulate the depth of the water; in the medium depth area, cyan is used; and in the crest area, light blue or white is used to simulate the effect of waves and reflections on the water surface.

[0062] In step S22, the waveform data and noise data at each vertex of the wave white model are differentiated to obtain the first spatial gradient corresponding to the waveform data and the second spatial gradient corresponding to the noise data.

[0063] When the terminal differentiates the waveform data at each vertex, it can solve for the partial derivatives with respect to the horizontal direction of world space and the partial derivatives with respect to the depth direction of world space to obtain the first spatial gradient and the second spatial gradient, which are used to represent the rate of change of water surface height in the horizontal direction and the rate of change in the depth direction, respectively.

[0064] The horizontal direction corresponds to the x-axis of the world coordinate system in world space, and the depth direction corresponds to the z-axis of the world coordinate system in world space.

[0065] For example, by superimposing waveform data onto the vertices of a horizontal grid, the water surface height function is obtained as follows: .

[0066] Where H represents the water level height, A represents the amplitude of the waveform data, M represents the wavenumber multiplier, used to adjust the intensity of the waveform data, and k represents the wavenumber, K=2π / W. For a period of time, Represents angular frequency. =sqrt(9.8k), α is a constant whose value depends on time and velocity, d is the direction dot product, d=windDir PositionWSXZ, windDi represents the direction of wave propagation, and PositionWSXZ represents the horizontal coordinates of the vertex in world space. Indicates time.

[0067] Assuming windDir is a unit vector and PositionWSXZ is (x, z), then d = windDirx x+windDirz z.

[0068] Assume the phase function Φ(x,z,t) = kd + αt, then .

[0069] Taking the partial derivative of x with respect to the terminal, we get .

[0070] therefore, .

[0071] Similarly, ,but .

[0072] The terminal obtains the derivative with respect to time t. ,but, .

[0073] The final spatial gradient of the waveform data at each vertex obtained by the terminal is: .

[0074] Specifically, .

[0075] but .

[0076] The terminal can construct a gradient map describing the rate of change of the image in the length and width directions by comparing the numerical differences between each pixel in the noisy data and its neighboring pixels, so as to convert continuous differentiation operations into discrete difference calculations.

[0077] Optionally, the terminal processes the noise map as a two-dimensional scalar field, then traverses each pixel and calculates the difference between it and its neighboring pixels to obtain the gradient components in the length and width directions, respectively. Finally, the gradient components in the two directions together constitute the second spatial gradient of each vertex.

[0078] For example, when the terminal determines the second spatial gradient of the noise data at each vertex by the difference between adjacent pixel values, it uses the sampled noise image I as the noise data, and its pixel positions are indexed. Let represent the row index and j represent the column index. Gradients can be obtained using either forward differencing or backward differencing.

[0079] For gradient in the u direction The calculation, if forward differencing is used, yields the noisy image I at the pixel level. At the given position, the gradient along the width direction (corresponding to the x-direction of the waveform data) is Gu[i,j]=I[i,j+1]-I[i,j]; if backward difference is used, the gradient along the width direction is Gu[i,j]=I[i,j]-I[i,j-1].

[0080] For the gradient in the v direction ( I / The calculation of v) using forward differencing yields the noisy image I at the pixel level. At the position, the gradient in the extension direction (corresponding to the z-direction of the waveform data) is Gv[i,j]=I[i+1,j]-I[i,j]; if backward difference is used, the gradient in the length direction is Gv[i,j]=I[i,j]-I[i-1,j].

[0081] In step S23, the first spatial gradient and the second spatial gradient are combined to obtain the composite gradient of each vertex.

[0082] The terminal integrates gradient information representing different scale features into a composite gradient by establishing a composite relationship between the first spatial gradient and the second spatial gradient, providing complete geometric change information for generating accurate vertex normal vectors.

[0083] Optionally, the first spatial gradient and the second spatial gradient are standardized to ensure that the two types of gradient data are used for subsequent composite calculations on the same basis. Subsequently, composite weight coefficients are assigned to the first spatial gradient and the second spatial gradient, and the composite gradient of each vertex is obtained by weighted summation. These weight coefficients can be configured according to the artistic effect requirements.

[0084] In step S24, the vertex normal vector of each vertex is obtained based on the composite gradient of each vertex.

[0085] The terminal can calculate the precise vertex normal direction based on the wave surface variation characteristics described by the composite gradient through standardized mathematical transformation, providing accurate surface orientation data for subsequent lighting calculations and wave profile edge generation.

[0086] Optionally, the terminal converts the horizontal x-component and the depth z-component of the composite gradient into corresponding components of the vertex normal vector, while fixing the vertical y-component to a unit value, forming the initial vertex normal vector. Finally, the initial vertex normal vector is normalized to eliminate the impact of vector length variations on subsequent calculations.

[0087] Optionally, after generating the vertex normal vector, the terminal checks whether there are abnormal regions in the vertex normal vector field of the wave model. It can identify and correct possible calculation errors by comparing adjacent normals, thus ensuring the spatial continuity of the vertex normal vector field corresponding to the wave model.

[0088] In step S25, edge intensity data of the wave profile is generated based on the vertex normal vector and the view direction vector of each vertex.

[0089] The gaze direction vector is the vector pointing from the observation position (which can be the position of a virtual camera) to the vertex. The gaze direction vector represents the specific direction in which the observer is looking towards that vertex.

[0090] Optionally, the view direction vector can be obtained by subtracting the vertex world coordinates from the camera world coordinates and then normalizing them in the shader.

[0091] In step S26, the edge intensity data is superimposed onto the wave model to obtain the water body rendering result.

[0092] During the edge intensity data synthesis process, the terminal can fuse the contour edge information with the base wave color to form a complete visual representation of the water body with a clearly defined contour. Through a specific color mixing algorithm, the terminal highlights the contour features of the waves while preserving the surface material properties, achieving a unified expression of geometric structure and visual style.

[0093] In one possible implementation, the terminal first acquires the color data of the wave model that has been colored and the calculated edge intensity data, and then synthesizes the two through a preset mixing strategy to generate the final water body rendering result with wave contours.

[0094] In summary, in this embodiment, by performing derivative processing on the waveform data and noise data constituting the wave shape respectively, the first spatial gradient of each vertex in the wave model and the second spatial gradient of the noise data are calculated. Then, through composite processing, the vertex normal vector of each vertex is obtained, thereby ensuring that the vertex normal vector of each vertex is dynamically determined based on the geometric shape of the wave model in the current frame, rather than from static texture information. The edge intensity data of the wave contour generated based on the dynamically determined vertex normal vector can remain synchronized with the shape of the wave model in each frame, and has consistency, thereby avoiding distortion in the final water body rendering effect, realizing dynamic rendering of the water body wave contour, and more closely resembling the realistic visual effect.

[0095] After obtaining the first and second spatial gradients, the terminal can perform composite processing on the first and second spatial gradients of each vertex to generate the final composite gradient of each vertex. This composite gradient serves as the basis for calculating the vertex normal vector.

[0096] The purpose of composite processing is to fuse spatial gradient data from different sources according to composite strategies and visual effect requirements. In this embodiment, the composite of the first spatial gradient and the second spatial gradient combines the main water flow trend represented by the waveform data with the local details expressed by the noise data, so that the resulting vertex normal vector conforms to the overall direction of water flow while satisfying rich variations in water surface details.

[0097] In one possible implementation, the terminal performs a composite gradient function on the first spatial gradient and the second spatial gradient to obtain the composite gradient of each vertex.

[0098] The composite gradient function is obtained by taking the derivative of the composite function, which is constructed based on waveform data and noise data.

[0099] First, the terminal establishes a composite function of waveform data and noise data.

[0100] Optionally, when constructing the composite function, the terminal performs a square operation on the noise data to obtain the first sub-term; multiplies the noise data, waveform data, and preset coefficients to obtain the second sub-term; and determines the waveform data as the third sub-term. Then, the first, second, and third sub-terms are summed to obtain the composite function.

[0101] For example, the terminal constructs a composite function as follows: ,in, Represents waveform data. This represents noisy data, with b2 as the first sub-item. As the second sub-item, As the third sub-item, its default coefficient is -1.

[0102] After constructing the composite function, the terminal performs differentiation on the composite function to obtain the composite gradient function.

[0103] For example, regarding the composite function in the example above... Taking the derivative, we obtain the composite gradient function as follows: .

[0104] in, Both and 'b' are functions of x, z, and t in a spatial coordinate system. That is, the waveform data and noise data are functions of the height Y of each vertex in the spatial coordinate system, with respect to x, z, and t. x and z are the independent variables, corresponding to the position of each vertex on the horizontal plane, Y is the dependent variable, representing the coordinates of each vertex in the vertical direction, and t represents time, used to achieve the animation effect.

[0105] It should be noted that the method of constructing the composite function in this embodiment is only a feasible example and not the only limitation of the present invention. In other optional embodiments of the present invention, the composite function can be constructed based on waveform data and noise data through other mathematical relations or algorithm models, according to the requirements of the final water body rendering effect.

[0106] In another possible implementation, the terminal can combine the first spatial gradient and the second spatial gradient by means of the difference based on the noise intensity value at each vertex to obtain the composite gradient.

[0107] For example, the terminal acquires the noise intensity value I of the noise data at each vertex, and then uses this noise intensity value I as a mixing factor to perform linear interpolation between the first spatial gradient and the second spatial gradient. Thus, in regions with weaker noise intensity, the first spatial gradient dominates, while in regions with stronger noise intensity, the second spatial gradient has a greater impact on the composite gradient.

[0108] In one exemplary embodiment, the waveform data is obtained by superimposing at least two layers of sine waves, and the wavelength, amplitude and propagation speed of each layer of sine waves are different.

[0109] Optionally, the terminal can generate waveform data that can simulate the complex wave characteristics of real water bodies by superimposing these sine waves with different parameters at each vertex of the horizontal grid.

[0110] For example, let's take the superposition of two sine waves as an example. The first sine wave serves as the base wave layer, configured with a larger wavelength and amplitude to simulate the main wave motion of water. Its wavelength can be set to 10 units, its amplitude to 0.5 units, and its propagation speed controlled by the angular frequency parameter, set to 1.2 radians / second. The second sine wave is configured with a smaller wavelength and amplitude to superimpose finer ripples on the base wave layer. Its wavelength can be set to 2.5 units, its amplitude to 0.15 units, and its propagation speed to 2.8 radians / second.

[0111] Optionally, for each vertex in the horizontal grid, the terminal can calculate the height offset generated by each layer of sine waves at that vertex, and accumulate the height offsets generated by each layer of sine waves to obtain the final waveform data at that vertex.

[0112] It should be noted that in more complex implementations, more layers of sine waves can be superimposed, with different sine waves corresponding to waves of different scales. By configuring appropriate parameters, a richer variety of wave patterns can be achieved.

[0113] In this embodiment, the first spatial gradient and the second spatial gradient are composited using a composite gradient function, ensuring the accuracy of the vertex normal vectors of each vertex. This transforms the complex gradient composition process into a standardized computation, improving the reliability and maintainability of the algorithm. Furthermore, waveform data is obtained by superimposing multiple layers of sine waves. By combining sine waves of different wavelengths and amplitudes, the generated waveform possesses more complete dimensional characteristics, enhancing the visual realism of the generated wave model.

[0114] Figure 3 This is a flowchart illustrating a process for generating edge intensity data according to an exemplary embodiment, the process including: In step S31, the line-of-sight offset direction vector of each vertex is determined based on the line-of-sight direction vector.

[0115] The line-of-sight offset direction vector can refer to a new direction vector obtained by superimposing additional direction components and renormalizing the original line-of-sight direction vector.

[0116] Optionally, when obtaining the gaze offset direction vector, the terminal first obtains a preset reference direction vector, which can be the direction of the main light source in the scene, a specific direction, or a randomly disturbed direction. Then, the original gaze direction vector is added to the scaled reference direction vector; this scaling factor controls the influence intensity of the reference direction. Finally, the added vector is normalized to obtain the final gaze offset direction vector.

[0117] For example, the calculated view offset direction vector is normalize(ViewDir+LightDirection.xyz).

[0118] The `normalize()` function converts the view offset direction vector into a unit vector. `ViewDir` represents the view direction vector, and `LightDirection.xyz` represents the main light source direction vector.

[0119] If the reference direction vector is the main light source direction vector, then the generated view offset direction vector will make the edge effect respond to both the viewing angle and the lighting angle, generating a stylized edge effect that is in harmony with the lighting environment.

[0120] Step S32: Based on the vertex normal vector and the view direction vector, generate the edge intensity data of the first edge layer.

[0121] The edge intensity data is used to characterize the visual strength of the contour edges at each vertex in the wave model. Furthermore, the edge intensity data is positively correlated with the edge width presented by the edge layer.

[0122] Optionally, the value range can be [0, 1]. A value of 0 indicates that no wheel edge is displayed at the vertex, and a value of 1 indicates that the vertex displays a contour edge with full intensity.

[0123] For example, in the steep transition zone between crests or troughs, since the normal direction is nearly perpendicular to the line of sight, a higher edge intensity can be calculated, thus forming a distinct outline. In contrast, in areas where the waves are relatively gentle, the normal direction tends to be parallel to the line of sight, and the edge intensity value decreases accordingly.

[0124] In one possible implementation, the Fresnel effect is used to simulate the visual representation of water body contours.

[0125] The terminal performs a dot product operation on the vertex normal vector and the view direction vector to obtain the angle information between the vertex normal vector and the view direction vector of each vertex.

[0126] Subsequently, the basic edge strength data of each vertex is determined based on the included angle information. Finally, the basic edge strength data is exponentially calculated based on the preset edge sharpness parameters to obtain the edge strength data of the first edge layer.

[0127] The preset edge sharpness parameter controls the sharpness of the edge layer. The larger the edge sharpness parameter, the finer and sharper the resulting edge lines; the smaller the edge sharpness parameter, the wider and softer the edge lines.

[0128] For example, the terminal normalizes the vertex normal vector and the view direction vector into unit vectors to ensure the accuracy of subsequent calculations. The terminal performs a dot product calculation dot(normal,ViewDir) on the vertex normal vector and the view direction vector, where normal represents the vertex normal vector.

[0129] The dot product represents the cosine of the angle between the vertex normal vector and the line of sight. A dot product of 1 indicates that the vertex normal direction is completely aligned with the line of sight (possibly when the observer is looking perpendicularly at the water surface), while a dot product of 0 indicates that the normal is completely perpendicular to the line of sight (possibly when the observer is looking at the edge of the water surface at eye level).

[0130] The terminal reverse-processes the dot product result and, based on the edge sharpness parameter, uses a power function to convert the dot product result into first edge strength data, obtaining the first edge strength data edge1=pow(1-dot(normal,viewDir),Edge1Sharpness).

[0131] Where pow() is a power function, Edge1Sharpness represents the edge sharpness parameter corresponding to the first edge layer, and edge1 represents the edge intensity data of the first edge layer.

[0132] Optionally, after obtaining the edge intensity data, the edge intensity data can be further processed by a smoothing step function to eliminate noise in areas of excessive intensity and control the edge display threshold.

[0133] For example, the edge intensity data is processed by the smoothing step function to obtain the smoothed edge intensity data edge1 of the first edge layer, which is edge1=smoothstep(Edge1Threshold,Edge1Threshold+Edge1Smoothness,edge1).

[0134] Among them, Edge1Threshold is used to control the starting position of the edge, and Edge1Smoothness is used to control the smoothness of the edge transition.

[0135] Step S33: Based on the vertex normal vector and the view offset direction vector, generate the edge intensity data of the second edge layer.

[0136] The edge intensity represented by the edge intensity data of the second edge layer is different from that represented by the edge intensity data of the first edge layer.

[0137] The second edge layer, with its viewing direction vector subjected to specific offset processing, creates a visual contrast between the generated edge contour and the base edge in terms of position, thickness, or intensity. This simulates the contour variation features commonly found in natural media, such as ink wash and oil painting brushstrokes, enhancing the expressiveness of the rendering results.

[0138] After obtaining the vertex normal vector and the view direction vector, the terminal can use a specific intensity calculation model to convert the geometric relationship between the view offset direction vector and the vertex normal vector into edge intensity data for the second layer.

[0139] For example, the terminal obtains the normalized vertex normal vector and the view offset direction vector. Then, a dot product operation dot(Normal,normalize(ViewDir+LightDirection.xyz)) is performed on the vertex normal vector and the view offset direction vector. The dot product result reflects the degree of perpendicularity between the vertex normal direction and the viewing direction when viewed from the offset view.

[0140] Subsequently, the terminal reverse-processes the dot product result and obtains the edge intensity data of the second edge layer, resulting in edge2=pow(1.0-dot(Normal,normalize(ViewDir+LightDir)),Edge2Sharpness).

[0141] Here, edge2 represents the edge intensity data of the second edge layer, and Edge2Sharpness represents the edge sharpness parameter corresponding to the second edge layer.

[0142] Optionally, the terminal processes the edge intensity data using a smoothing step function to obtain the smoothed edge intensity data of the second edge layer as edge2=smoothstep(Edge2Threshold,Edge2Threshold+Edge2Smoothness,edge2).

[0143] Edge2Threshold controls the starting position of the edge, while Edge2Smoothness controls the smoothness of the edge transition.

[0144] Optionally, when generating a wave rendering effect with an ink-wash style, the terminal can control the edge intensity of the second edge layer to be greater than the edge intensity of the first edge layer. For example, Edge2Threshold can be set to be less than Edge1Threshold, and Edge1Smoothness can be set to be less than Edge2Smoothness.

[0145] Step S34: Fuse the edge intensity data of the first edge layer with the edge intensity data of the second edge layer to obtain the edge intensity data of the wave profile.

[0146] After obtaining the processed edge intensity data of the first edge layer and the second edge layer, the terminal fuses the edge intensity data of the first edge layer and the edge intensity data of the second edge layer through a preset fusion method to ensure that the synthesis result retains the characteristics of each layer and forms a specific rendering effect.

[0147] In one possible implementation, the edge intensity data of the first edge layer and the edge intensity data of the second edge layer are fused based on interpolation.

[0148] First, the terminal obtains a noise map and reads the noise intensity value at each vertex of the noise map.

[0149] Subsequently, based on the noise intensity value, the terminal performs interpolation calculations on the edge intensity data of the first edge layer and the edge intensity data of the second edge layer to obtain the edge intensity data of the wave profile, with the noise intensity value serving as the mixing coefficient for the interpolation calculation.

[0150] The noise map can be a pre-generated Perlin noise, Worley noise, or other procedural noise that meets the requirements.

[0151] Optionally, the terminal extracts the R channel or grayscale value of the noise map as a difference factor. After sampling the noise map, it reads the R channel value in the noise map to obtain the noise intensity value.

[0152] Optionally, the terminal can directly use the sampled noise intensity value as the mixing coefficient. Alternatively, the sampled original noise value can be remapped to obtain the noise intensity value, thereby precisely controlling the mixing range.

[0153] After obtaining the mixing coefficient, the terminal continues to linearly interpolate the two layers of edge intensity data based on the noise intensity value to obtain the edge intensity data of the wave profile as finalEdge=lerp(edge1,edge2,noiseValue).

[0154] Here, lerp() is the interpolation function, noiseValue represents the noise intensity value, and finalEdge represents the edge intensity data of the wave profile.

[0155] Please refer to Figure 4 This illustration shows a schematic diagram of the ink-wash style outline effect provided in an illustrative embodiment of this application.

[0156] The edge intensity data of the first edge layer 41 is lower than that of the second edge layer 42, and the second edge layer 42 has an offset relative to the first edge layer 41.

[0157] In this embodiment, the terminal generates a fine and sharp first edge layer and a wide and soft second edge layer. After the first edge layer and the second edge layer are fused by noise modulation, the wave surface simultaneously maintains the finely outlined contour features and the ink wash rendering effect with gradual transition, forming a wave contour that meets the requirements of ink wash rendering.

[0158] Furthermore, by performing a dot product operation on the vertex normal vector and the viewing direction vector to obtain the included angle information, and after converting the included angle information, the edge intensity data of the edge layer is obtained based on the power operation, thus achieving precise control of the edge contour. Moreover, the features of each edge layer can be flexibly adjusted by adjusting the edge sharpness parameter, thereby achieving edge representations of different artistic styles.

[0159] Figure 5 This is a flowchart illustrating a water body rendering process according to an exemplary embodiment. The process is performed before generating edge intensity data of the wave profile based on the vertex normal vector and the view direction vector of each vertex. The process includes the following steps.

[0160] Step S51: The periodic and continuous waveform data and noise data are superimposed on each vertex of the horizontal grid to obtain the wave white model.

[0161] Step S52: Differentiate the waveform data and noise data at each vertex in the white wave model to obtain the first spatial gradient corresponding to the waveform data and the second spatial gradient corresponding to the noise data.

[0162] Step S53: Perform composite processing on the first spatial gradient and the second spatial gradient to obtain the composite gradient of each vertex.

[0163] Step S54: Based on the composite gradient of each vertex, obtain the vertex normal vector of each vertex.

[0164] The specific implementation of steps S51 to S54 above can be referred to steps S21 to S24 above, and will not be repeated here in this embodiment.

[0165] Step S55: Based on the line-of-sight direction vector, perform skewing transformation on each vertex and the vertex normal vector of each vertex in the wave white model to obtain the wave white model after skewing transformation and the vertex normal vector after skewing transformation.

[0166] The oblique transformation is used to increase the angle between the vertex normal vector and the line-of-sight direction vector.

[0167] When the angle between the observer's line of sight and the water surface is small, the angle between the vertex normal vector of the wave side and the line of sight is also small, resulting in a blurry edge of the generated wave contour. Therefore, a shear transformation can be used to co-transform the vertex coordinates and vertex normal vectors of each vertex in the wave model, thereby increasing the angle between the vertex normal vector and the line of sight, thus making the wave contour clearer.

[0168] In one possible implementation, the terminal determines the product of the horizontal component of the view direction vector, the vertical component of the view direction vector, and a preset skewing factor to obtain skewing transformation parameters. Subsequently, a skewing transformation matrix is ​​generated based on these parameters. Finally, a skewing transformation is performed on each vertex in the wave model based on the skewing transformation matrix to obtain the skewing-transformed wave model, and a skewing transformation is also performed on the vertex normal vectors of each vertex based on the skewing transformation matrix to obtain the skewing-transformed vertex normal vectors.

[0169] The shear factor controls the intensity of the shear transformation, thus affecting the visual enhancement effect of the wave contour edge. It can quantify the degree of application of the geometric deformation of the wave white model or vertex normal vector in the line of sight.

[0170] Optionally, the terminal determines the product of the absolute values ​​of the horizontal component and the vertical component of the viewing direction vector, and a preset skewing factor, to obtain the skewing transformation parameters. This ensures that, under the same pitch angle and low-view conditions, the skewing transformation can produce a stable and consistent contour enhancement effect.

[0171] For example, the horizontal component of the view direction vector is viewDir.xz, the vertical component is viewDir.y, and the shearing factor is shearingFactor. The shearing transformation parameter shearingXZ = shearingFactor is obtained by multiplying them. viewDir.xz abs(viewDir.y). The abs() function is used to take the absolute value.

[0172] Subsequently, the terminal constructs the scissor transformation matrix based on the scissor transformation as follows.

[0173]

[0174] When performing a skewing transformation based on this skewing transformation matrix, the vertical direction remains unchanged, while a deformation related to the line of sight is introduced in the horizontal direction.

[0175] Applying the shearing transformation matrix to the coordinates of each vertex of the wave white model yields shearedPositionWS=mul(shearing, WaveAddNoisePosition), where shearedPositionWS represents the vertex coordinates after the shearing transformation, shearing represents the shearing transformation matrix, and WaveAddNoisePosition represents the vertex coordinates of the wave white model before the transformation.

[0176] To ensure that the vertex normal direction vector remains perpendicular to the mesh surface in the wave white model after the shear transformation, the terminal performs a shear transformation on the vertex normal vector based on the constructed shear transformation matrix, resulting in waveNormal=normalize(mul(shearing,Normal)), where waveNormal represents the vertex normal vector after the shear transformation.

[0177] Step S56: Based on the vertex normal vector after the slant transformation and the view direction vector of each vertex after the slant transformation, generate edge intensity data.

[0178] In one possible implementation, the terminal determines the viewing offset direction vector of each vertex after the slant transformation based on the viewing direction vector. Then, based on the vertex normal vectors and viewing direction vectors after the slant transformation, edge intensity data for the first edge layer is generated. Similarly, edge intensity data for the second edge layer is generated based on the vertex normal vectors and viewing offset direction vectors after the slant transformation. Finally, the edge intensity data from the first and second edge layers are fused to obtain the edge intensity data of the wave contour after the slant transformation.

[0179] For a detailed implementation of generating edge intensity data based on the vertex normal vectors and the view direction vectors of each vertex after the skewing transformation, please refer to the above. Figure 3 The steps shown in the example are not repeated here.

[0180] Step S57: Color the white wave model after the oblique transformation to obtain the wave model.

[0181] Coloring is used to transform wave geometry data that has undergone skewing transformation into a wave model with visual attributes.

[0182] Optionally, after the terminal performs shading processing, a wave model with depth information and visual texture is generated by fusion of lighting calculations and material properties based on the transformed vertex positions and normal directions.

[0183] In one possible implementation, the vertex data and normal information of the wave white model after the slant transformation are first obtained, then the surface color is calculated using a lighting model, and finally the wave model with visual continuity is generated by combining the material parameters, thus completing the transformation from geometric data to visual representation.

[0184] For example, firstly, the terminal calculates the basic diffuse lighting based on the vertex normal vector after the skew transformation and the scene light source direction. This basic diffuse lighting determines the basic light and shadow relationships in different areas of the wave surface. Then, based on the view vector and normal vector after the skew transformation, the intensity of the water surface highlights is calculated. Furthermore, gradient color mapping or procedural color generation methods are used to map the lighting calculation results to visual colors. In addition, for specific artistic needs such as ink painting styles, the terminal can apply non-linear color mapping and edge enhancement.

[0185] Step S58: Overlay the edge intensity data onto the wave model to obtain the water body rendering result.

[0186] In this embodiment, the shear transformation parameters are calculated based on the viewing direction component, ensuring that the transformation effect is closely related to the viewing angle. This achieves a consistent visual enhancement effect under different viewing directions. Furthermore, the shear intensity is related to the viewing direction vector, ensuring contour enhancement at lower viewing angles while maintaining a natural wave shape at higher viewing angles. Additionally, by synchronously transforming the vertex positions and vertex normal direction vectors of the wave white model, visual distortion and rendering errors are avoided.

[0187] In some embodiments, a smooth outline effect requires a high-precision model. Insufficient precision in the water surface model can lead to broken outlines. However, an excessive number of faces in the horizontal mesh can overload the rendering engine. For example, in game and graphics rendering, if the rendered water surface model has too many faces, it can cause game lag. Therefore, after obtaining the water rendering result, optimization can be performed using the LOD (Level of Detail) algorithm to obtain the final water rendering effect for display.

[0188] In one possible implementation, the terminal divides the water wave grid into at least two concentric grid layers centered on the observation position. Then, based on the observation distance between the concentric grid layers and the observation position, the grid resolution corresponding to each concentric grid layer is determined.

[0189] Among them, grid resolution is negatively correlated with observation distance, and grid resolution is positively correlated with grid vertex density.

[0190] For example, the terminal constructs at least two concentric circular grid layers with the observation position as the center, wherein each concentric grid layer has an independent radius range, and the radius increases sequentially from the inner layer to the outer layer.

[0191] Subsequently, the terminal calculates the average distance between each grid layer and the observation position, and determines the resolution parameters of each grid layer based on this observation distance and a preset mapping curve. The inner grid layers have a high-resolution configuration with densely distributed vertices, while the outer grid layers have a low-resolution configuration with sparsely distributed vertices.

[0192] In one possible implementation, the terminal establishes a smooth attribute gradient region between adjacent resolution mesh layers. Visual discontinuities caused by abrupt resolution changes can be eliminated by performing vertex attribute interpolation at the boundary between two mesh layers, ensuring seamless connectivity between meshes at different levels of detail.

[0193] For example, the terminal first analyzes the boundary region between the high-resolution mesh layer and the low-resolution mesh layer to identify the sets of vertices that overlap or are adjacent in space between the two mesh layers. Then, through a spatial location matching algorithm, it finds the corresponding target vertex in the low-resolution mesh for each boundary vertex of the high-resolution mesh, ensuring that the two vertices are as close as possible in their horizontal projection positions.

[0194] After completing the initial matching, the terminal establishes a vertex attribute mapping table to record the relationship between each high-resolution vertex and its corresponding low-resolution vertex, including information such as position offset, normal direction difference, and texture coordinate correspondence.

[0195] Based on the establishment of a complete correspondence, the terminal further optimizes the mesh structure of the transition region, adjusts the vertex distribution density to make it gradually change, and establishes a smooth connection patch between the two mesh layers.

[0196] In this embodiment, the wave mesh is optimized based on the LOD strategy, which significantly reduces performance overhead while maintaining high-quality visual effects. Furthermore, by establishing accurate vertex correspondence and interpolation mechanisms, a seamless visual transition between adjacent mesh layers is achieved, ensuring the physical stability of the wave simulation when switching between levels of detail.

[0197] Figure 6 This is a schematic diagram illustrating the water rendering process according to an exemplary embodiment. First, a horizontal mesh is constructed. Waveform data and noise data are superimposed on each vertex of the horizontal mesh to obtain a white wave model. This white wave model is then colored to obtain the wave model. Next, the terminal performs differentiation on the waveform data and noise data respectively, and obtains the vertex normal vectors of each vertex through gradient composition. Subsequently, edge intensity data is determined based on the vertex normal vectors and the view direction vector, and this edge intensity data is superimposed on the wave model to obtain the 3D water rendering result. After LOD optimization, the 3D water body is displayed.

[0198] Figure 7This is a block diagram illustrating a water rendering apparatus according to an exemplary embodiment. (Refer to...) Figure 7 The device includes a wave model generation module 710, a differentiation module 720, a composite module 730, a normal generation module 740, an edge generation module 750, and a rendering module 760.

[0199] The wave model generation module 710 is configured to superimpose periodic continuous waveform data and noise data onto each vertex of a horizontal grid to obtain a white wave model; and to color the white wave model to obtain a wave model. The differentiation module 720 is configured to perform differentiation processing on the waveform data and the noise data at each vertex of the wave white model to obtain the first spatial gradient corresponding to the waveform data and the second spatial gradient corresponding to the noise data. The composite module 730 is configured to perform composite processing on the first spatial gradient and the second spatial gradient to obtain the composite gradient of each vertex. The normal generation module 740 is configured to obtain the vertex normal vector of each vertex based on the composite gradient of each vertex; The edge generation module 750 is configured to generate edge intensity data of the wave profile based on the vertex normal vector and the viewing direction vector of each vertex; the viewing direction vector is a vector pointing from the observation position to the vertex. The rendering module 760 is configured to overlay the edge intensity data onto the wave model to obtain the water body rendering result.

[0200] In one possible implementation, the edge generation module 750 is used for: The line-of-sight offset direction vector of each vertex is determined based on the line-of-sight direction vector. Based on the vertex normal vector and the view direction vector, generate the edge intensity data of the first edge layer; Based on the vertex normal vector and the view offset direction vector, edge intensity data for the second edge layer is generated; the edge intensity represented by the edge intensity data of the second edge layer is different from the edge intensity represented by the edge intensity data of the first edge layer. The edge intensity data of the first edge layer and the edge intensity data of the second edge layer are fused to obtain the edge intensity data of the wave profile.

[0201] In one possible implementation, the edge generation module 750 is used for: Perform a dot product operation on the vertex normal vector and the view direction vector to obtain the angle information between the vertex normal vector and the view direction vector of each vertex; Based on the included angle information, determine the basic edge strength data of each vertex; The edge strength data of the first edge layer is obtained by exponentiation of the basic edge strength data based on the preset edge sharpness parameter. The preset edge sharpness parameter is used to control the sharpness of the edge layer.

[0202] In one possible implementation, the device further includes: The acquisition module is used to acquire a noise map and read the noise intensity value of the noise map at each vertex; The edge generation module 750 is further configured to perform interpolation calculation on the edge intensity data of the first edge layer and the edge intensity data of the second edge layer based on the noise intensity value to obtain the edge intensity data of the wave profile, wherein the noise intensity value is used as the mixing coefficient for the interpolation calculation.

[0203] In one possible implementation, the composite module 730 is used for: Based on the composite gradient function, the first spatial gradient and the second spatial gradient are combined to obtain the composite gradient of each vertex. The composite gradient function is obtained by taking the derivative of the composite function, and the composite function is constructed based on the waveform data and the noise data.

[0204] In one possible implementation, the device further includes a building module for: The noise data is squared to obtain the first sub-item; The noise data, the waveform data, and the preset coefficients are multiplied to obtain the second sub-item; The waveform data is identified as the third sub-item; The composite function is obtained by summing the first sub-item, the second sub-item, and the third sub-item.

[0205] In one possible implementation, the device further includes a beveling module for: Based on the line-of-sight vector, a slant transformation is performed on each vertex and the vertex normal vector in the wave white model to obtain the wave white model after slant transformation and the vertex normal vector after slant transformation; the slant transformation is used to increase the angle between the vertex normal vector and the line-of-sight vector. The edge intensity data is generated based on the vertex normal vector after the slant transformation and the line-of-sight vector of each vertex after the slant transformation. The wave model generation module 710 is also used to color the white wave model after the oblique transformation to obtain the wave model.

[0206] In one possible implementation, the beveling module is used for: The product of the horizontal component of the line-of-sight vector, the vertical component of the line-of-sight vector, and a preset slant factor is determined to obtain the slant transformation parameters; Generate a scissor transformation matrix based on the scissor transformation parameters; Based on the skewing transformation matrix, a skewing transformation is performed on each vertex of the wave white model to obtain the wave white model after the skewing transformation. Based on the slant transformation matrix, the vertex normal vectors of each vertex are subjected to slant transformation to obtain the slant-transformed vertex normal vectors.

[0207] In one exemplary embodiment, the waveform data is obtained by superimposing at least two layers of sine waves, and the wavelength, amplitude and propagation speed of each layer of sine waves are different.

[0208] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0209] Figure 8 This is a block diagram illustrating an electronic device for implementing a water rendering method according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, the electronic device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a water rendering method. The display screen can be a liquid crystal display (LCD) or an e-ink display. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the device's casing, or an external keyboard, touchpad, or mouse.

[0210] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present disclosure and does not constitute a limitation on the electronic device to which the present disclosure is applied. A specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0211] Figure 9This is a block diagram of an electronic device for implementing a water rendering method, based on an exemplary embodiment. The electronic device can be a server, and its internal structure diagram can be as follows: Figure 9 As shown, the electronic device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a water rendering method.

[0212] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present disclosure and does not constitute a limitation on the electronic device to which the present disclosure is applied. A specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0213] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the water rendering method as described in the embodiments of this disclosure.

[0214] In an exemplary embodiment, a computer-readable storage medium is also provided, which, when executed by a processor of an electronic device, enables the electronic device to perform the water rendering method of the present disclosure. The computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc.

[0215] In an exemplary embodiment, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform the water rendering method of the present disclosure embodiments.

[0216] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0217] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0218] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A water body rendering method, characterized in that, The method includes: Periodic and continuous waveform data and noise data are superimposed on each vertex of a horizontal grid to obtain a white wave model; and the white wave model is then colored to obtain a wave model. The waveform data and the noise data at each vertex of the wave white model are respectively differentiated to obtain the first spatial gradient corresponding to the waveform data and the second spatial gradient corresponding to the noise data. The first spatial gradient and the second spatial gradient are combined to obtain the composite gradient of each vertex. Based on the composite gradient of each vertex, the vertex normal vector of each vertex is obtained; Based on the vertex normal vector and the view direction vector of each vertex, the edge intensity data of the wave profile is generated; the view direction vector is a vector pointing from the observation position to the vertex; The edge intensity data is superimposed onto the wave model to obtain the water body rendering result.

2. The method according to claim 1, characterized in that, The step of generating edge intensity data for the wave profile based on the vertex normal vector and the view direction vector of each vertex includes: The line-of-sight offset direction vector of each vertex is determined based on the line-of-sight direction vector. Based on the vertex normal vector and the view direction vector, generate the edge intensity data of the first edge layer; Based on the vertex normal vector and the view offset direction vector, edge intensity data for the second edge layer is generated; the edge intensity represented by the edge intensity data of the second edge layer is different from the edge intensity represented by the edge intensity data of the first edge layer. The edge intensity data of the first edge layer and the edge intensity data of the second edge layer are fused to obtain the edge intensity data of the wave profile.

3. The method according to claim 2, characterized in that, The step of generating edge intensity data for the first edge layer based on the vertex normal vector and the view direction vector includes: Perform a dot product operation on the vertex normal vector and the view direction vector to obtain the angle information between the vertex normal vector and the view direction vector of each vertex; Based on the included angle information, determine the basic edge strength data of each vertex; The edge strength data of the first edge layer is obtained by exponentiation of the basic edge strength data based on the preset edge sharpness parameter. The preset edge sharpness parameter is used to control the sharpness of the edge layer.

4. The method according to claim 2, characterized in that, The method further includes: Obtain a noise map and read the noise intensity value at each vertex of the noise map; The step of fusing the edge intensity data of the first edge layer with the edge intensity data of the second edge layer to obtain the edge intensity data of the wave contour includes: Based on the noise intensity value, interpolation calculation is performed on the edge intensity data of the first edge layer and the edge intensity data of the second edge layer to obtain the edge intensity data of the wave profile, and the noise intensity value is used as the mixing coefficient for the interpolation calculation.

5. The method according to any one of claims 1 to 4, characterized in that, The step of combining the first spatial gradient and the second spatial gradient to obtain the composite gradient of each vertex includes: Based on the composite gradient function, the first spatial gradient and the second spatial gradient are combined to obtain the composite gradient of each vertex. The composite gradient function is obtained by taking the derivative of the composite function, and the composite function is constructed based on the waveform data and the noise data.

6. The method according to claim 5, characterized in that, Before performing the composite gradient function on the first spatial gradient and the second spatial gradient, the method further includes: The noise data is squared to obtain the first sub-item; The noise data, the waveform data, and the preset coefficients are multiplied to obtain the second sub-item; The waveform data is identified as the third sub-item; The composite function is obtained by summing the first sub-item, the second sub-item, and the third sub-item.

7. The method according to claim 1, characterized in that, Before generating the edge intensity data of the wave profile based on the vertex normal vector and the view direction vector of each vertex, the method further includes: Based on the line-of-sight vector, a slant transformation is performed on each vertex and the vertex normal vector in the wave white model to obtain the wave white model after slant transformation and the vertex normal vector after slant transformation; the slant transformation is used to increase the angle between the vertex normal vector and the line-of-sight vector. The step of generating edge intensity data of the wave profile based on the vertex normal vector and the view direction vector of each vertex includes: generating the edge intensity data based on the vertex normal vector after the slant transformation and the view direction vector of each vertex after the slant transformation. The step of coloring the white wave model to obtain the wave model includes: coloring the white wave model after the slant transformation to obtain the wave model.

8. The method according to claim 7, characterized in that, Based on the line-of-sight direction vector, a slant transformation is performed on each vertex and its vertex normal vector in the wave white model to obtain the slant-transformed wave white model and its vertex normal vectors, including: The product of the horizontal component of the line-of-sight vector, the vertical component of the line-of-sight vector, and a preset slant factor is determined to obtain the slant transformation parameters; Generate a scissor transformation matrix based on the scissor transformation parameters; Based on the skewing transformation matrix, a skewing transformation is performed on each vertex of the wave white model to obtain the wave white model after the skewing transformation. Based on the slant transformation matrix, the vertex normal vectors of each vertex are subjected to slant transformation to obtain the slant-transformed vertex normal vectors.

9. The method according to claim 1, characterized in that, The waveform data is obtained by superimposing at least two layers of sine waves, and the wavelength, amplitude and propagation speed of each layer of sine waves are different.

10. A water body rendering device, characterized in that, include: The wave model generation module is configured to overlay periodic continuous waveform data and noise data onto the vertices of a horizontal grid to obtain a white wave model. The white wave model is then colored to obtain the wave model. The differentiation module is configured to perform differentiation processing on the waveform data and the noise data at each vertex of the wave white model to obtain the first spatial gradient corresponding to the waveform data and the second spatial gradient corresponding to the noise data. The composite module is configured to perform composite processing on the first spatial gradient and the second spatial gradient to obtain the composite gradient of each vertex. The normal generation module is configured to obtain the vertex normal vector of each vertex based on the composite gradient of each vertex. The edge generation module is configured to generate edge intensity data of the wave profile based on the vertex normal vector and the view direction vector of each vertex; the view direction vector is a vector pointing from the observation position to the vertex; The rendering module is configured to overlay the edge intensity data onto the wave model to obtain the water body rendering result.

11. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the water rendering method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the water rendering method as described in any one of claims 1 to 9.

13. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the water rendering method according to any one of claims 1 to 9.