CN112819929B - Method and device for rendering water surface, electronic equipment, and storage media - Google Patents
Method and device for rendering water surface, electronic equipment, and storage media Download PDFInfo
- Publication number
- CN112819929B CN112819929B CN202110246298.4A CN202110246298A CN112819929B CN 112819929 B CN112819929 B CN 112819929B CN 202110246298 A CN202110246298 A CN 202110246298A CN 112819929 B CN112819929 B CN 112819929B
- Authority
- CN
- China
- Prior art keywords
- water surface
- highlight
- parameter
- parameters
- map
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T13/00—Animation
- G06T13/20—3D [Three Dimensional] animation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/50—Lighting effects
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Graphics (AREA)
- Geometry (AREA)
- Software Systems (AREA)
- Image Generation (AREA)
- Processing Or Creating Images (AREA)
Abstract
The application provides a method and a device for rendering water surface, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a water surface model and a simulated point light source; generating a water surface highlight parameter of the water surface model according to the illumination intensity of the simulated point light source; acquiring an angle parameter and a distance parameter of the simulated point light source; processing the water surface highlight parameters according to the angle parameters and the distance parameters to obtain a water surface highlight map; and performing highlight rendering on the water surface model based on the water surface highlight map to obtain a highlight effect of the water surface model. According to the embodiment of the application, the water surface is rendered by simulating the relevant parameters of the point light source, PBR directional light is not needed, the calculated amount is small, the water surface highlight effect is corresponding to the luminous model, and the water surface highlight presenting effect is lifelike.
Description
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to a method and apparatus for rendering a water surface, an electronic device, and a storage medium.
Background
In a game or animation scene, it is often necessary to render a virtual sea surface. Sea surfaces often have wave-like relief, as well as sun highlights, and reflection and refraction effects. When making solar highlights on the sea surface, PBR (physical-based rendering) direction light is generally adopted, and there is a problem that reflection and depth map performance are consumed greatly.
Disclosure of Invention
In view of the foregoing, the present application has been made to provide a water surface rendering method and apparatus, an electronic device, a storage medium, which overcome or at least partially solve the foregoing problems, including:
a method of rendering a water surface, comprising:
acquiring a water surface model and a simulated point light source;
generating a water surface highlight parameter of the water surface model according to the illumination intensity of the simulated point light source;
acquiring an angle parameter and a distance parameter of the simulated point light source;
processing the water surface highlight parameters according to the angle parameters and the distance parameters to obtain a water surface highlight map;
and performing highlight rendering on the water surface model based on the water surface highlight map to obtain a highlight effect of the water surface model.
Optionally, the generating the water surface highlight parameter of the water surface model according to the illumination intensity of the simulated point light source includes:
acquiring a normal value of the water surface model;
and generating a water surface highlight parameter of the water surface model by adopting a preset illumination model according to the normal value and the illumination intensity of the simulated point light source.
Optionally, the processing the water surface highlight parameter according to the angle parameter and the distance parameter to obtain a water surface highlight map includes:
carrying out shielding treatment on the water surface highlight parameters according to the angle parameters to obtain first water surface highlight parameters;
carrying out attenuation treatment on the first water surface highlight parameter according to the distance parameter to obtain a second water surface highlight parameter;
and generating a water surface highlight map according to the second water surface highlight parameter.
Optionally, the attenuating the first water surface highlight parameter according to the distance parameter to obtain a second water surface highlight parameter includes:
obtaining attenuation parameters according to the distance parameters and a preset attenuation rule;
and carrying out attenuation treatment on the first water surface highlight parameter according to the attenuation parameter to obtain a second water surface highlight parameter.
Optionally, the shielding processing is performed on the water surface highlight parameter according to the angle parameter to obtain a first water surface highlight parameter, including:
performing product operation on the water surface highlight parameter and the angle parameter to obtain a first water surface highlight parameter;
the attenuating treatment is carried out on the first water surface highlight parameter according to the attenuating parameter to obtain a second water surface highlight parameter, and the method comprises the following steps:
and performing product operation on the first water surface highlight parameter and the attenuation parameter to obtain a second water surface highlight parameter.
Optionally, before the highlight rendering is performed on the water surface model based on the water surface highlight map to obtain the highlight effect of the water surface model, the method further includes:
acquiring basic color parameters of the water surface model;
correcting the basic color parameters by adopting a Fresnel formula to obtain target basic color parameters;
obtaining reflection parameters from a preset reflection map;
and processing the water surface highlight map according to the target basic color parameters and the reflection parameters.
Optionally, before the highlight rendering is performed on the water surface model based on the water surface highlight map to obtain the highlight effect of the water surface model, the method further includes:
and adjusting the transparency of the water surface highlight map.
A surface rendering device comprising:
the first acquisition module is used for acquiring a water surface model and an analog point light source;
the first generation module is used for generating a water surface highlight parameter of the water surface model according to the illumination intensity of the simulated point light source;
the second acquisition module is used for acquiring the angle parameter and the distance parameter of the simulated point light source;
the second generation module is used for processing the water surface highlight parameters according to the angle parameters and the distance parameters to obtain a water surface highlight map;
and the water surface rendering module is used for performing highlight rendering on the water surface model based on the water surface highlight map so as to obtain the highlight effect of the water surface model.
Optionally, the first generating module includes:
the normal value acquisition module is used for acquiring the normal value of the water surface model;
and a preset model generation module is adopted and is used for generating the water surface highlight parameters of the water surface model by adopting a preset illumination model according to the normal value and the illumination intensity of the simulated point light source.
Optionally, the second generating module includes:
the shielding processing module is used for shielding the water surface highlight parameter according to the angle parameter to obtain a first water surface highlight parameter;
the attenuation processing module is used for carrying out attenuation processing on the first water surface highlight parameter according to the distance parameter to obtain a second water surface highlight parameter;
and the map generation module is used for generating a water surface highlight map according to the second water surface highlight parameter.
Optionally, the attenuation processing module includes:
the attenuation parameter obtaining module is used for obtaining attenuation parameters according to the distance parameters and preset attenuation rules;
and the attenuation parameter processing module is used for carrying out attenuation processing on the first water surface highlight parameter according to the attenuation parameter to obtain a second water surface highlight parameter.
Optionally, the shielding processing module is specifically configured to perform product operation on the water surface highlight parameter and the angle parameter to obtain a first water surface highlight parameter;
the attenuation processing module is specifically configured to perform product operation on the first water surface highlight parameter and the attenuation parameter, so as to obtain a second water surface highlight parameter.
Optionally, the apparatus further comprises:
the color parameter acquisition module is used for acquiring basic color parameters of the water surface model;
the Fresnel processing module is used for correcting the basic color parameters by adopting a Fresnel formula to obtain target basic color parameters;
the reflection parameter acquisition module is used for acquiring reflection parameters from a preset reflection map;
and the highlight map processing module is used for processing the water surface highlight map according to the target basic color parameters and the reflection parameters.
Optionally, the apparatus further comprises:
and the transparency adjusting module is used for adjusting the transparency of the water surface highlight map.
An electronic device comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, which when executed by the processor, performs the steps of the method of rendering a surface of water as described above.
A computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of a method of rendering a surface of water as described above.
The application has the following advantages:
in the embodiment of the application, a water surface model and a simulated point light source are obtained, and according to the illumination intensity of the simulated point light source, the water surface highlight parameter of the water surface model is generated; acquiring angle parameters and distance parameters of the simulated point light source, and processing the water surface highlight parameters according to the angle parameters and the distance parameters to obtain a water surface highlight map; and performing highlight rendering on the water surface model based on the water surface highlight map to obtain a highlight effect of the water surface model. According to the embodiment of the application, the water surface is rendered by simulating the relevant parameters of the point light source, PBR directional light is not needed, the calculated amount is small, the water surface highlight effect is corresponding to the luminous model, and the water surface highlight presenting effect is lifelike.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings that are needed in the description of the present application will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a flow chart of steps of a method for rendering a water surface according to an embodiment of the present application;
FIG. 2 is an exemplary diagram of an effect of rendering a water surface according to the prior art;
FIG. 3 is an exemplary diagram of the effect of rendering a map using a water surface highlight parameter according to an embodiment of the present application;
FIG. 4 is an exemplary view showing the effect of visualizing angle parameters and distance parameters for an analog point light source in an embodiment of the present application;
FIG. 5 is an exemplary diagram of the effect corresponding to FIG. 3 after being processed by the angle parameter and the distance parameter;
FIG. 6 is an exemplary diagram of an effect of rendering a water surface for the scene shown in FIG. 2 according to an embodiment of the present application;
FIG. 7 is an exemplary diagram of the effect of FIG. 5 after processing the target color parameters and reflection parameters;
fig. 8 is a block diagram of a water surface rendering device according to an embodiment of the present application.
Detailed Description
In order that the above-recited objects, features and advantages of the present application will become more readily apparent, a more particular description of the invention briefly described above will be rendered by reference to specific embodiments that are illustrated in the appended drawings. It will be apparent that the embodiments described are some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Referring to fig. 1, a water surface rendering method provided in an embodiment of the present application is shown, where the method may be applied to a mobile terminal, and the mobile terminal may include an electronic device such as a smart phone, a tablet computer, a game console, and the like.
In an embodiment of the present application, the method specifically may include the following steps:
step 101, acquiring a water surface model and a simulated point light source;
102, generating a water surface highlight parameter of the water surface model according to the illumination intensity of the simulated point light source;
step 103, obtaining angle parameters and distance parameters of the simulated point light source;
104, processing the water surface highlight parameters according to the angle parameters and the distance parameters to obtain a water surface highlight map;
and 105, performing highlight rendering on the water surface model based on the water surface highlight map to obtain a highlight effect of the water surface model.
According to the embodiment of the application, the water surface model and the simulated point light source are obtained, the water surface highlight parameters of the water surface model are generated according to the illumination intensity of the simulated point light source, the angle parameters and the distance parameters of the simulated point light source are obtained, the water surface highlight map is obtained by processing the water surface highlight parameters according to the angle parameters and the distance parameters, and the water surface model is subjected to highlight rendering so as to obtain the highlight effect of the water surface model based on the water surface highlight map. According to the embodiment of the application, the relative parameters of the point light source are simulated to render the water surface, PBR directional light is not needed, the calculated amount is small, the water surface highlight effect is corresponding to the luminous model, and the water surface highlight presenting effect is lifelike.
Next, a water surface rendering method in the present exemplary embodiment will be further described with reference to fig. 2 to 7.
In step 101, a water surface model and a simulated point light source are acquired.
In the embodiment of the application, the user interface can be rendered on the display of the mobile terminal by running the software application on the mobile terminal, wherein the user interface comprises a virtual scene, and the virtual scene comprises a virtual model. In the embodiment of the application, when the virtual model includes a water surface model and an art lighting model, the water surface needs to be subjected to high-gloss rendering. The artistic lighting model may be an artistic sun model, an artistic moon model, or the like. An example of an art sun model will be described below.
It should be emphasized that the art solar model in the embodiments of the present application is a fixed art model that does not provide illumination, and needs to be distinguished from the solar model in the three-dimensional rendering engine. Generally, a solar model in a three-dimensional rendering engine refers to a physical model that provides illumination for a virtual scene.
As shown in fig. 2, fig. 2 is an exemplary view of effects on rendering a water surface in the prior art. In the virtual scene of fig. 2, which includes a water model and a lighting model 201 and an art sun model 202, rendering the water surface includes highlight rendering, and highlight refers to a concentrated highlight area, i.e., a highlight point, generated by the virtual model being irradiated by light. This phenomenon is that light is specularly reflected in the region of the virtual model that is vertically illuminated. For the virtual scene of fig. 2, since the default solar model in the three-dimensional rendering engine is the light emitting model 201, when the water surface is rendered in the prior art, the solar model in the three-dimensional rendering engine is combined with PBR direction light to generate water surface highlight, so as to obtain the rendering effect shown in fig. 2, and the water surface highlight is not emitted from the art solar model 202, so that the water surface highlight effect is obviously different from the real scene.
In this embodiment, the simulated point light source is disposed at a position of the art sun model, and unlike using the point light source in the scene, the simulated point light source in this embodiment does not affect the virtual model other than the water surface model.
In a specific implementation, a built-in simulated point light source can be written in the material of the water surface model through the shader, the position of the simulated point light source is determined by the position of the art sun model, and the illumination color and intensity of the simulated point light source can be determined by a designer in combination with the requirement of the display effect of the virtual scene and actual experience.
When the water surface rendering method provided by the embodiment of the application is used for performing high-gloss rendering on the water surface, a water surface model and a simulated point light source in a virtual scene are required to be acquired first. Before this, it may further include:
and when the virtual scene reaches the preset water surface highlight processing condition, acquiring the position of the art sun model and the water surface model in the virtual scene.
The preset water surface highlight processing conditions comprise an art sun model and a water surface model in the virtual scene.
Specifically, whether the virtual scene contains an art sun model and a water surface model can be detected in a model matching mode. And in the process of running the software application, when the fact that the virtual scene displayed by the user interface simultaneously contains the art sun model and the water surface model is detected, determining that the virtual scene reaches the preset water surface highlight processing condition.
The virtual scene can also be determined to reach the preset water surface highlight processing condition in a mode of responding to the command. For example, in a virtual scene design stage, a user may designate one art model in a virtual scene as an art sun model for a subsequent rendering stage, and one water surface model as a water surface model for the subsequent rendering stage. And in the process of running the software application, when the specified command for the art sun model and the water surface model is detected, determining that the virtual scene reaches the preset water surface highlight processing condition.
When the virtual scene reaches the preset water surface highlight processing condition, the position of the art sun model and the water surface model in the virtual scene can be obtained, a simulated point light source corresponding to the position of the art sun model is arranged in the material of the water surface model, and then the water surface model and the simulated point light source are obtained so as to carry out the subsequent rendering process of the water surface model.
In step 102, a water surface highlight parameter of the water surface model is generated according to the illumination intensity of the simulated point light source.
In an embodiment of the present application, the generating the water surface highlight parameter of the water surface model according to the illumination intensity of the simulated point light source may specifically include:
acquiring a normal value of the water surface model;
and generating a water surface highlight parameter of the water surface model by adopting a preset illumination model according to the normal value and the illumination intensity of the simulated point light source.
The embodiment of the application can acquire the mapping information of the water surface model while acquiring the water surface model, wherein the mapping information can comprise a basic color mapping and a normal mapping, and the basic color mapping is used for storing the inherent color of the virtual model; the normal map is used to describe the surface relief of the virtual model. The normal value of the water surface model can be obtained through the normal map.
The preset illumination model may be a Phong illumination model. The Phong illumination model is the first influencing illumination model proposed in real graphics, which only considers the reflection of objects on direct illumination, considers ambient light as constant, and does not consider the mutual reflection between objects, which is represented by ambient light only. The Phong illumination model belongs to the simple illumination model.
Specifically, the calculation formula corresponding to the Phong illumination model is as follows:
wherein c specular Indicating the colour and intensity of the high light, c light Representing the illumination color and illumination intensity of the simulated point light source; m is m specular A specular reflection color representing a material of the water surface model; m is m glass The glossiness/reflectivity of the material of the water surface model is represented;representing the viewing angle direction; r represents the reflected light direction;Representing a normal vector;Indicating the direction of the incident light.
The highlight color and intensity of each position in the water surface model can be calculated through the Phong illumination model to obtain the water surface highlight parameter, and the water surface highlight parameter can be stored in the corresponding pixel of the mapping. As shown in fig. 3, fig. 3 is an exemplary diagram of an effect of a virtual scene including an art sun model after being rendered by using a map corresponding to the above-mentioned water surface highlight parameter; the water surface highlight parameter can represent illumination information generated by the simulated point light source on the whole water surface of the water surface model, and illumination intensity of the simulated point light source received by any position of the water surface is the same.
In step 103, the angle parameter and the distance parameter of the simulated point light source are obtained.
In a specific implementation, when the simulated point light source is set, the angle parameter and the distance parameter of the simulated point light source can be set, and the angle parameter and the distance parameter of the simulated point light source can be determined by a designer in combination with the requirement of the display effect of the virtual scene and actual experience. The angle parameter may determine the opening angle of the highlight starting point, and the distance parameter may determine the degree of highlight attenuation. As shown in fig. 4, fig. 4 is an exemplary diagram of the effect of visualizing the angle parameter and the distance parameter of the simulated point light source, wherein the angle parameter is x and the distance parameter is y, and as can be seen from fig. 4, the illumination outside the definition of the angle parameter and the distance parameter is in a blocked state, and the illumination intensity within the distance parameter decreases with increasing distance from the simulated point light source position.
In step 104, the water surface highlight parameter is processed according to the angle parameter and the distance parameter, so as to obtain a water surface highlight map.
According to the embodiment of the application, the water surface highlight parameters are processed by simulating the angle parameters and the distance parameters of the point light source, so that the water surface highlight display effect can be improved. Specifically, the process of processing the water surface highlight parameter according to the angle parameter and the distance parameter to obtain the water surface highlight map may include:
carrying out shielding treatment on the water surface highlight parameters according to the angle parameters to obtain first water surface highlight parameters;
carrying out attenuation treatment on the first water surface highlight parameter according to the distance parameter to obtain a second water surface highlight parameter;
and generating a water surface highlight map according to the second water surface highlight parameter.
The shielding treatment of the water surface highlight parameter according to the angle parameter may specifically be that the product operation is performed on the water surface highlight parameter and the angle parameter, and the product operation result is used as the first water surface highlight parameter. The attenuation processing is performed on the first water surface highlight parameter according to the distance parameter, specifically, the attenuation parameter is obtained firstly according to the distance parameter and a preset attenuation rule, wherein the preset attenuation rule is a rule of gradual change from light (white) to dark (black), the gradient of gradual change from light to dark is different according to different distance parameters, and it can be understood that the larger the distance parameter is, the smaller the gradual change gradient is; the smaller the distance parameter, the larger the gradient; whereas the decay parameter may be considered as a set of luminance coefficients for each location; and then carrying out attenuation treatment on the first water surface highlight parameter according to the attenuation parameter, namely carrying out corresponding product operation on the first water surface highlight parameter and the attenuation parameter, and taking the product operation result as the second water surface highlight parameter. And finally, generating a corresponding water surface highlight map according to the second water surface highlight parameter, namely, storing the second water surface highlight parameter in the pixels of the corresponding map to obtain the water surface highlight map. As shown in fig. 5, fig. 5 is an exemplary diagram of the effect of fig. 3 after being processed by the angle parameter and the distance parameter.
In practical application, the first water surface highlight map can be generated according to the water surface highlight parameters, then the second water surface highlight map is generated according to the angle parameters and the distance parameters of the simulated point light sources, and finally the first water surface highlight map and the second water surface highlight map are subjected to shielding treatment to obtain the water surface highlight map.
The second water surface highlight map may represent a map corresponding to illumination information generated by the simulated point light source on a part of the water surface model, the size of the part of the water surface is related to the angle parameter, the illumination intensity of the simulated point light source received by the part of the water surface is related to the distance parameter, and the closer to the simulated point light source, the stronger to the water surface, the farther to the simulated point light source, the weaker to the water surface, the farther to the simulated point light source, the illumination intensity of the simulated point light source.
The overlapping treatment of the first water surface highlight map and the second water surface highlight map may specifically be that the first water surface highlight map and the second water surface highlight map are placed on the same UV coordinate; wherein UV coordinates refer to a plane where all image files are two-dimensional. The horizontal direction is U and the vertical direction is V, passing through this planar, two-dimensional UV coordinate system. We can locate any one pixel on the image. And then, reserving the part overlapped with the second water surface highlight map in the first water surface highlight map, and removing other parts which are not overlapped with the second water surface highlight map to obtain the water surface highlight map.
In step 105, the surface model is subjected to highlight rendering based on the surface highlight map to obtain a highlight effect of the surface model.
And after the water surface highlight map is determined, rendering the water surface model by adopting the water surface highlight map to obtain a rendered virtual scene.
When the method for rendering the water surface provided by the embodiment of the present application is used to process the virtual scene corresponding to fig. 2, an effect example diagram as shown in fig. 6 can be obtained, and as apparent from fig. 6, the water surface highlight is emitted by the solar model 202, so that the method better conforms to the actual water surface sun highlight effect.
Further, before performing highlight rendering on the water surface model based on the water surface highlight map to obtain a highlight effect of the water surface model, the method further comprises:
and adjusting the transparency of the water surface highlight map.
Specifically, a transparency value for transparency adjustment for the water surface highlight map input by the user may be received to adjust the transparency of the water surface highlight map. The transparency value may be determined by the user's requirements in connection with the display effect of the virtual scene and actual experience.
Further, in an optional embodiment, the process of performing highlight rendering on the water surface model to obtain the highlight effect of the water surface model based on the water surface highlight map may further include:
acquiring basic color parameters of the water surface model;
correcting the basic color parameters by adopting a Fresnel formula to obtain target basic color parameters;
obtaining reflection parameters from a preset reflection map;
and processing the water surface highlight map according to the target basic color parameters and the reflection parameters.
In a specific implementation, the mapping information of the water surface model can be obtained while the water surface model is obtained, wherein the mapping information comprises a basic color mapping, and the color information of pixels in the basic color mapping is the basic color parameter.
The above-mentioned basic color parameters are corrected by adopting the fresnel formula, so that when the basic color map corresponding to the basic color parameters is covered on the water surface model, the color brightness of the basic color map can be gradually changed according to the distance change between the basic color map and the sun model; and the closer to the sun model, namely the farther from the virtual camera, the brighter the corresponding color brightness; the farther from the solar model, i.e., the closer to the virtual camera, the darker the corresponding color brightness.
The fresnel formula can be expressed specifically as follows:
Fresnel=1–dot(N,V)
n is the normal direction and V is the line of sight direction.
The normal direction can be obtained from the normal map, and the line-of-sight direction refers to a unit vector pointing to the pixel point by the virtual camera in the world coordinate, and can be determined by obtaining the position of the virtual camera and the position of the actual pixel point.
And (3) carrying out product processing on the calculation result of the Fresnel formula and the color of the pixel point corresponding to the basic color map, namely carrying out product processing on the calculation result of the Fresnel formula and the basic color parameters of each pixel in the basic color map, so as to obtain a corresponding target basic color map, wherein the color information of the pixels in the target basic color map is the target basic color parameters.
The reflection parameters are obtained from a preset reflection map, wherein the preset reflection map is provided by an art designer of a virtual scene and can comprise an integral reflection map of a water surface area; the reflection parameter is information of pixels in a part of the preset reflection map corresponding to a high-light area of the water surface high-light map.
Specifically, a water surface reflection sight line of the water surface model can be obtained first, and reflection parameters corresponding to the water surface highlight map are determined from the preset reflection map according to the water surface reflection sight line and the water surface highlight map.
It will be appreciated that the water surface reflection line of sight is calculated from the normal to the water surface model and the line of sight direction. And (3) corresponding the intersection point coordinates of the reflected sight on a unit spherical surface to the UV coordinates, and reading information of the UV coordinates corresponding to the preset reflection map to obtain reflection parameters corresponding to the water surface highlight map.
The reflection parameters corresponding to the water surface highlight map are obtained through the preset reflection map, and compared with the reflection map generated by directly using the reflection balls in the three-dimensional engine in the prior art, the reflection map generating device has good performance.
In the processing step of the water surface highlight map according to the target basic color parameter and the reflection parameter, after the water surface highlight map, the reflection parameter and the target basic color parameter are obtained, the reflection map corresponding to the water surface highlight map and the target basic color map corresponding to the target basic color parameter can be respectively covered on the water surface model according to the UV coordinates, and then the color value of the water surface highlight map, the color value of the reflection map and the color value of the target basic color map are subjected to superposition processing, namely, the color values in the water surface highlight parameter corresponding to the target basic color parameter, the reflection parameter and the water surface highlight map are subjected to superposition processing, so that the rendering of the water body model is realized, the rendering effect is more true, and the performance consumption is low. Fig. 7 is a diagram showing an example of the effect of fig. 5 after the target color parameter and the reflection parameter are processed.
In the embodiment of the application, the simulated point light source is arranged according to the position of the art sun model, the water surface model and the simulated point light source in the virtual scene are obtained, and then the water surface highlight parameter of the water surface model is generated according to the illumination intensity of the simulated point light source; the angle parameter and the distance parameter of the simulated point light source are obtained, and the water surface highlight parameter is processed according to the angle parameter and the distance parameter to obtain a water surface highlight map; and performing highlight rendering on the water surface model based on the water surface highlight map to obtain a highlight effect of the water surface model. According to the embodiment of the application, the water surface is rendered by simulating the relevant parameters of the point light source, PBR directional light is not needed, the calculated amount is small, the water surface highlight effect is corresponding to the art sun model, and the water surface highlight display effect is lifelike.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are all preferred embodiments and that the acts referred to are not necessarily required by the embodiments of the present application.
Referring to fig. 8, a block diagram of an embodiment of a water surface rendering device of the present application is shown, which may be applied to a mobile terminal, which may include electronic devices such as a smart phone, a tablet computer, a game machine, and the like.
In the embodiment of the application, the device specifically may include the following modules:
a first obtaining module 801, configured to obtain a water surface model and a simulated point light source;
a first generating module 802, configured to generate a water surface highlight parameter of the water surface model according to the illumination intensity of the simulated point light source;
a second obtaining module 803, configured to obtain an angle parameter and a distance parameter of the simulated point light source;
a second generating module 804, configured to process the water surface highlight parameter according to the angle parameter and the distance parameter, so as to obtain a water surface highlight map;
and the water surface rendering module 805 is configured to perform highlight rendering on the water surface model based on the water surface highlight map so as to obtain a highlight effect of the water surface model.
In an alternative embodiment, the first generating module 802 includes:
the normal value acquisition module is used for acquiring the normal value of the water surface model;
and a preset model generation module is adopted and is used for generating the water surface highlight parameters of the water surface model by adopting a preset illumination model according to the normal value and the illumination intensity of the simulated point light source.
In an alternative embodiment, the second generating module 804 includes:
the shielding processing module is used for shielding the water surface highlight parameter according to the angle parameter to obtain a first water surface highlight parameter;
the attenuation processing module is used for carrying out attenuation processing on the first water surface highlight parameter according to the distance parameter to obtain a second water surface highlight parameter;
and the map generation module is used for generating a water surface highlight map according to the second water surface highlight parameter.
In an alternative embodiment, the attenuation processing module includes:
the attenuation parameter obtaining module is used for obtaining attenuation parameters according to the distance parameters and preset attenuation rules;
and the attenuation parameter processing module is used for carrying out attenuation processing on the first water surface highlight parameter according to the attenuation parameter to obtain a second water surface highlight parameter.
In an optional embodiment, the shielding processing module is specifically configured to perform a product operation on the water surface highlight parameter and the angle parameter to obtain a first water surface highlight parameter;
the attenuation processing module is specifically configured to perform product operation on the first water surface highlight parameter and the attenuation parameter, so as to obtain a second water surface highlight parameter.
In an alternative embodiment, the apparatus further comprises:
the color parameter acquisition module is used for acquiring basic color parameters of the water surface model;
the Fresnel processing module is used for correcting the basic color parameters by adopting a Fresnel formula to obtain target basic color parameters;
the reflection parameter acquisition module is used for acquiring reflection parameters from a preset reflection map;
and the highlight map processing module is used for processing the water surface highlight map according to the target basic color parameters and the reflection parameters.
In an alternative embodiment, the apparatus further comprises:
and the transparency adjusting module is used for adjusting the transparency of the water surface highlight map.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
The embodiment of the application also discloses electronic equipment, which comprises a processor, a memory and a computer program stored on the memory and capable of running on the processor, wherein the computer program realizes the steps of the water surface rendering method when being executed by the processor.
Embodiments of the present application also disclose a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method of rendering a surface of water as described above.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, the present embodiments may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present embodiments have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the present application.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The foregoing has described in detail a water surface rendering method, a water surface rendering device, an electronic apparatus and a storage medium, to which specific examples are applied to illustrate the principles and embodiments of the present application, the above examples being provided only to assist in understanding the method and core ideas of the present application; meanwhile, as those skilled in the art will have modifications in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.
Claims (9)
1. A method of rendering a water surface, the method comprising:
acquiring a water surface model and a simulated point light source;
generating a water surface highlight parameter of the water surface model according to the illumination intensity of the simulated point light source;
acquiring an angle parameter and a distance parameter of the simulated point light source;
processing the water surface highlight parameters according to the angle parameters and the distance parameters to obtain a water surface highlight map; the processing of the water surface highlight parameters according to the angle parameters and the distance parameters to obtain a water surface highlight map comprises the following steps: carrying out shielding treatment on the water surface highlight parameters according to the angle parameters to obtain first water surface highlight parameters; carrying out attenuation treatment on the first water surface highlight parameter according to the distance parameter to obtain a second water surface highlight parameter; generating a water surface highlight map according to the second water surface highlight parameter;
and performing highlight rendering on the water surface model based on the water surface highlight map to obtain a highlight effect of the water surface model.
2. The method of claim 1, wherein generating the water surface highlight parameters of the water surface model according to the illumination intensity of the simulated point light source comprises:
acquiring a normal value of the water surface model;
and generating a water surface highlight parameter of the water surface model by adopting a preset illumination model according to the normal value and the illumination intensity of the simulated point light source.
3. The method according to claim 1, wherein the attenuating the first surface highlight parameter according to the distance parameter to obtain a second surface highlight parameter comprises:
obtaining attenuation parameters according to the distance parameters and a preset attenuation rule;
and carrying out attenuation treatment on the first water surface highlight parameter according to the attenuation parameter to obtain a second water surface highlight parameter.
4. A method according to claim 3, wherein the shielding the surface of water highlight parameter according to the angle parameter to obtain a first surface of water highlight parameter comprises:
performing product operation on the water surface highlight parameter and the angle parameter to obtain a first water surface highlight parameter;
the attenuating treatment is carried out on the first water surface highlight parameter according to the attenuating parameter to obtain a second water surface highlight parameter, and the method comprises the following steps:
and performing product operation on the first water surface highlight parameter and the attenuation parameter to obtain a second water surface highlight parameter.
5. The method of claim 4, further comprising, prior to said highlighting the water surface model based on the water surface highlight map to obtain a highlight effect for the water surface model:
acquiring basic color parameters of the water surface model;
correcting the basic color parameters by adopting a Fresnel formula to obtain target basic color parameters;
obtaining reflection parameters from a preset reflection map;
and processing the water surface highlight map according to the target basic color parameters and the reflection parameters.
6. The method of claim 5, further comprising, prior to said highlighting the water surface model based on the water surface highlight map to obtain a highlight effect for the water surface model:
and adjusting the transparency of the water surface highlight map.
7. A water surface rendering device, comprising:
the first acquisition module is used for acquiring a water surface model and an analog point light source;
the first generation module is used for generating a water surface highlight parameter of the water surface model according to the illumination intensity of the simulated point light source;
the second acquisition module is used for acquiring the angle parameter and the distance parameter of the simulated point light source;
the second generating module is configured to process the water surface highlight parameter according to the angle parameter and the distance parameter to obtain a water surface highlight map, and process the water surface highlight parameter according to the angle parameter and the distance parameter to obtain a water surface highlight map, where the processing includes: carrying out shielding treatment on the water surface highlight parameters according to the angle parameters to obtain first water surface highlight parameters; carrying out attenuation treatment on the first water surface highlight parameter according to the distance parameter to obtain a second water surface highlight parameter; generating a water surface highlight map according to the second water surface highlight parameter;
and the water surface rendering module is used for performing highlight rendering on the water surface model based on the water surface highlight map so as to obtain the highlight effect of the water surface model.
8. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program implementing the steps of the method of rendering a water surface as claimed in any one of claims 1 to 6 when executed by the processor.
9. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the method of rendering a surface of water as claimed in any one of claims 1 to 6.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110246298.4A CN112819929B (en) | 2021-03-05 | 2021-03-05 | Method and device for rendering water surface, electronic equipment, and storage media |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110246298.4A CN112819929B (en) | 2021-03-05 | 2021-03-05 | Method and device for rendering water surface, electronic equipment, and storage media |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN112819929A CN112819929A (en) | 2021-05-18 |
| CN112819929B true CN112819929B (en) | 2024-02-23 |
Family
ID=75862941
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110246298.4A Active CN112819929B (en) | 2021-03-05 | 2021-03-05 | Method and device for rendering water surface, electronic equipment, and storage media |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112819929B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113570696B (en) * | 2021-09-23 | 2022-01-11 | 深圳易帆互动科技有限公司 | Mirror image processing method and device of dynamic model and readable storage medium |
| CN116137051A (en) * | 2021-11-16 | 2023-05-19 | 沈阳美行科技股份有限公司 | Water surface rendering method, device, equipment and storage medium |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1870055A (en) * | 2006-06-27 | 2006-11-29 | 北京航空航天大学 | High dynamic range material color applying drawing method |
| DE102005061590A1 (en) * | 2005-05-27 | 2006-11-30 | Spin E.V. | Lighting simulating method for technical lighting system, involves computing color for pixels to represent lighting of scenery and using grey tones for true-color representation or color values for reproduction of lighting |
| CN105354872A (en) * | 2015-11-04 | 2016-02-24 | 深圳墨麟科技股份有限公司 | Rendering engine, implementation method and producing tools for 3D web game |
| CN107067455A (en) * | 2017-04-18 | 2017-08-18 | 腾讯科技(深圳)有限公司 | A kind of method and apparatus of real-time rendering |
| CN109427088A (en) * | 2017-08-18 | 2019-03-05 | 腾讯科技(深圳)有限公司 | A kind of rendering method and terminal of illumination simulation |
| CN110196746A (en) * | 2019-05-30 | 2019-09-03 | 网易(杭州)网络有限公司 | Interactive interface rendering method and device, electronic equipment, storage medium |
| CN110447001A (en) * | 2017-03-27 | 2019-11-12 | 微软技术许可有限责任公司 | Selective rendering of sparse peripheral displays based on user movement |
| CN112200902A (en) * | 2020-09-30 | 2021-01-08 | 北京达佳互联信息技术有限公司 | Image rendering method and device, electronic equipment and storage medium |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6741248B2 (en) * | 2001-04-04 | 2004-05-25 | Mitsubishi Electric Research Laboratories, Inc. | Rendering geometric features of scenes and models by individual polygons |
| US10802141B2 (en) * | 2014-05-30 | 2020-10-13 | FLIR Belgium BVBA | Water temperature overlay systems and methods |
-
2021
- 2021-03-05 CN CN202110246298.4A patent/CN112819929B/en active Active
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| DE102005061590A1 (en) * | 2005-05-27 | 2006-11-30 | Spin E.V. | Lighting simulating method for technical lighting system, involves computing color for pixels to represent lighting of scenery and using grey tones for true-color representation or color values for reproduction of lighting |
| CN1870055A (en) * | 2006-06-27 | 2006-11-29 | 北京航空航天大学 | High dynamic range material color applying drawing method |
| CN105354872A (en) * | 2015-11-04 | 2016-02-24 | 深圳墨麟科技股份有限公司 | Rendering engine, implementation method and producing tools for 3D web game |
| CN110447001A (en) * | 2017-03-27 | 2019-11-12 | 微软技术许可有限责任公司 | Selective rendering of sparse peripheral displays based on user movement |
| CN107067455A (en) * | 2017-04-18 | 2017-08-18 | 腾讯科技(深圳)有限公司 | A kind of method and apparatus of real-time rendering |
| CN109427088A (en) * | 2017-08-18 | 2019-03-05 | 腾讯科技(深圳)有限公司 | A kind of rendering method and terminal of illumination simulation |
| CN110196746A (en) * | 2019-05-30 | 2019-09-03 | 网易(杭州)网络有限公司 | Interactive interface rendering method and device, electronic equipment, storage medium |
| CN112200902A (en) * | 2020-09-30 | 2021-01-08 | 北京达佳互联信息技术有限公司 | Image rendering method and device, electronic equipment and storage medium |
Non-Patent Citations (2)
| Title |
|---|
| 基于GPU编程的真实感水面模拟绘制;杨延;张建中;何晓曦;;电脑知识与技术(13);全文 * |
| 面向模拟演练系统的延迟渲染框架;唐宇;于放;孙咏;王丹妮;;计算机系统应用(09);全文 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112819929A (en) | 2021-05-18 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11694392B2 (en) | Environment synthesis for lighting an object | |
| US20240338883A1 (en) | Importance sampling for determining a light map | |
| CN112819941B (en) | Methods, devices, equipment and computer-readable storage media for rendering water surfaces | |
| CN106548455B (en) | Apparatus and method for adjusting the brightness of an image | |
| CN113658316B (en) | Three-dimensional model rendering method and device, storage medium and computer equipment | |
| CN108010118B (en) | Virtual object processing method, virtual object processing apparatus, medium, and computing device | |
| WO2022116659A1 (en) | Volumetric cloud rendering method and apparatus, and program and readable medium | |
| CN111127623A (en) | Model rendering method and device, storage medium and terminal | |
| CN109887062B (en) | Rendering method, device, equipment and storage medium | |
| US7583264B2 (en) | Apparatus and program for image generation | |
| US20230072701A1 (en) | Ambient light based mixed reality object rendering | |
| CN112446943A (en) | Image rendering method and device and computer readable storage medium | |
| CN112465941B (en) | Volume cloud processing method and device, electronic equipment and storage medium | |
| CN111563966A (en) | Virtual content display method and device, terminal equipment and storage medium | |
| CN115330640B (en) | Illumination mapping noise reduction method, device, equipment and medium | |
| CN112819929B (en) | Method and device for rendering water surface, electronic equipment, and storage media | |
| CN114663632B (en) | Method and device for displaying virtual objects based on spatial position illumination | |
| CN115330926B (en) | Shadow estimation methods, apparatus, electronic devices and readable storage media | |
| CN112907758A (en) | Data determination method and device and electronic equipment | |
| CN114299212B (en) | Ice cube model rendering method and device | |
| CN118674853B (en) | Three-dimensional model surface skin rendering method, system, storage medium and equipment | |
| JP2023088034A (en) | COMPUTER PROGRAM, AND IMAGE DISPLAY METHOD AND IMAGE DISPLAY SYSTEM USING THE SAME | |
| CN119701349B (en) | Display method, device, electronic device, and readable storage medium | |
| CN114519760B (en) | Methods, apparatus, computer equipment and storage media for generating textures | |
| CN120390156A (en) | Image processing method and device |
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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |