CN114742927A - Water body ripple generation method and device, electronic device and storage medium - Google Patents

Water body ripple generation method and device, electronic device and storage medium Download PDF

Info

Publication number
CN114742927A
CN114742927A CN202210307675.5A CN202210307675A CN114742927A CN 114742927 A CN114742927 A CN 114742927A CN 202210307675 A CN202210307675 A CN 202210307675A CN 114742927 A CN114742927 A CN 114742927A
Authority
CN
China
Prior art keywords
map
water body
model
ripple
water
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210307675.5A
Other languages
Chinese (zh)
Inventor
李德哲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202210307675.5A priority Critical patent/CN114742927A/en
Publication of CN114742927A publication Critical patent/CN114742927A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/203D [Three Dimensional] animation
    • G06T13/603D [Three Dimensional] animation of natural phenomena, e.g. rain, snow, water or plants
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering

Abstract

The application provides a water body ripple generation method, equipment, electronic equipment and storage medium, which comprises the following steps: constructing a water body ripple model and obtaining a UV (ultraviolet) map of the water body ripple model; according to a preset noise wave diagram, carrying out superposition processing on the UV map to obtain a target gradual change diagram; and mapping the target gradient map into the water body ripple model so as to render and display water body ripples. According to the method, a water body ripple model is constructed, a UV map of the water body ripple model is obtained through the UV map, a final target gradient map is obtained through combination with a corresponding preset noise map, and final water body ripple is mapped and rendered through the target gradient map. Therefore, the scheme for conveniently and quickly completing the water body corrugation manufacturing and adjusting is provided, and the overall manufacturing efficiency is improved. And the scheme utilizes less pastels to reduce the manufacturing cost, and the manufacturing effect can be quickly checked after adjustment, thereby saving a large amount of manufacturing time.

Description

Water body ripple generation method and device, electronic device and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method and an apparatus for generating water body ripples, an electronic device, and a storage medium.
Background
In the process of drawing a virtual scene, the virtual scene often needs to be rendered through shaders (shaders) in various drawing engines, so as to improve the reality of the virtual scene. However, when creating a large virtual scene, for example, when drawing a ripple such as a ripple on a water surface in a game scene in which a vast lake surface exists, the conventional technique generally creates the scene directly by a K animation method.
However, if the skeleton animation is used, it is very difficult to bind the skeleton capable of making the water wave dynamic. And (4) finishing the binding, and finishing the production again in case of adjustment and modification. The existing scheme is time-consuming, labor-consuming and complex to modify when the corrugations are manufactured, the whole manufacturing efficiency is low, and the user experience is not high.
Disclosure of Invention
In view of this, the present application provides a method, an apparatus, an electronic apparatus, and a storage medium for generating water ripples, so as to conveniently and quickly perform the ripple generation of a virtual scene.
Based on the above purpose, the present application provides a water body ripple generating method, including:
constructing a water body ripple model and obtaining a UV (ultraviolet) map of the water body ripple model;
according to a preset noise wave diagram, carrying out superposition processing on the UV map to obtain a target gradual change diagram;
and mapping the target gradient map into the water body ripple model so as to render and display water body ripples.
In some embodiments, the constructing a water ripple model comprises:
acquiring a water body plane model, and determining plane vertex coordinates of the water body plane model;
and adjusting the plane model of the water body into a circular plane model by adjusting the coordinates of the top point of the plane, so as to generate the ripple model of the water body.
In some embodiments, the planar model of the body of water is a quadrilateral planar model;
the adjusting the water body plane model into a circular plane model comprises:
and carrying out plane adjustment on the quadrilateral plane model to enable two opposite sides of the quadrilateral plane model to be overlapped, and stretching or compressing the other two opposite sides of the quadrilateral plane model to obtain the circular plane model.
In some embodiments, before the superimposing the UV map, the superimposing includes:
and acquiring a ripple flowing speed and a time parameter, calculating according to the ripple flowing speed and the time parameter to obtain a middle value of a gradient map of the UV map, and overlapping the middle value of the gradient map with the preset noise map.
In some embodiments, the obtaining of the middle value of the gradation map of the UV map specifically includes:
wave_intenty
=pow((((1.0-distance(frac((v.texcoord.xy.x+(_speed*_Time.y))),0.5))+-0.5)*2.0),_power)
wherein, wave _ intensity is a middle value of the gradient map, v.texcoord.xy.x is a coordinate value of a set coordinate direction of the texture map, _ speed is a ripple flow speed, _ time.y is a time parameter of the system, _ power is a preset adjusting variable parameter, _ frac (x) represents a function of taking a decimal part of x, distance (x, y) represents a function of solving the distance between x and y, and pow (x) represents that x is subjected to exponential function calculation.
In some embodiments, before the mapping the target gradient map into the water ripple model, the method further comprises:
and acquiring a preset black-and-white gradient image, and overlapping the target gradient image and the black-and-white gradient image to obtain an adjusted target gradient image.
In some embodiments, before the mapping the target gradient map into the water ripple model, the method further comprises:
and performing superposition processing on the target gradient map by utilizing a Fresnel effect.
In some embodiments, before the mapping the target gradient map into the water ripple model, the method further comprises:
and acquiring a noise map of a preset flow map, and performing superposition processing on the target gradient map by using any color channel of the noise map.
Based on the same concept, the present application further provides a water body ripple generating apparatus, including:
the acquisition module is used for constructing a water body ripple model and acquiring a UV (ultraviolet) map of the water body ripple model;
the calculation module is used for carrying out superposition processing on the UV map according to a preset noise wave map to obtain a target gradual change map;
and the rendering module is used for mapping the target gradient map into the water body ripple model so as to render and display the water body ripple.
Based on the same concept, the present application also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the method as described in any one of the above is implemented.
Based on the same concept, the present application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to implement the method of any one of the above.
From the foregoing, it can be seen that the present application provides a water ripple generating method, device, electronic device, and storage medium, including: constructing a water body ripple model and obtaining a UV (ultraviolet) map of the water body ripple model; according to a preset noise wave diagram, carrying out superposition processing on the UV map to obtain a target gradual change diagram; and mapping the target gradient map into the water body ripple model so as to render and display water body ripples. According to the method, a water body ripple model is constructed, a UV map of the water body ripple model is obtained, a final target gradient map is obtained by combining the UV map with a corresponding preset noise map, and the final water body ripple is mapped and rendered through the target gradient map. Therefore, the scheme for conveniently and quickly completing the water body corrugation manufacturing and adjusting is provided, and the overall manufacturing efficiency is improved. And the scheme utilizes less pastels to reduce the manufacturing cost, and the manufacturing effect can be quickly checked after adjustment, thereby saving a large amount of manufacturing time.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments or related technologies, the drawings needed to be used in the description of the embodiments or related technologies are briefly introduced below, it is obvious that the drawings in the following description are only the embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for generating water body ripples according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of a model structure of a water body ripple model according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating an effect of water body waviness according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram illustrating the effects of a UV map and a noise map according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a black and white gradient chart according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a water body ripple generating apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present specification more apparent, the present specification is further described in detail below with reference to the accompanying drawings in combination with specific embodiments.
It should be noted that technical terms or scientific terms used in the embodiments of the present application should have a general meaning as understood by those having ordinary skill in the art to which the present application belongs, unless otherwise defined. The use of "first," "second," and similar terms in the embodiments of the present application do not denote any order, quantity, or importance, but rather the terms are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that a element, article, or method step that precedes the word, and includes the element, article, or method step that follows the word, and equivalents thereof, does not exclude other elements, articles, or method steps. The terms "connected" or "coupled" and the like are not restricted to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", and the like are used only to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
As described in the background art, in the traditional mode of directly using a model for k animation, if the skeleton animation is a skeleton animation, the skeleton animation is difficult to bind, and the skeleton animation is inconvenient to modify and adjust after being manufactured. And if the k model animation is directly carried out, the dynamic is mechanical without water agility. The k animation, the k action and the like refer to the process of animation or action after an animation production engineer binds bones and skins to the model. At present, the traditional manufacturing processes mainly comprise two types: 1) playing the cartoon sequence frame map by using a particle transmitter to realize a ripple effect; 2) a houdini (a three-dimensional computer graphics making software) is used to simulate the ripple effect, a set of sequence models is derived, and then the ripple effect is achieved by the particle launching sequence models. Both of these techniques have some drawbacks. The first technique, with sequential frames, can produce severe stuck phenomena under slow-shots, greatly affecting the artistic expression and user experience. The second technique, model sequence, is not suitable for high-precision effect, the number of models is too large, a large amount of resources are occupied, the second technique is not suitable for mobile equipment platforms, and the second technique is more suitable for some projects of host terminals or terminals. Therefore, a ripple generating scheme is needed at the mobile device end, in which a vivid ripple effect can be generated by using fewer maps, the overhead cost is low, and the ripple effect can be conveniently and quickly adjusted in a shader (shader).
In combination with the above actual situation, an embodiment of the present application provides a water ripple generation scheme, where a water ripple model is constructed, a UV map of the water ripple model is obtained, a final target gradient map is obtained by combining the UV map with a corresponding preset noise map, and the final water ripple is mapped and rendered through the target gradient map. Therefore, the scheme for conveniently and quickly completing the water body corrugation manufacturing and adjusting is provided, and the overall manufacturing efficiency is improved. And the scheme utilizes less pastels to reduce the manufacturing cost, and the manufacturing effect can be quickly checked after adjustment, thereby saving a large amount of manufacturing time.
As shown in fig. 1, a schematic flow chart of a water body ripple generating method proposed by the present application is provided, where the method specifically includes:
step 101, constructing a water body ripple model, and obtaining a UV map of the water body ripple model.
In this step, a model of the waviness of the body of water is generated from a surface model capable of generating waviness, typically a surface model of a solution, such as a water surface model, a water droplet model, a solvent surface model, and the like. Then, the surface model is generally a plane model, and the corrugations are generally an arc model with a certain radian, a water body corrugation model, and also generally a circular model radiating from a central point generated by the corrugations to the periphery, as shown in fig. 2, the water body corrugation model is a model after the plane model is deformed by bending and the like. Furthermore, the basic plane model needs to be bent to generate the water body ripple model, and the water body ripple model is bent to form a ripple basic shape, such as a circular ring or an irregular ring, and the bending process may be bending the model through a preset template, or directly adjusting the basic model by a user engineer, or loading a modifier for bending on the basic model, and directly adjusting the modifier by the user engineer through parameter adjustment or artificial intelligence calculation parameters, and the like. Thereby obtaining a circular or irregular annular water body ripple model. Of course, the specific shape of the water ripple model can be specifically adjusted according to the specific application scenario, and the water ripple model generally corresponds to the approximate shape of the ripple.
And then, acquiring a UV map of the water body ripple model. Generally, a texture is one or several two-dimensional graphics, also called texture maps (texture), representing the surface of an object. When the texture is mapped onto the surface of the object in a specific way, the object can be more truly seen. In the case of three-dimensional animation and game production, UV texture mapping or UVW texture mapping, etc. are generally used. Taking the UV texture map as an example, the UV map is a planar representation of the three-dimensional model surface for easy packing textures, and the U-channel and V-channel refer to the horizontal and vertical axes of a two-dimensional space. Specifically, U, V is short for the coordinates of the UV texture map) which is similar to the X, Y, Z axis of the spatial model). Information defining the position of each point on the picture, which points are interrelated with the three-dimensional model for determining the position of the surface texture map. As if it were a virtual "woundplast," UV is the exact correspondence of each point on the two-dimensional image to the surface of the three-dimensional model object. The position of the gap between the point and the point is subjected to image smoothing interpolation processing by specific software. In this step, after the water body ripple model is determined, the UV map of the water body ripple model may be directly obtained through third-party software or a functional module.
And 102, overlapping the UV maps according to a preset noise wave map to obtain a target gradual change map.
In this step, after the UV map is obtained, calculation of the target gradient map may be performed. The gradient graph is generally an image in which patterns or colors in the graph gradually change with the movement of coordinate axes. In a specific embodiment, the gradient map of the ripple is generally related to propagation velocity of the ripple, initial impact strength (propagation amplitude), model material, and the like, so that the gradient map of the ripple can be calculated based on the UV map by using parameters that affect all or part of the ripple shape. In a specific embodiment, the target gradient map may be driven only for the vertex of the model or the map, and other points are driven by the vertex, that is, the propagation of the ripple may be performed by means of vertex offset. In a specific embodiment, taking calculation of a target gradient map through a propagation speed and a system time as an example, a product of a ripple flow speed and a system time parameter can be superimposed through a value of a U channel of a UV map, a decimal part of a superimposed value result is determined, a distance between a position corresponding to the decimal part of the superimposed value result and a central position is determined, and an index is obtained by combining with a regulating variable, so that a gradient map is finally obtained, wherein the gradient map can be an intermediate gradient map or can be directly applied as a final gradient map. When the gradient graph is used as the middle gradient graph, the preset noise graph can be combined to adjust the gradient graph to be more corresponding to the shape of the ripple. In a specific embodiment, the preset noise maps may be tessen polygons, i.e., voronoi maps, black-and-white noise maps, and the like, and these noise maps are combined with the intermediate patterns calculated by the UV map in a multiplication manner to obtain the final target gradient map. Then, in some embodiments, the shape of the ripple may be further adjusted, such as edge hooking, disturbance, and the like, so that the ripple better conforms to the environment of the basic model, and the ripple effect is more real.
In some embodiments, coordinates of the more edges of the UV map corresponding to the ripples may be determined, and coordinates of these locations may be determined using the distance from the center. For a ring of corrugations, it is essentially a ring or a disc, so that the corrugation can be made by adjusting its edge. Then, since the UV map is substantially a coordinate map, the position information of each point in the image is reflected. So that the coordinates of the edges of the intermediate model can be accurately determined based on the coordinate values (UV values, etc.).
Step 103, mapping the target gradient map to the water body ripple model to render and display water body ripples.
In this step, the calculated target gradient map is mapped onto the water body ripple model, so that coordinates (e.g., vertex coordinates) of each point of the water body ripple model are correspondingly adjusted through the target gradient map, and rendering is performed in this way, so that corresponding water body ripples are finally generated. As shown in fig. 3, the target gradient map is mapped onto the water ripple model, and then the water ripple is rendered.
The water ripple may then be output for storage, display, use, or reprocessing. According to different application scenes and implementation requirements, the specific output mode of the water body ripple can be flexibly selected.
For example, for an application scenario in which the method of the present embodiment is executed on a single device, the water ripple may be directly output in a display manner on a display unit (a display, a projector, etc.) of the current device, so that an operator of the current device can directly see the content of the water ripple from the display unit.
For another example, for an application scenario executed by a system composed of multiple devices by the method of this embodiment, the water ripple may be sent to other preset devices serving as receivers in the system, that is, the synchronization terminal, through any data communication manner (such as wired connection, NFC, bluetooth, wifi, cellular mobile network, etc.), so that the synchronization terminal may perform subsequent processing on the water ripple. Optionally, the synchronization terminal may be a preset server, the server is generally arranged at a cloud end, and is used as a data processing and storage center, which can store and distribute the water ripple; where the recipients of the distribution are terminal devices, the holders or operators of these terminal devices may be current users, downstream games, animators, games, quality supervisors of animations, and so on.
For another example, for an application scenario executed by a system composed of multiple devices, the method of this embodiment may directly send the water body ripple to a preset terminal device through any data communication manner, where the terminal device may be one or more of the foregoing paragraphs.
From the foregoing, it can be seen that a method for generating waviness of a water body according to an embodiment of the present application includes: constructing a water body ripple model and obtaining a UV (ultraviolet) map of the water body ripple model; according to a preset noise wave diagram, carrying out superposition processing on the UV map to obtain a target gradual change diagram; and mapping the target gradient map into the water body ripple model so as to render and display water body ripples. According to the method, a water body ripple model is constructed, a UV map of the water body ripple model is obtained through the UV map, a final target gradient map is obtained through combination with a corresponding preset noise map, and final water body ripple is mapped and rendered through the target gradient map. Therefore, the scheme for conveniently and quickly completing the water body corrugation manufacturing and adjusting is provided, and the overall manufacturing efficiency is improved. And the scheme utilizes less pastels to reduce the manufacturing cost, and the manufacturing effect can be quickly checked after adjustment, thereby saving a large amount of manufacturing time.
It should be noted that the method of the embodiment of the present application may be executed by a single device, such as a computer or a server. The method of the embodiment of the application can also be applied to a distributed scene and is completed by the mutual cooperation of a plurality of devices. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiment, and the multiple devices interact with each other to complete the method.
It should be noted that the above-mentioned description describes specific embodiments of the present application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments described above and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
In an alternative exemplary embodiment, the constructing a water ripple model includes: acquiring a water body plane model, and determining plane vertex coordinates of the water body plane model; and adjusting the plane model of the water body into a circular plane model by adjusting the coordinates of the top point of the plane, so as to generate the water body ripple model. Therefore, the water body plane model is quickly adjusted in a mode of adjusting the water body plane model into the circular plane model, so that the water body plane model becomes a desired water body ripple model.
In this embodiment, the water plane model is a surface model capable of generating ripples, such as a water surface model, a water drop model, a solvent surface model, and the like. Because the ripple is a local phenomenon in the water surface, a small water body plane model can be selected to create the water body ripple model, for example, a rectangular or square water body plane model is set. And then, after the model is determined, corresponding vertexes, vertex coordinates and the like are all determined, and a circular plane model can be finally generated by adjusting the vertex coordinates of the water body plane model to serve as a water body ripple model.
In a specific embodiment, the planar model may be adjusted by using some third-party three-dimensional modeling software, such as 3Dmax, etc., in which a bend modifier is usually provided. In the software, the plane of the water body plane model can be adjusted by the bending modifier in a mode of directly loading the bending modifier on the water body plane model, so that the bending is realized according to the setting or the adjustment of a user. The loading of the bend modifier may also be performed by first adding the bend modifier to a particular mold and then loading the mold onto the water body planar model. As shown in fig. 2, the water body plane model is adjusted by using modeling software such as 3Dmax, and the final generated model is the water body ripple model. In a specific embodiment, for factors such as the magnitude of the specific bending adjustment, i.e. the size of the ripple that is desired to be reflected, the animation itself is involved, so that an animation engineer needs to actively adjust and set, and the system performs, i.e. obtains the setting information for the bending modifier.
In one embodiment, the adjustment to the water plane model may be performed by creating a patch. The patch is a graph between two-dimensional and three-dimensional, and has a three-dimensional surface, but the two-dimensional spline curve is kept, and the curved surface effect can be achieved by adjusting the Bezier handle. Therefore, in three-dimensional modeling software, a patch is generally used to produce soft cloth (clothes, tablecloth, bedspread, etc.), mountainous regions, water surface, etc. In a specific application scenario, an adjusting patch capable of covering a water body plane model can be created in three-dimensional modeling software such as 3Dmax, then a band modifier is added on the adjusting patch, finally the adjusting patch added with the band modifier is loaded to a base model, and an animation engineer sets the band modifier to complete bending of the base model.
In an alternative exemplary embodiment, the water body plane model is a quadrilateral plane model; the adjusting the plane model of the water body into a circular plane model comprises: and carrying out plane adjustment on the quadrilateral plane model to enable two opposite sides of the quadrilateral plane model to be overlapped, and stretching or compressing the other two opposite sides of the quadrilateral plane model to obtain the circular plane model.
In the present embodiment, the quadrangular plane model may be a rectangular plane model or a square plane model, or the like. Taking a rectangular plane model as an example, which is a rectangle in a plan view, when performing adjustment, the whole rectangle can be bent and stretched in the plane so that two short sides of the rectangle are overlapped. In order to accomplish this adjustment, one of the two long sides of the adjustment must be stretched and the other compressed, and finally, 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. Similar operations may of course be performed for square planar models, parallelogram planar models, rhomboid planar models, etc. The person skilled in the art can make specific adjustments to the quadrilateral planar model according to specific application scenarios.
In an optional exemplary embodiment, before the overlaying the UV map, the method includes: and acquiring a ripple flowing speed and a time parameter, calculating according to the ripple flowing speed and the time parameter to obtain a middle value of a gradual change graph of the UV mapping, and overlapping the middle value of the gradual change graph and the preset noise graph.
In this embodiment, the ripple flow velocity is the propagation velocity of ripples, for example, after a stone is thrown into a lake, the propagation velocity of ripples generated is determined by the water entry velocity and water entry volume of the stone, and the animation engineer may directly give a value of the ripple flow velocity. The time parameter is then a system time parameter, which may be given by an engineer or may be calculated or statistically derived, for example by counting the time that starts when a stone is thrown into the lake and giving it. Furthermore, a middle gradient map, i.e., a gradient map median, can be generated by combining the coordinate values of the individual points in the UV map using the ripple flow rate and the time parameter. The specific calculation process may be:
wave_intensity
=pow((((1.0-distance(frac((v.texcoord.xy.x+(_speed*_Time.y))),0.5))+-05)*2.0),_power)
wherein, wave _ intensity is a middle value of the gradient map, v.texcoord.xy.x is a coordinate value of a set coordinate direction of the texture map, _ speed is a ripple flow speed, _ time.y is a system time parameter, and _ power is a preset adjusting variable parameter. frac (x) represents a function that takes the fractional part of x, in this example the fractional part of the calculated result ((v.texcoord. xy. x + (_ speed. time. y))); distance (x, y) represents a function of the distance between x and y, in this embodiment, the distance (frac ((v.texcoord.xy.x + (_ speed _ time.y))), 0.5); pow (x) indicates that the exponential function calculation is performed, in this embodiment, on (((1.0-discrete from v.texcoord. xy.x + _ speed _ time. y, 0.5+ -0.5 x 2.0, _ power).
And finally, after the calculation of the intermediate value of the gradient map is finished, superposing the intermediate value with a preset noise map to finally obtain a target gradient map. In an embodiment, the predetermined noise map may be a Thiessen polygonal noise map. The Thiessen polygons are Voronoi diagrams, which are called Voronoi diagramas (Voronoi diagramas), and are a group of continuous polygons formed by perpendicular bisectors connecting two adjacent point line segments. Any point within a Thiessen polygon is less distant from the control points that make up the polygon than from the control points of other polygons. The noise map is a map reflecting noise. In the field of three-dimensional animation production, noise can provide a waveform diagram with random positions for vertexes, and in the production of a three-dimensional model, the established plane is mainly irregular, uneven and the like. Such as land, cave, etc., the surface of which is irregular in real life, and in order to make the land, cave, etc. in the virtual scene more realistic, it is necessary to load random noise maps, and it is difficult to accurately model using ordinary modeling. In a specific application scenario, the noise map of the voronoi diagram may be set in advance, or may be obtained by directly performing noise calculation using three-dimensional modeling software after obtaining a preset voronoi diagram. The gradient map intermediate values are then superimposed with a preset noise map, such as a Thiessen polygonal noise map. As shown in fig. 4, in which fig. 4a is a middle value of the gradient map in an embodiment, and fig. 4b is a taisen polygon noise map, in an embodiment, the process of superposition is to multiply the channel value or the gray value, etc. of each point calculated from the middle value of the gradient map by the channel value or the gray value, etc. at the same position of the taisen polygon noise map. And finally obtaining a target gradient graph.
In an optional exemplary embodiment, before mapping the target gradient map into the water ripple model, the method further includes: and acquiring a preset black-and-white gradient image, and overlapping the target gradient image and the black-and-white gradient image to obtain an adjusted target gradient image.
The amplitude of the ripple of the target gradient map obtained after the intermediate value of the gradient map is superposed with a preset noise map such as a Thiessen polygonal noise map is the same, that is, the amplitude of the ripple obtained by using the target gradient map is the same no matter how far away the ripple is from the central point of the ripple. Such a ripple map can thus only be used in certain scenarios. In a more realistic scene, the effect of the ripples is that the closer to the central point, the larger the amplitude of the ripples, and the farther from the central point, the smaller the amplitude of the ripples until the ripples disappear. So that further adjustments to the target gradient map may be made. In this embodiment, the above effect can be achieved by adding a black and white gradient map. As shown in fig. 5, the black-and-white gradient map is a normal gradient map gradually changing from black to white, and the adjustment of the target gradient map can be completed by a superposition manner such as multiplication of the target gradient map and the black-and-white gradient map, so as to generate a distance effect. For example, the darker part of the black-and-white gradient map is set to be a position closer to the central point, so that the assignment can be targeted at the assignment, or the distance from the central point can be reflected by the color value (the color value range is generally 0 to 255) of each point of the black-and-white gradient map. Finally, the adjusted target gradient graph is obtained, and the effects of small remote fluctuation and large central fluctuation are achieved.
In an optional exemplary embodiment, before mapping the target gradient map into the water ripple model, the method further includes:
and performing superposition processing on the target gradient map by utilizing a Fresnel effect.
In the present embodiment, the fresnel effect refers to: certain materials exhibit different reflection effects at different distances. The fresnel effect has the following meaning: when light travels from one medium having a refractive index to another medium having a refractive index, reflection and refraction of the light may occur simultaneously at the interface (generally referred to as an interface) of the two. The fresnel equations describe the cases where different light wave components are refracted and reflected. In three-dimensional modeling software, the method can be directly set, so that the system can automatically adjust the map by utilizing the Fresnel effect. In this embodiment, the finished target gradient map may be further processed by edge-pointing through the fresnel effect, so that the generated moire map is more natural and vivid. Wherein, the edge-pointing is one of the conventional steps of drawing.
In an optional exemplary embodiment, before mapping the target gradient map into the water body ripple model, the method further includes: and acquiring a noise map of a preset flow map, and performing superposition processing on the target gradient map by using any color channel of the noise map.
In this embodiment, since in a real scene, the ripples may also be influenced by the flow of the fluid represented by the basic model, for example, the flow of the water surface may cause a perturbation phenomenon in the direction of the water flow motion caused by the ripples. Therefore, after the target gradient map is obtained, the target gradient map can be further modified through a preset noise map of the flow map, so that the target gradient map adapts to the influence of the flow of the fluid presented by the water body model. Then, each point in the map corresponds to at least three color channels, that is, R, G, B channels, so as to reflect the color of each point, and further, in a specific application, the flow disturbance can be reflected by directly obtaining the value (for example, the value of the R channel) of any one channel of each point on the noise map of the preset flow map. And then, the value of the channel can be directly added on the basis of the value of each point of the target gradient map to realize the final disturbance effect of the fluid flow.
Based on the same concept, the application also provides water body ripple generating equipment corresponding to the method of any embodiment.
Referring to fig. 6, the water ripple generating apparatus comprises:
the obtaining module 210 is configured to construct a water ripple model and obtain a UV map of the water ripple model;
the calculation module 220 is configured to perform superposition processing on the UV map according to a preset noise map to obtain a target gradient map;
and a rendering module 230, configured to map the target gradient map into the water ripple model, so as to render and display water ripple.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functions of the modules may be implemented in the same software and/or hardware or in multiple software and/or hardware when implementing the embodiments of the present application.
The device of the foregoing embodiment is used to implement the corresponding water body ripple generation method in the foregoing embodiment, and has the beneficial effects of the corresponding water body ripple generation method embodiment, which are not described herein again.
In an optional exemplary embodiment, the obtaining module 210 is further configured to:
acquiring a water body plane model, and determining plane vertex coordinates of the water body plane model;
and adjusting the plane model of the water body into a circular plane model by adjusting the coordinates of the top point of the plane, so as to generate the ripple model of the water body.
In an alternative exemplary embodiment, the water body plane model is a quadrilateral plane model;
the obtaining module 210 is further configured to:
and carrying out plane adjustment on the quadrilateral plane model to enable two opposite sides of the quadrilateral plane model to be overlapped, and stretching or compressing the other two opposite sides of the quadrilateral plane model to obtain the circular plane model.
In an alternative exemplary embodiment, the calculating module 220 is further configured to:
and acquiring a ripple flowing speed and a time parameter, calculating according to the ripple flowing speed and the time parameter to obtain a middle value of a gradient map of the UV map, and overlapping the middle value of the gradient map with the preset noise map.
In an optional exemplary embodiment, the calculating module 220 obtains a middle value of the transition map of the UV map, specifically:
wave_intensity
=pow((((1.0-distance(frac((v.texcoord.xy.x+(_speed*_Time.y))),0.5))+-05)*2.0),_power)
wherein, wave _ intensity is a middle value of the gradient map, v.texcoord.xy.x is a coordinate value of a set coordinate direction of the texture map, _ speed is a ripple flow speed, _ time.y is a time parameter of the system, _ power is a preset adjusting variable parameter, frac (x) represents a function of taking a fractional part of x, distance (x, y) represents a function of solving the distance between x and y, and pow (x) represents that x is subjected to exponential function calculation.
In an optional exemplary embodiment, the rendering module 230 is further configured to:
and acquiring a preset black-and-white gradient image, and overlapping the target gradient image and the black-and-white gradient image to obtain an adjusted target gradient image.
In an optional exemplary embodiment, the rendering module 230 is further configured to:
and performing superposition processing on the target gradient map by utilizing a Fresnel effect.
In an optional exemplary embodiment, the rendering module 230 is further configured to:
and acquiring a noise map of a preset flow map, and performing superposition processing on the target gradient map by using any color channel of the noise map.
Based on the same concept, corresponding to the method of any embodiment, the present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, the method for generating water body waves according to any embodiment is implemented.
Fig. 7 is a schematic diagram illustrating a more specific hardware structure of an electronic device according to this embodiment, where the electronic device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 1050 includes a path that transfers information between various components of the device, such as processor 1010, memory 1020, input/output interface 1030, and communication interface 1040.
It should be noted that although the above-mentioned 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, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
The electronic device of the above embodiment is used to implement the corresponding water body ripple generation method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
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 storing computer instructions for causing the computer to execute the water body ripple generation method according to any of the above-mentioned embodiments.
Computer-readable media of the present embodiments, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
The computer instructions stored in the storage medium of the foregoing embodiment are used to enable the computer to execute the water body ripple generation method according to any one of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiment, which are not described herein again.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the context of the present application, features from the above embodiments or from different embodiments may also be combined, 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 brevity.
In addition, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown in the provided figures for simplicity of illustration and discussion, and so as not to obscure the embodiments of the application. Furthermore, devices may be shown in block diagram form in order to avoid obscuring embodiments of the application, and this also takes into account the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the embodiments of the application are to be implemented (i.e., specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the application, it should be apparent to one skilled in the art that the embodiments of the application can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative instead of restrictive.
While the present application has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic ram (dram)) may use the discussed embodiments.
The present embodiments are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present application are intended to be included within the scope of the present application.

Claims (11)

1. A method of generating waviness in a body of water, comprising:
constructing a water body ripple model and obtaining a UV (ultraviolet) map of the water body ripple model;
according to a preset noise wave diagram, carrying out superposition processing on the UV map to obtain a target gradual change diagram;
and mapping the target gradient map into the water body ripple model so as to render and display the water body ripple.
2. The method of claim 1, wherein constructing a water ripple model comprises:
acquiring a water body plane model, and determining plane vertex coordinates of the water body plane model;
and adjusting the plane model of the water body into a circular plane model by adjusting the coordinates of the top point of the plane, so as to generate the ripple model of the water body.
3. The method of claim 2, wherein the water body plane model is a quadrilateral plane model;
the adjusting the water body plane model into a circular plane model comprises:
and carrying out plane adjustment on the quadrilateral plane model to enable two opposite sides of the quadrilateral plane model to be overlapped, and stretching or compressing the other two opposite sides of the quadrilateral plane model to obtain the circular plane model.
4. The method of claim 1, wherein prior to the superimposing the UV map, comprising:
and acquiring a ripple flowing speed and a time parameter, calculating according to the ripple flowing speed and the time parameter to obtain a middle value of a gradual change graph of the UV mapping, and overlapping the middle value of the gradual change graph and the preset noise graph.
5. The method according to claim 4, wherein the obtaining of the intermediate gradation map value of the UV map comprises:
Figure FDA0003566247320000011
wherein, wave _ intensity is a middle value of the gradient map, v.texcoord.xy.x is a coordinate value of a set coordinate direction of the texture map, _ speed is a ripple flow speed, _ time.y is a time parameter of the system, _ power is a preset adjusting variable parameter, frac (x) represents a function of taking a fractional part of x, distance (x, y) represents a function of solving the distance between x and y, and pow (x) represents that x is subjected to exponential function calculation.
6. The method of claim 1, wherein prior to mapping the target gradient map into the water ripple model, further comprising:
and acquiring a preset black-and-white gradient image, and overlapping the target gradient image and the black-and-white gradient image to obtain an adjusted target gradient image.
7. The method of claim 1, wherein prior to mapping the target gradient map into the water ripple model, further comprising:
and performing superposition processing on the target gradient map by utilizing a Fresnel effect.
8. The method of claim 1, wherein prior to mapping the target gradient map into the water ripple model, further comprising:
and acquiring a noise mapping of a preset flow mapping, and performing superposition processing on the target gradual change map by using any color channel of the noise mapping.
9. A water ripple generating apparatus, comprising:
the acquisition module is used for constructing a water body ripple model and acquiring a UV (ultraviolet) map of the water body ripple model;
the calculation module is used for carrying out superposition processing on the UV map according to a preset noise wave map to obtain a target gradual change map;
and the rendering module is used for mapping the target gradient map into the water body ripple model so as to render and display the water body ripple.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 8 when executing the program.
11. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to implement the method of any one of claims 1 to 8.
CN202210307675.5A 2022-03-25 2022-03-25 Water body ripple generation method and device, electronic device and storage medium Pending CN114742927A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210307675.5A CN114742927A (en) 2022-03-25 2022-03-25 Water body ripple generation method and device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210307675.5A CN114742927A (en) 2022-03-25 2022-03-25 Water body ripple generation method and device, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN114742927A true CN114742927A (en) 2022-07-12

Family

ID=82276658

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210307675.5A Pending CN114742927A (en) 2022-03-25 2022-03-25 Water body ripple generation method and device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN114742927A (en)

Similar Documents

Publication Publication Date Title
US11024077B2 (en) Global illumination calculation method and apparatus
CN105678683B (en) A kind of two-dimensional storage method of threedimensional model
US9710951B2 (en) Techniques for processing image data generated from three-dimensional graphic models
US20120113106A1 (en) Method and apparatus for generating face avatar
CN102289845B (en) Three-dimensional model drawing method and device
US20170091992A1 (en) Hierarchical continuous level of detail for three-dimentional meshes
KR20080090671A (en) Apparatus and method for mapping textures to object model
CN110115841B (en) Rendering method and device for vegetation object in game scene
KR101591427B1 (en) Method for Adaptive LOD Rendering in 3-D Terrain Visualization System
CN113457137B (en) Game scene generation method and device, computer equipment and readable storage medium
WO2008134147A1 (en) Edge effect
JP2012190428A (en) Stereoscopic image visual effect processing method
RU2680355C1 (en) Method and system of removing invisible surfaces of a three-dimensional scene
CN109712226A (en) The see-through model rendering method and device of virtual reality
CN109584377A (en) A kind of method and apparatus of the content of augmented reality for rendering
CN102693065A (en) Method for processing visual effect of stereo image
CN112516595B (en) Magma rendering method, device, equipment and storage medium
CN109697748A (en) Model compression processing method, model pinup picture processing method device, storage medium
CN104657097A (en) Method and device for displaying wave-shaped dynamic image
US8952968B1 (en) Wave modeling for computer-generated imagery using intersection prevention on water surfaces
US11100707B2 (en) Computer graphics method for terrain rendering
CN108230430A (en) The processing method and processing device of cloud layer shade figure
CN114742927A (en) Water body ripple generation method and device, electronic device and storage medium
US10636210B2 (en) Dynamic contour volume deformation
CN112560126A (en) Data processing method, system and storage medium for 3D printing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination