Water ripple generation method, device, electronic device and storage medium

By constructing a combination of water body ripple model and noise map, the target gradient map is generated and the water body ripple rendering is solved, and the problem of inefficient water surface ripples production in the existing technology is achieved, and rapid and efficient water body ripple production and adjustment are achieved.

CN114742927BActive Publication Date: 2025-08-08NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210307675.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-25
Publication Date
2025-08-08
Estimated Expiration
2042-03-25

AI Technical Summary

Technical Problem

When creating water surface ripples in virtual scenes, using skeleton animations is time-consuming and labor-intensive, and the modification is cumbersome, resulting in inefficient production and poor user experience.

Method used

By constructing a water body ripple model, obtaining UV maps, and using preset noise maps for overlaying, generating a target gradient map, and finally mapping it to the water body ripple model for rendering, realizing the display of water body ripple.

Benefits of technology

It improves the efficiency and flexibility of water body corrugation production, reduces production costs, and can quickly adjust the effect, saving production time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114742927B_ABST
    Figure CN114742927B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and storage medium for generating water ripples, including: constructing a water ripple model and obtaining a UV map of the water ripple model; superimposing the UV map according to a preset noise map to obtain a target gradient map; mapping the target gradient map to the water ripple model to render and display the water ripples. The present application constructs a water ripple model and obtains a UV map of the water ripple model, and then combines it with the corresponding preset noise map to obtain a final target gradient map, and maps and renders the final water ripples through the target gradient map. This provides a solution for completing the production and adjustment of water ripples quickly and conveniently, thereby improving overall production efficiency. In addition, the solution reduces production costs by using fewer maps, and the production effect can be quickly viewed after adjustment, saving a lot of production time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for generating water ripples. Background Art

[0002] When drawing virtual scenes, shaders in various rendering engines are often used to render the virtual scenes to enhance their realism. However, when it comes to creating large virtual scenes, such as the ripples on the surface of a vast lake in a game, existing technologies typically use K-animation to create these ripples.

[0003] However, this approach makes it extremely difficult to create a skeleton that can create dynamic water ripples using skeletal animation. Even if the rigging is complete, any adjustments or modifications require re-creation. This makes creating ripples with existing solutions time-consuming, labor-intensive, and cumbersome, resulting in low overall production efficiency and a poor user experience. Summary of the Invention

[0004] In view of this, the present application proposes a water ripple generation method, device, electronic device and storage medium, so as to conveniently and quickly produce ripples in virtual scenes.

[0005] Based on the above objectives, the present application provides a method for generating water ripples, comprising:

[0006] Constructing a water ripple model and obtaining a UV map of the water ripple model;

[0007] According to the preset noise map, the UV map is superimposed to obtain a target gradient map;

[0008] The target gradient map is mapped to the water ripple model to render and display the water ripples.

[0009] In some embodiments, constructing a water ripple model includes:

[0010] Acquire a water body plane model, and determine the plane vertex coordinates of the water body plane model;

[0011] By adjusting the coordinates of the plane vertices, the water body plane model is adjusted to a circular plane model, thereby generating the water body ripple model.

[0012] In some embodiments, the water body plane model is a quadrilateral plane model;

[0013] The adjusting the water body plane model to a circular plane model comprises:

[0014] The quadrilateral plane model is plane-adjusted so that two opposite sides of the quadrilateral plane model overlap, and the other two opposite sides of the quadrilateral plane model are stretched or compressed, thereby obtaining the circular plane model.

[0015] In some embodiments, before the UV map is overlaid, the method includes:

[0016] Acquire the ripple flow velocity and time parameters, calculate according to the ripple flow velocity and the time parameters, obtain the intermediate value of the gradient map of the UV map, and superimpose the intermediate value of the gradient map with the preset noise map.

[0017] In some embodiments, obtaining the intermediate value of the gradient map of the UV map is specifically:

[0018] wave_intenty

[0019] =pow((((1.0-distance(frac((v.texcoord.xy.x+(_speed*_Time.y))),0.5))+-0.5)*2.0),_power)

[0020] Among them, wave_intensity is the middle value of the gradient map, v.texcoord.xy.x is the texture map Figure 1 The coordinate value of the set coordinate direction, _speed is the ripple flow speed, _Time.y is the time parameter of the system, _power is the preset adjustment variable parameter, frac(x) represents the function of taking the decimal part of x, distance(x, y) represents the function of finding the distance between x and y, and pow(x) represents the exponential function calculation of x.

[0021] In some embodiments, before mapping the target gradient map into the water ripple model, the method further includes:

[0022] A preset black-and-white gradient image is obtained, and the target gradient image is superimposed on the black-and-white gradient image to obtain an adjusted target gradient image.

[0023] In some embodiments, before mapping the target gradient map into the water ripple model, the method further includes:

[0024] The target gradient image is superimposed using the Fresnel effect.

[0025] In some embodiments, before mapping the target gradient map into the water ripple model, the method further includes:

[0026] A noise map of a preset flow map is obtained, and any color channel of the noise map is used to perform superposition processing on the target gradient map.

[0027] Based on the same concept, the present application also provides a water ripple generating device, comprising:

[0028] An acquisition module is used to construct a water ripple model and obtain a UV map of the water ripple model;

[0029] A calculation module, configured to perform superposition processing on the UV map according to a preset noise map to obtain a target gradient map;

[0030] A rendering module is used to map the target gradient map into the water ripple model to render and display the water ripples.

[0031] Based on the same concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above methods when executing the program.

[0032] Based on the same concept, the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to implement any of the methods described above.

[0033] From the above description, it can be seen that the present application provides a method, device, electronic device and storage medium for generating water ripples, including: constructing a water ripple model and obtaining a UV map of the water ripple model; superimposing the UV map according to a preset noise map to obtain a target gradient map; mapping the target gradient map to the water ripple model to render and display the water ripples. The present application constructs a water ripple model and obtains a UV map of the water ripple model, and then combines it with the corresponding preset noise map to obtain a final target gradient map, and maps and renders the final water ripples through the target gradient map. This provides a solution for completing the production and adjustment of water ripples quickly and conveniently, thereby improving the overall production efficiency. In addition, the solution reduces production costs by using fewer maps, and the production effect can be quickly viewed after adjustment, saving a lot of production time. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0035] Figure 1 A schematic flow chart of a method for generating water ripples proposed in an embodiment of the present application;

[0036] Figure 2 A schematic diagram of the model structure of a water ripple model proposed in an embodiment of the present application;

[0037] Figure 3 A schematic diagram of the effect of water ripples proposed in an embodiment of the present application;

[0038] Figure 4 This is a schematic diagram of the effect of a UV map and noise map proposed in an embodiment of the present application;

[0039] Figure 5 A schematic diagram of a black and white gradient image proposed in an embodiment of the present application;

[0040] Figure 6 A schematic structural diagram of a water ripple generating device proposed in an embodiment of the present application;

[0041] Figure 7 This is a schematic diagram of the electronic device structure proposed in an embodiment of the present application. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solutions and advantages of this specification more clear, this specification is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0043] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should have the usual meanings understood by people with ordinary skills in the field to which this application belongs. The "first", "second" and similar words used in the embodiments of the present application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements, objects or method steps that appear before the word cover the elements, objects or method steps listed after the word and their equivalents, without excluding other elements, objects or method steps. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0044] As mentioned in the background section, the traditional method of directly k-animating models is inherently difficult to rig for skeletal animation, and inconvenient to modify and adjust after completion. Direct k-animation of models results in rigid, mechanical animations, lacking the fluidity of water. K-animation and k-motion refer to the process by which animation engineers create animations or motions after rigging and skinning the model. Currently, there are two main traditional production processes: 1) using a particle emitter to play cartoon sequence frame textures to create a ripple effect; 2) using Houdini (a 3D computer graphics software) to simulate the ripple effect, deriving a set of sequence models, and then using particle emission to create the ripple effect. However, both techniques have drawbacks. The first technique, using sequence frames, can cause severe stuttering in slow motion, significantly impacting the artistic performance and user experience. The second technique, model sequencing, is unsuitable for high-precision effects, requires too many models, and consumes a significant amount of resources. It is unsuitable for mobile platforms and is more suitable for host-side or terminal-based projects. Therefore, a ripple generation solution is needed on mobile devices that can produce vivid ripple effects with fewer textures, has low overhead costs, and is convenient and quick to adjust the ripple effect in the shader.

[0045] In light of the above-mentioned actual situation, the embodiment of the present application proposes a water ripple generation scheme. By constructing a water ripple model and obtaining a UV map of the water ripple model, the final target gradient map is obtained by combining it with the corresponding preset noise map. The final water ripples are mapped and rendered through the target gradient map. This provides a solution for completing the production and adjustment of water ripples conveniently and quickly, improving overall production efficiency. In addition, the solution reduces production costs by using fewer maps. At the same time, the production effect can be quickly viewed after adjustment, saving a lot of production time.

[0046] like Figure 1 FIG. 1 is a flow chart of a method for generating water ripples proposed in this application, which specifically includes:

[0047] Step 101: construct a water ripple model and obtain a UV map of the water ripple model.

[0048] In this step, the water ripple model is generated by a surface model that can generate ripples. The surface model is generally a surface model of a solution, such as a water surface model, a water droplet model, a solvent surface model, etc. After that, the surface model is generally a plane model, and the ripple is generally a curved surface model with a certain curvature. The water ripple model is also generally a circular ring model radiating from the center point where the ripples are generated. Figure 2As shown, it is a water ripple model, which is a model after the plane model is deformed by bending. Furthermore, it is necessary to bend the basic plane model to generate the water ripple model, and bend it into the basic shape of the ripple, such as a circular ring or an irregular ring, etc. The bending process can be to bend the model through a pre-set template, or it can be obtained by the user engineer directly adjusting the basic model, or it can be to load a modifier for bending on the basic model, and the user engineer directly adjusts the modifier through parameter adjustment or artificial intelligence calculation parameters, etc. Thus, a circular or irregular ring water ripple model is obtained. Of course, the specific shape of the water ripple model can be adjusted according to the specific application scenario, and the water ripple model generally corresponds to the general shape of the ripple.

[0049] Next, a UV map of the water ripple model is obtained. Generally speaking, a texture is one or more two-dimensional graphics representing the surface of an object, also known as a texture map. When a texture is mapped onto an object's surface in a specific manner, it can make the object appear more realistic. In 3D animation and game production, UV texture maps or UVW texture maps are commonly used. Taking a UV texture map as an example, a UV map is a planar representation of the surface of a 3D model that can be easily textured. The U and V channels refer to the horizontal and vertical axes of 2D space. Specifically, U and V are the coordinates of the UV texture map, similar to the X, Y, and Z axes of a spatial model. These coordinates define the position of each point in the image. These points are interconnected with the 3D model and are used to determine the placement of the surface texture map. Like a virtual "band-aid," UV maps precisely map each point in the 2D image to the surface of the 3D model. The gaps between points are smoothed by specialized software interpolation. In this step, after the water ripple model is determined, the UV map of the water ripple model can be directly obtained through third-party software or functional modules.

[0050] Step 102: performing superposition processing on the UV map according to a preset noise map to obtain a target gradient map.

[0051] In this step, after obtaining the UV map, the target gradient map can be calculated. The gradient map is generally an image in which the pattern or color in the graphic gradually changes as the coordinate axis moves. In a specific embodiment, the gradient of the ripple Figure 1It is generally related to factors such as the propagation speed of the ripple, the initial impact force (propagation amplitude), and the model material, so that the ripple gradient map can be based on the UV map and calculated through these parameters that affect all or part of the ripple shape. In a specific embodiment, the target gradient map can be driven only for the vertices of the model or map, and other points are driven by the vertices, that is, the ripples can be propagated by vertex offset. In a specific embodiment, taking the calculation of the target gradient map by propagation speed and system time as an example, the product of the ripple flow speed and the time parameter of the system can be superimposed by the value of the U channel of the UV map, and the decimal part of the superposition value result can be determined. The distance between the position corresponding to the decimal part of the superposition value result and the center position is determined, and then combined with the method of obtaining the exponent of the adjustment variable, a gradient map is finally obtained. This gradient map can be an intermediate gradient map, or it can be directly applied as the final gradient map. When used as an intermediate gradient map, the gradient map can be adjusted in combination with the preset noise map to make it more corresponding to the shape of the ripple. In specific embodiments, the preset noise map can be a Voronoi diagram, a black-and-white noise map, or the like. These noise maps are then multiplied with the intermediate shapes obtained by UV mapping to produce the final target gradient map. In some embodiments, the ripple shape can be further adjusted, such as by outlining or perturbation, to better align it with the environment of the underlying model and enhance the realistic ripple effect.

[0052] In some embodiments, the coordinates of the edges of the corresponding ripples in the UV map can be determined. These coordinates can be determined using the distance from the center. A circle of ripples is essentially a ring or a disk, so adjusting its edges can complete the ripple creation. Since the UV map is essentially a coordinate map that reflects the position information of each point in the image, the coordinates of the edges of the intermediate model can be accurately determined based on the coordinate values (UV values, etc.).

[0053] Step 103: Map the target gradient map to the water ripple model to render and display the water ripples.

[0054] In this step, the calculated target gradient map is mapped to the water ripple model, so that the coordinates of each point (such as vertex coordinates) of the water ripple model are adjusted accordingly through the target gradient map, and then rendered to generate the corresponding water ripples. Figure 3 , which is a schematic diagram of the water ripples rendered after the target gradient map is mapped onto the water ripple model.

[0055] Afterwards, the water ripples can be output for storage, display, use or further processing. According to different application scenarios and implementation needs, the specific output method of the water ripples can be flexibly selected.

[0056] For example, in an application scenario where the method of this embodiment is executed on a single device, the water ripples can be directly output in a displayed manner on the display component of the current device (display, projector, etc.), so that the operator of the current device can directly see the content of the water ripples from the display component.

[0057] For another example, in an application scenario where the method of this embodiment is executed on a system composed of multiple devices, the water ripples can be sent to other preset devices serving as receivers within the system, i.e., synchronization terminals, through any data communication method (wired connection, NFC, Bluetooth, wifi, cellular mobile network, etc.), so that the synchronization terminals can perform subsequent processing on them. Optionally, the synchronization terminal can be a preset server, which is generally set up in the cloud as a data processing and storage center, which can store and distribute the water ripples; wherein the recipients of the distribution are terminal devices, and the holders or operators of these terminal devices can be current users, downstream games, animation production personnel, game and animation quality supervisors, and the like.

[0058] For another example, in an application scenario where the method of this embodiment is executed on a system composed of multiple devices, the water ripples can be sent directly to a preset terminal device through any data communication method, and the terminal device can be one or more of the ones listed in the preceding paragraphs.

[0059] From the above description, it can be seen that a method for generating water ripples in an embodiment of the present application includes: constructing a water ripple model and obtaining a UV map of the water ripple model; superimposing the UV map according to a preset noise map to obtain a target gradient map; mapping the target gradient map to the water ripple model to render and display the water ripples. The present application constructs a water ripple model and obtains a UV map of the water ripple model, and then combines it with the corresponding preset noise map to obtain a final target gradient map, and maps and renders the final water ripples through the target gradient map. This provides a solution for completing the production and adjustment of water ripples quickly and conveniently, thereby improving the overall production efficiency. In addition, the solution reduces production costs by using fewer maps, and the production effect can be quickly viewed after adjustment, saving a lot of production time.

[0060] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of the embodiment of the present application can also be applied in a distributed scenario and completed by multiple devices working together. In the case of such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the method described.

[0061] It should be noted that the above description is of specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0062] In an optional exemplary embodiment, constructing a water ripple model includes: obtaining a water plane model and determining plane vertex coordinates of the water plane model; and adjusting the plane vertex coordinates to convert the water plane model into a circular plane model, thereby generating the water ripple model. By converting the water plane model into a circular plane model, the water plane model is quickly adjusted to a desired water ripple model.

[0063] In this embodiment, the water plane model is a surface model capable of generating ripples, such as a water surface model, a water droplet model, or a solvent surface model. Since ripples are a localized phenomenon on the water surface, a small water plane model can be selected to create the water ripple model, such as a rectangular or square water plane model. Once the model is determined, its corresponding vertices and vertex coordinates are also determined. By adjusting the vertex coordinates of this water plane model, a circular plane model can be generated to serve as the water ripple model.

[0064] In a specific embodiment, the plane model can be adjusted using some third-party 3D modeling software, such as 3Dmax and other software. Bend modifiers, i.e., bending modifiers, are usually set in these third-party 3D modeling software. In these software, the plane of the water plane model can be adjusted by using the bending modifier by directly loading the bending modifier onto the water plane model, so that it can bend according to the settings or user adjustments. The bending modifier can also be loaded by first adding the bending modifier to a specific mold and then loading the mold onto the water plane model. Figure 2 The figure shows adjustments to a water body plane model using modeling software such as 3D Max, resulting in a water ripple model. In a specific embodiment, factors such as the specific bend adjustment amplitude, i.e., the desired ripple size, etc., involve animation production itself, requiring active adjustments and settings by the animation engineer. The system then executes these adjustments, i.e., obtains the settings for the bend modifier.

[0065] In a specific embodiment, the plane model of the water body can be adjusted by creating a patch. A patch is a graphic between two-dimensional and three-dimensional. It has a three-dimensional surface, but retains a two-dimensional "spline curve" that can achieve a curved surface effect by adjusting its "Bezier handle". Therefore, in three-dimensional modeling software, patches are generally used to make soft fabrics (clothing, tablecloths, bedspreads, etc.), mountains, water surfaces, etc. In a specific application scenario, an adjustment patch that can cover the plane model of the water body can be created in three-dimensional modeling software such as 3Dmax, and then a bend modifier is added to the adjustment patch. Finally, the adjustment patch with the bend modifier is loaded into the base model, and the animation engineer completes the bending of the base model by setting the bend modifier.

[0066] In an optional exemplary embodiment, the water body plane model is a quadrilateral plane model; adjusting the water body plane model to a circular plane model includes: performing plane adjustment on the quadrilateral plane model so that two opposite sides of the quadrilateral plane model overlap, and stretching or compressing the other two opposite sides of the quadrilateral plane model to obtain the circular plane model.

[0067] In this embodiment, the quadrilateral plane model can be a rectangular plane model or a square plane model, etc. Taking the rectangular plane model as an example, it is a rectangle in the plane view. When adjusting, the rectangle can be bent and stretched in the plane so that the two short sides of the rectangle overlap. In order to complete this adjustment, one of its two long sides must be stretched and the other compressed. Ultimately, the stretched side becomes the outer contour line of the circle or ring, and the compressed side becomes the center or inner contour line of the circle or ring. Of course, similar operations can be performed for square plane models, parallelogram plane models, rhombus plane models, etc. Those skilled in the art can make specific adjustments to the quadrilateral plane model according to the specific application scenario.

[0068] In an optional exemplary embodiment, before the UV map is superimposed, it includes: obtaining the ripple flow velocity and time parameters, calculating according to the ripple flow velocity and the time parameters, obtaining the intermediate value of the gradient map of the UV map, and superimposing the intermediate value of the gradient map with the preset noise map.

[0069] In this embodiment, the ripple flow velocity is the propagation speed of the ripples. For example, after a stone is thrown into the lake, the propagation speed of the ripples generated is determined by the speed and volume of the stone entering the water. Here, the animation engineer can directly give a value for the ripple flow velocity. Afterwards, the time parameter is the system time parameter, which can be given by the engineer or obtained through calculation or statistics. For example, when the stone is thrown into the lake, the time statistics are started and the time parameter is given accordingly. Furthermore, through the ripple flow velocity and time parameters, an intermediate gradient map, i.e., the intermediate value of the gradient map, can be generated in combination with the coordinate values of each point in the UV map. The specific calculation process can be:

[0070] wave_intensity

[0071] =pow((((1.0-distance(frac((v.texcoord.xy.x+(_speed*_Time.y))),0.5))+-05)*2.0),_power)

[0072] Among them, wave_intensity is the middle value of the gradient map, v.texcoord.xy.x is the texture map Figure 1 The coordinate value of the set coordinate direction, _speed is the ripple flow speed, _Time.y is the system time parameter, and _power is the preset adjustment variable parameter. frac(x) represents a function that takes the decimal part of x. In this embodiment, the decimal part of the calculation result of ((v.texcoord.xy.x+(_speed*_Time.y))) is taken; distance(x, y) represents a function that obtains the distance between x and y. In this embodiment, the distance is obtained by (frac((v.texcoord.xy.x+(_speed*_Time.y))), 0.5); pow(x) represents the exponential function calculation. In this embodiment, the exponential function calculation is performed on ((((1.0-distancefracv.texcoord.xy.x+_speed*_Time.y,0.5+-0.5*2.0,_power。Afterwards, in a specific application scenario, v.texcoord.xy.x can be the value of the U channel in the UV map.

[0073] Finally, after the calculation of the intermediate value of this gradient map is completed, it is superimposed with the preset noise map to finally obtain the target gradient map. In a specific embodiment, the preset noise map can be a Thiessen polygon noise map. Thiessen polygons are also called von Lonoi diagrams, which are a set of continuous polygons composed of perpendicular bisectors connecting two adjacent point segments. The distance from any point within a Thiessen polygon to the control points that constitute the polygon is less than the distance to the control points of other polygons. The noise map is a map that reflects noise. In the field of 3D animation production, noise can provide a waveform map with random positions for vertices. In the production of 3D models, it is mainly used to make the established plane irregular, with uneven heights, etc. For example, land and caves have very irregular surfaces in real life. In order to make the land and caves in virtual scenes more realistic, it is necessary to load a random noise map, which is difficult to accurately model using ordinary modeling. In specific application scenarios, the noise map of the Voronoi diagram can be pre-set, or it can be directly calculated by using 3D modeling software after obtaining the preset Voronoi diagram. Afterwards, the middle value of the gradient map is superimposed with the preset noise map such as the Thiessen polygon noise map. Figure 4 As shown, Figure 4 a is the middle value of the gradient map in a specific embodiment, Figure 4 b is the Thiessen polygon noise map. In a specific embodiment, the overlay process is to multiply the channel value or grayscale value of each point calculated from the middle value of the gradient map with the channel value or grayscale value at the same position in the Thiessen polygon noise map. Finally, the target gradient map is obtained.

[0074] In an optional exemplary embodiment, before mapping the target gradient map to the water ripple model, it also includes: obtaining a preset black and white gradient map, superimposing the target gradient map with the black and white gradient map to obtain an adjusted target gradient map.

[0075] Since the amplitude of the ripples of the target gradient map obtained by superimposing the intermediate value of the gradient map with the preset noise map such as the Thiessen polygon noise map is the same, that is to say, the amplitude of the ripples obtained by using this target gradient map is the same no matter how far away from the center point the ripples are. Therefore, this type of ripple gradient map can only be used in some specific scenarios. In more realistic scenarios, the effect of the ripples is that the closer to the center point, the larger the ripple amplitude, and the farther from the center point, the smaller the ripple amplitude until it disappears. Therefore, the target gradient map can also be further adjusted. In this embodiment, the above effect can be achieved by adding a black and white gradient map. For example Figure 5As shown, the black-and-white gradient image is a regular gradient image that gradually changes from black to white. By multiplying the target gradient image with the black-and-white gradient image, for example, we can adjust the target gradient image to create a distance effect. For example, we can set the darker parts of the black-and-white gradient image to be closer to the center point, allowing for targeted value assignments. Alternatively, we can use the color values of each point in the black-and-white gradient image (the color value range is generally 0 to 255) to reflect the distance from the center point. The result is an adjusted target gradient image, achieving the effect of small fluctuations at a distance and large fluctuations at the center.

[0076] In an optional exemplary embodiment, before mapping the target gradient map into the water ripple model, the method further includes:

[0077] The target gradient image is superimposed using the Fresnel effect.

[0078] In this embodiment, the Fresnel effect refers to: a certain material shows different reflection effects at different distances. The significance of the Fresnel effect is: when light propagates from a medium with a refractive index to another medium with a refractive index, light reflection and refraction may occur simultaneously at the junction of the two (usually called an interface). The Fresnel equation describes the situation in which different light wave components are refracted and reflected. In the three-dimensional modeling software, it can be directly set so that the system can automatically adjust the map using the Fresnel effect. In this embodiment, the completed target gradient map can be further outlined by the Fresnel effect, so that the generated ripple map is more natural and realistic. Among them, outlining is one of the conventional steps in painting.

[0079] In an optional exemplary embodiment, before mapping the target gradient map to the water ripple model, the method further includes: obtaining a noise map of a preset flow map, and using any color channel of the noise map to overlay the target gradient map.

[0080] In this embodiment, since in a real scene, the ripples may also be affected by the flow of the fluid presented by the basic model, such as the disturbance phenomenon of the ripples caused by the flow of the water surface in the direction of the water flow. Therefore, after obtaining the target gradient map, the target gradient map can be further modified by the noise map of the pre-set flow map to adapt it to the influence of the flow of the fluid presented by the water body model. After that, each point in the map will correspond to at least three color channels, namely R, G, and B channels, to reflect the color of each point. In specific applications, the disturbance of the flow can be reflected by directly obtaining the value of any channel of each point on the noise map of the pre-set flow map (for example, the value of the R channel). Then, the value of the channel can be directly added to the value of each point in the target gradient map to achieve the final disturbance effect of the fluid flow.

[0081] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a water ripple generating device.

[0082] refer to Figure 6 , the water ripple generating device comprises:

[0083] The acquisition module 210 is used to construct a water ripple model and obtain a UV map of the water ripple model;

[0084] The calculation module 220 is used to perform superposition processing on the UV map according to a preset noise map to obtain a target gradient map;

[0085] The rendering module 230 is configured to map the target gradient map to the water ripple model to render and display the water ripples.

[0086] For the convenience of description, the above devices are described as being divided into various modules according to their functions. Of course, when implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0087] The device of the above embodiment is used to implement the corresponding water ripple generation method in the above embodiment, and has the beneficial effects of the corresponding water ripple generation method embodiment, which will not be repeated here.

[0088] In an optional exemplary embodiment, the acquisition module 210 is further configured to:

[0089] Acquire a water body plane model, and determine the plane vertex coordinates of the water body plane model;

[0090] By adjusting the coordinates of the plane vertices, the water body plane model is adjusted to a circular plane model, thereby generating the water body ripple model.

[0091] In an optional exemplary embodiment, the water body plane model is a quadrilateral plane model;

[0092] The acquisition module 210 is further configured to:

[0093] The quadrilateral plane model is plane-adjusted so that two opposite sides of the quadrilateral plane model overlap, and the other two opposite sides of the quadrilateral plane model are stretched or compressed, thereby obtaining the circular plane model.

[0094] In an optional exemplary embodiment, the calculation module 220 is further configured to:

[0095] Acquire the ripple flow velocity and time parameters, calculate according to the ripple flow velocity and the time parameters, obtain the intermediate value of the gradient map of the UV map, and superimpose the intermediate value of the gradient map with the preset noise map.

[0096] In an optional exemplary embodiment, the calculation module 220 obtains the intermediate value of the gradient map of the UV map, specifically:

[0097] wave_intensity

[0098] =pow((((1.0-distance(frac((v.texcoord.xy.x+(_speed*_Time.y))),0.5))+-05)*2.0),_power)

[0099] Among them, wave_intensity is the middle value of the gradient map, v.texcoord.xy.x is the texture map Figure 1 The coordinate value of the set coordinate direction, _speed is the ripple flow speed, _Time.y is the time parameter of the system, _power is the preset adjustment variable parameter, frac(x) represents the function of taking the decimal part of x, distance(x,y) represents the function of finding the distance between x and y, and pow(x) represents the exponential function calculation of x.

[0100] In an optional exemplary embodiment, the rendering module 230 is further configured to:

[0101] A preset black-and-white gradient image is obtained, and the target gradient image is superimposed on the black-and-white gradient image to obtain an adjusted target gradient image.

[0102] In an optional exemplary embodiment, the rendering module 230 is further configured to:

[0103] The target gradient image is superimposed using the Fresnel effect.

[0104] In an optional exemplary embodiment, the rendering module 230 is further configured to:

[0105] A noise map of a preset flow map is obtained, and any color channel of the noise map is used to perform superposition processing on the target gradient map.

[0106] Based on the same concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the program, the water ripple generation method described in any of the above embodiments is implemented.

[0107] Figure 7 10 is a schematic diagram showing a more specific hardware structure of an electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other within the device via the bus 1050.

[0108] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0109] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 1020 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.

[0110] The input / output interface 1030 is used to connect input / output modules to implement information input and output. The input / output modules can be configured as components within the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.

[0111] The communication interface 1040 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WiFi, Bluetooth, etc.).

[0112] The bus 1050 comprises a path for transmitting information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).

[0113] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the embodiments of this specification, and does not necessarily include all the components shown in the figure.

[0114] The electronic device of the above embodiment is used to implement the corresponding water ripple generation method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0115] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the water ripple generation method described in any of the above embodiments.

[0116] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0117] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the water ripple generation method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0118] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. Within the scope of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.

[0119] In addition, for simplicity of description and discussion, and in order not to make the embodiment of the application difficult to understand, the known power supply / ground connection with integrated circuit (IC) chip and other components may or may not be shown in the accompanying drawings provided. In addition, the device can be shown in the form of a block diagram to avoid making the embodiment of the application difficult to understand, and this also takes into account the following fact, that is, the details of the embodiment of these block diagram devices are highly dependent on the platform to be implemented in the embodiment of the application (that is, these details should be fully within the scope of understanding of those skilled in the art). When specific details (for example, circuit) are set forth to describe exemplary embodiments of the application, it will be apparent to those skilled in the art that the embodiment of the application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.

[0120] Although the present invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may utilize the embodiments discussed.

[0121] The embodiments of the present application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of this application.

Claims

1. A method for generating water ripples, characterized in that: include: Constructing a water ripple model and obtaining a UV map of the water ripple model; According to the preset noise map, the UV map is superimposed to obtain a target gradient map; Mapping the target gradient map to the water ripple model to render and display the water ripples; Before the UV map is overlaid, the method includes: Acquire a ripple flow velocity and a time parameter, calculate based on the ripple flow velocity and the time parameter, obtain a gradient map intermediate value of the UV map, and superimpose the gradient map intermediate value with the preset noise map; The intermediate value of the gradient map of the UV map is obtained as follows: wave_intensity =pow((((1.0-distance(frac((v.texcoord.xy.x+(_speed*_Time.y)))),0.5))+-0.5)·2.0),_power) Among them, wave_intensity is the middle value of the gradient map, v.texcoord.xy.x is the coordinate value of a set coordinate direction of the texture map, _speed is the ripple flow speed, _Time.y is the time parameter of the system, _power is the preset adjustment variable parameter, frac(x) represents the function of taking the decimal part of x, distance(x,y) represents the function of finding the distance between x and y, and pow(x) represents the exponential function calculation of x.

2. The method according to claim 1, characterized in that The method of constructing a water ripple model includes: Acquire a water body plane model, and determine the plane vertex coordinates of the water body plane model; By adjusting the coordinates of the plane vertices, the water body plane model is adjusted to a circular plane model, thereby generating the water body ripple model.

3. The method according to claim 2, characterized in that The water body plane model is a quadrilateral plane model; The adjusting the water body plane model to a circular plane model comprises: The quadrilateral plane model is plane-adjusted so that two opposite sides of the quadrilateral plane model overlap, and the other two opposite sides of the quadrilateral plane model are stretched or compressed, thereby obtaining the circular plane model.

4. The method according to claim 1, wherein Before mapping the target gradient map to the water ripple model, the method further includes: A preset black-and-white gradient image is obtained, and the target gradient image is superimposed on the black-and-white gradient image to obtain an adjusted target gradient image.

5. The method according to claim 1, wherein Before mapping the target gradient map to the water ripple model, the method further includes: The target gradient image is superimposed using the Fresnel effect.

6. The method according to claim 1, characterized in that Before mapping the target gradient map to the water ripple model, the method further includes: A noise map of a preset flow map is obtained, and any color channel of the noise map is used to perform superposition processing on the target gradient map.

7. A water ripple generating device, characterized in that: include: An acquisition module is used to construct a water ripple model and obtain a UV map of the water ripple model; A calculation module, configured to perform superposition processing on the UV map according to a preset noise map to obtain a target gradient map; A rendering module, configured to map the target gradient map to the water ripple model to render and display the water ripples; Before the UV map is overlaid, the method includes: Acquire a ripple flow velocity and a time parameter, calculate based on the ripple flow velocity and the time parameter, obtain a gradient map intermediate value of the UV map, and superimpose the gradient map intermediate value with the preset noise map; The intermediate value of the gradient map of the UV map is obtained as follows: wave_intensity =pow((((1.0-distance(frac((v.texcoord.xy.x+(_speed*_Time.y))),0.5))+-0.5)*2.0),_power) Among them, wave_intensity is the middle value of the gradient map, v.texcoord.xy.x is the coordinate value of a set coordinate direction of the texture map, _speed is the ripple flow speed, _Time.y is the time parameter of the system, _power is the preset adjustment variable parameter, frac(x) represents the function of taking the decimal part of x, distance(x,y) represents the function of finding the distance between x and y, and pow(x) represents the exponential function calculation of x.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to implement the method according to any one of claims 1 to 6.