Rendering method, device and electronic device for freezing effect model
By combining the frozen internal and external effect maps and lighting and dark information, the basic model is rendered, and the problem of simple rendering of the frozen effect and single effect is solved, achieving the authenticity and detailed performance of the frozen effect.
Patent Information
- Application Number
- CN202210425610.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-21
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2042-04-21
AI Technical Summary
In the prior art, the freezing effect rendering method is simple and the effect is single, and the project cannot meet the art requirements is more exquisite, and the freezing effect is not realistic enough.
The frozen internal and external effect maps are used to combine lighting and dark information to render the basic model through texture maps to achieve frozen internal effects, liquid flow, external frost and concave and concave effects, and animation rendering is combined with noise texture maps.
It improves the authenticity of the freezing effect, realizes real restoration from the surface of the model to the inside, and enhances the details and dynamic performance of the freezing effect.
Smart Images

Figure CN114998502B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rendering technology, and in particular to a rendering method, device and electronic equipment for a freezing effect model. Background Art
[0002] With the development of games, higher requirements are put forward for realistic freezing production solutions, which can achieve freezing effects under the premise of ensuring mobile performance and rendering speed. In related technologies, a black and white texture map is used to determine the texture that needs to be rendered on the surface of the object, specifically including ice or snow texture maps. At the same time, based on a reflection map, the reflection direction is calculated through the line of sight and normal direction of the ice surface, and then the reflection color of the ice surface is obtained according to the reflection direction. Finally, the ice and snow maps are mixed through the texture map to complete the freezing effect of the object. However, the freezing effect obtained by the map mixing method is relatively simple and single. It only processes the state of the frozen surface. The freezing effect is not realistic enough. It cannot meet the needs of projects with more sophisticated art requirements. Summary of the Invention
[0003] In view of this, an object of the present invention is to provide a method, device and electronic device for rendering a freezing effect model to improve the authenticity of the freezing effect.
[0004] In a first aspect, an embodiment of the present invention provides a rendering method for a frozen effect model, the method comprising: obtaining a preset texture map; the texture map comprises a frozen internal effect map and a frozen external effect map; wherein the frozen internal effect map is used to perform frozen internal effect rendering on the surface texture of the base model; the frozen external effect map is used to perform light and dark rendering on the surface texture of the base model; based on the texture map and the surface texture of the base model, a target texture map is determined; according to the target texture map, the base model is rendered to obtain a frozen effect model corresponding to the base model.
[0005] Furthermore, based on the texture map and the surface texture of the base model, the step of determining the target texture map includes: offsetting the surface texture of the base model, processing the frozen internal effect map based on the offset surface texture to obtain the target frozen internal effect map; and processing the frozen external effect map according to the lighting information of the current scene in which the base model is located to obtain the target frozen external effect map.
[0006] Furthermore, the frozen interior effect map includes an impurity texture map; the surface texture of the base model is offset, and the frozen interior effect map is processed based on the offset surface texture to obtain a target frozen interior effect map, comprising the steps of: obtaining the camera vector of the vertex on the surface of the base model; wherein the camera vector is a vector from the camera to the vertex; according to the camera vector of the vertex and a preset first offset parameter, the initial texture coordinates of the vertex are internally offset to obtain the first offset texture coordinates of the vertex; according to the first offset texture coordinates of the vertex, the impurity texture map is sampled to obtain the target impurity texture map; the target impurity texture map is used to render the frozen effect inside the surface texture of the base model.
[0007] Furthermore, the frozen interior effect map includes a disturbed texture map; the surface texture of the base model is offset, and the frozen interior effect map is processed based on the offset surface texture to obtain a target frozen interior effect map, comprising the steps of: obtaining the camera vector of the vertex on the surface of the base model; wherein the camera vector is a vector from the camera to the vertex; performing internal offset processing on the initial texture coordinates of the vertex according to the camera vector of the vertex and a preset second offset parameter to obtain the second offset texture coordinates of the vertex; wherein the second offset parameter is updated at preset time intervals; at preset time intervals, the disturbed texture map is sampled according to the second offset texture coordinates of the vertex to obtain a target disturbed texture map; the target disturbed texture map is used to render the liquid flow effect inside the surface texture of the base model.
[0008] Furthermore, the frozen external effect map includes a frost texture map; the frozen external effect map is processed according to the lighting and dark information of the current scene in which the basic model is located to obtain a target frozen external effect map, including: obtaining a Fresnel mask map of the basic model according to the lighting and dark information; obtaining an initial frost texture map that is consistent with the surface size of the basic model; multiplying the mask value of each pixel position in the Fresnel mask map with the texture value of the corresponding pixel position in the initial frost texture map to obtain a target frost texture map; the target frost texture map is used to render the frost effect on the surface texture of the basic model.
[0009] Furthermore, the frozen external effect map includes a normal map; the normal map includes normal information of the vertices of the base model; the frozen external effect map is processed according to the lighting and dark information of the current scene in which the base model is located to obtain a target frozen external effect map, including: determining the pixel values of the surface vertices of the base model according to the normal information and lighting and dark information in the normal map; determining the pixel values of the surface vertices of the base model as the texture values of the normal map to obtain a target bump texture map; the target bump texture map is used to render the surface texture of the base model with a bump effect on the outside of the model.
[0010] Furthermore, the step of determining the pixel values of the vertices on the surface of the base model based on the normal information and the illumination and dark information in the normal map includes: determining the first pixel value of the first vertex in the illuminated area and the second pixel value of the second vertex in the dark area based on the normal height of the vertex in the normal information and the illumination direction and reflection direction in the illumination and dark information; determining the first pixel value of the first vertex and the second pixel value of the second vertex as the pixel values of the vertices on the surface of the base model; wherein the first pixel value represents the convex effect of the first vertex; and the second pixel value represents the concave effect of the second vertex.
[0011] Furthermore, the target texture map includes a target impurity texture map, a target disturbance texture map, a target frost texture map and a target bump texture map; according to the target texture map, the base model is rendered to obtain a freezing effect model corresponding to the base model, including: mixing the target impurity texture map, the target disturbance texture map, the target frost texture map and the target bump texture map to obtain a mixed texture map; according to the mixed texture map, the base model is rendered to obtain a freezing effect model; wherein the freezing effect model has an internal freezing effect, an internal liquid flow effect, an external frost effect, and an external bump effect.
[0012] Furthermore, the texture map also includes a noise texture map; before the step of rendering the base model according to the mixed texture map to obtain the frozen effect model, the method also includes: sampling the noise texture map according to the initial texture coordinates of the surface texture of the base model to obtain the target noise texture map.
[0013] Furthermore, the step of rendering the base model according to the mixed texture map to obtain a frozen effect model also includes: obtaining the size value of the base model through the scene coordinates of the current scene where the base model is located; wherein the size value includes a height value or a width value; according to the size value of the base model and the target noise texture map, gradually rendering the base model with the mixed texture map in a specified direction to obtain an animation that gradually freezes from the base model until the mixed texture map rendering is completed to obtain a frozen effect model; wherein, the frozen animation has a melting effect.
[0014] In the second aspect, an embodiment of the present invention provides a rendering device for a frozen effect model, the device including: an acquisition module for acquiring a preset texture map; the texture map includes a frozen internal effect map and a frozen external effect map; wherein the frozen internal effect map is used to perform frozen internal effect rendering on the surface texture of the basic model; the frozen external effect map is used to perform light and dark rendering on the surface texture of the basic model; a determination module is used to determine a target texture map based on the texture map and the surface texture of the basic model; a rendering module is used to render the basic model according to the target texture map to obtain a frozen effect model corresponding to the basic model.
[0015] In a third aspect, an embodiment of the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the rendering method of the freezing effect model of any one of the first aspects.
[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the rendering method of the freezing effect model of any one of the first aspects.
[0017] The embodiments of the present invention bring the following beneficial effects:
[0018] The present invention provides a method, device, and electronic device for rendering a frozen effect model. The method obtains a preset texture map; the texture map includes a frozen internal effect map and a frozen external effect map; a target texture map is determined based on the texture map and the surface texture of a base model; and the base model is rendered according to the target texture map to obtain a frozen effect model corresponding to the base model. In this method, the surface texture of the base model is rendered with a frozen internal effect using the frozen internal effect map, and the surface texture of the base model is rendered with light and dark using the frozen external effect map. The resulting frozen effect model has both a frozen internal and a frozen external effect, realistically restoring the frozen effect from the surface to the interior of the model, thereby improving the authenticity of the frozen effect.
[0019] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or understood by practicing the present invention. The purposes and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0020] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 A flowchart of a method for rendering a freezing effect model provided by an embodiment of the present invention;
[0023] Figure 2 A schematic diagram of an impurity texture map provided by an embodiment of the present invention;
[0024] Figure 3 A schematic diagram of a disturbed texture map provided by an embodiment of the present invention;
[0025] Figure 4 A schematic diagram of a frost texture map provided by an embodiment of the present invention;
[0026] Figure 5 A schematic diagram of a noise texture map provided by an embodiment of the present invention;
[0027] Figure 6 A schematic diagram of a rendering process of a freezing effect model provided by an embodiment of the present invention;
[0028] Figure 7 A schematic structural diagram of a rendering device for a freezing effect model provided by an embodiment of the present invention;
[0029] Figure 8 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.
[0031] With the development of games, higher requirements are put forward for realistic freezing production solutions, which can achieve freezing effects under the premise of ensuring mobile terminal performance and rendering speed. In related technologies, a black and white texture map is used to determine the texture that needs to be rendered on the surface of an object, specifically including a texture map of ice or snow. At the same time, based on a reflection map, the reflection direction is calculated through the line of sight and normal direction of the ice surface, and then the reflection color of the ice surface is obtained according to the reflection direction. Finally, the ice and snow maps are mixed through the texture map to complete the freezing effect of the object. However, the freezing effect obtained by the map mixing method is relatively simple and the effect is single. It only processes the state of the frozen surface. The freezing effect is not realistic enough and cannot meet the needs of projects with more sophisticated art requirements. Based on this, the embodiments of the present invention provide a rendering method, device and electronic device for a freezing effect model. The technology can be applied to devices with rendering functions, such as computers, notebooks and other devices.
[0032] To facilitate understanding of this embodiment, a rendering method of a freezing effect model disclosed in an embodiment of the present invention is first described in detail. Figure 1 As shown, the method includes the following steps:
[0033] Step S102: obtaining a preset texture map; the texture map includes a frozen interior effect map and a frozen exterior effect map; wherein the frozen interior effect map is used to perform a frozen interior effect rendering on the surface texture of the base model; and the frozen exterior effect map is used to perform a light and dark rendering on the surface texture of the base model;
[0034] The above-mentioned texture map is used to perform frozen rendering on the base model, so that the surface texture of the base model has a frozen effect. In this embodiment, by observing the real frozen photo, it can be analyzed that the real freezing is not only the frozen effect of the rendered surface, but also the internal freezing effect, such as frozen cracks or some small impurities. If it is not completely frozen, there will be liquid flowing inside. In addition, the real frozen surface also has frost, but due to reasons such as lighting, the frost effect is more obvious in certain positions of the surface (for example, the frost effect on both sides of a cylindrical cup is more obvious than the frost effect on the inside). In addition, when observing the frozen plane, due to reasons such as impurities and lighting, the surface after natural freezing is not smooth, and there will also be a concave and convex effect.
[0035] Therefore, in order to make the base model have a frozen internal effect and a frozen external effect, texture maps with a frozen internal effect and a frozen external effect can be pre-set, that is, the above-mentioned frozen internal effect map and frozen external effect map. Specifically, rendering the base model based on the frozen internal effect map can render the base model to obtain an internal frozen effect; rendering the base model based on the frozen external effect map can render an external frozen effect for the base model. In fact, the rendering of the frozen internal effect usually uses the texture coordinates of the base model to achieve the frozen internal effect of the base model. It is necessary to render the base model based on the frozen internal effect map and the texture coordinates of the base model, and the external frozen effect can be rendered for the base model. The rendering of the frozen external effect usually uses light and dark information. It is necessary to render the base model based on the frozen external effect map and the light and dark information to render the external frozen effect for the base model.
[0036] Step S104, determining a target texture map based on the texture map and the surface texture of the base model;
[0037] The aforementioned base model typically refers to a virtual model within a game, such as a moving character, building, or vehicle within a game scene. Furthermore, the aforementioned base model refers to a virtual model that has not been rendered with any freezing effects, such as a character at normal temperature and in a normal environment, without any freezing effects on its surface. Since this is not simply a frozen surface rendering of the model, but rather requires achieving a frozen interior and exterior effect, it is not possible to directly sample the texture map according to the existing base model's texture coordinates to obtain the target texture map for rendering. Therefore, in this embodiment, to achieve the frozen interior effect, the surface texture of the base model must be processed. Based on the processed surface texture, the frozen interior effect map is sampled to obtain a sampled frozen interior effect map, i.e., the target texture map. This can be understood as a parallax calculation method, which allows the rendered model to visually produce a frozen interior effect. Furthermore, to achieve the frozen exterior effect, the sampled frozen exterior effect map must be processed based on lighting information (such as illumination and intensity) to obtain a processed frozen exterior effect.
[0038] Step S106: Rendering the basic model according to the target texture map to obtain a frozen effect model corresponding to the basic model.
[0039] The size of the target texture map is consistent with the size of the base model surface. Specifically, the target texture map can be directly mixed into the base model surface to obtain a frozen effect model corresponding to the base model. In addition, the target texture map usually includes multiple (for example, the target texture map corresponding to the frozen internal effect map and the target texture map corresponding to the frozen external effect map). Each target texture map can be mixed into the base model surface to obtain a frozen effect model corresponding to the base model. The target texture map can also be mixed first, and then the mixed target texture map can be mixed into the base model surface to obtain a frozen effect model corresponding to the base model. The frozen effect model has the effects of frozen cracks and liquid flow inside the ice, as well as the effects of frost and light bumps outside the ice.
[0040] An embodiment of the present invention provides a method for rendering a frozen effect model, which obtains a preset texture map; the texture map includes a frozen internal effect map and a frozen external effect map; a target texture map is determined based on the texture map and the surface texture of a base model; and the base model is rendered according to the target texture map to obtain a frozen effect model corresponding to the base model. In this method, the surface texture of the base model is rendered with a frozen internal effect using the frozen internal effect map, and the surface texture of the base model is rendered with light and dark using the frozen external effect map. The resulting frozen effect model has both a frozen internal effect and a frozen external effect, realistically restoring the frozen effect from the surface to the interior of the model, thereby improving the authenticity of the frozen effect.
[0041] The following describes the steps of determining the target texture map based on the texture map and the surface texture of the base model, in one possible implementation:
[0042] (1) offsetting the surface texture of the base model, and processing the frozen interior effect map based on the offset surface texture to obtain the target frozen interior effect map;
[0043] Observing actual frozen photos, it is found that the interior of the ice has a frozen texture, similar to the texture of a crack. Obviously, this effect has depth, that is, the frozen interior effect, so it cannot be achieved simply by using surface mapping, or filling the interior with model details. This method of filling the interior with model details will increase additional consumption. Therefore, in this embodiment, through the UV offset technology, the texture coordinates of the surface texture of the base model are UV offset processed to obtain the offset texture coordinates, and then the frozen interior effect map is sampled according to the offset texture coordinates to obtain the target frozen interior effect map. In this way, the effect of inward offset in the line of sight can be achieved.
[0044] (2) According to the lighting and dark information of the current scene where the basic model is located, the frozen external effect map is processed to obtain the target frozen external effect map.
[0045] Since the frozen exterior effect is usually a visual effect generated based on lighting and dark information, it is necessary to determine the light and dark information of each vertex on the surface of the base model according to the lighting and dark information of the current scene in which the base model is located, such as lighting direction, rays, light and dark information. According to the light and dark information of each vertex on the surface of the base model and the frozen exterior effect map, the pixel value of the frozen exterior effect map is determined, that is, the above-mentioned target frozen exterior effect map, and then the vertices on the surface of the base model that need to render frost and light and dark colors are obtained.
[0046] In the above method, the surface texture of the basic model is offset to achieve the effect of the frozen interior extending from the surface inward; through the lighting and dark information of the surface texture, more detailed information of the frozen surface can be obtained, and the light and dark effects of frost and unevenness on the frozen exterior are achieved.
[0047] like Figure 2 As shown, the frozen interior effect map includes an impurity texture map; the map is decomposed based on the RGBA channel of the preset mixed map, and the impurity texture map can be a texture map of the B channel of the preset mixed map. The following describes a possible implementation of the above step (1) of offsetting the surface texture of the base model and processing the frozen interior effect map based on the offset surface texture to obtain the target frozen interior effect map:
[0048] For the vertices on the surface of the base model, the camera vector of the vertex is obtained; wherein the camera vector is the vector from the camera to the vertex; according to the camera vector of the vertex and the preset first offset parameter, the initial texture coordinates of the vertex are internally offset to obtain the first offset texture coordinates of the vertex; according to the first offset texture coordinates of the vertex, the impurity texture map is sampled to obtain the target impurity texture map; the target impurity texture map is used to render the surface texture of the base model with a frozen effect inside the model.
[0049] The above-mentioned preset first offset parameter can be set according to actual needs. Specifically, for each vertex on the surface of the base model, the vector between the vertex and the camera point can be obtained, and then the initial texture coordinates of the vertex can be internally offset based on the vertex's camera vector and the preset first offset parameter in the tangent space of the vertex to obtain the first offset texture coordinates of the vertex. The above-mentioned tangent space refers to the space composed of the tangent plane of the vertex and the normal vector. It can be specifically achieved by the following formula: T p =T0+V .xy ×scale; where T pis the first offset texture coordinate of the vertex; T0 is the initial texture coordinate of the vertex; V .xy is the camera vector for the vertex. scale is the offset parameter, which controls the offset distance. Specifically, the X and Y values of the camera vector are added to the initial texture coordinates. Then, offsetting the initial texture coordinates inward along the camera vector by the offset parameter yields the internal coordinates of the object's surface tangent, which in turn gives the first offset texture coordinate for the vertex. This approach can be understood as the principle of parallax mapping.
[0050] For example, if we perform UV offset processing on the texture coordinates of vertex A, we obtain the first offset coordinates of vertex A, which are actually the coordinates of vertex B. Therefore, based on the vertex's first offset texture coordinates, i.e., the offset texture coordinates of the base model, we sample the impurity texture map. The resulting target impurity texture map can actually be understood as the target impurity texture map with the texture values offset. This target impurity texture map is typically used to render a frozen effect on the surface texture of the base model, giving the base model a frozen interior with cracked ice.
[0051] In addition, it should be noted that in order to obtain a deep frozen interior effect, multiple preset first offset parameters can usually be set. According to the camera vector of the vertex and each preset first offset parameter, the initial texture coordinates of the vertex are internally offset to obtain the first offset texture coordinates of multiple vertices; finally, according to the first offset texture coordinates of multiple vertices, the impurity texture map is sampled multiple times to obtain multiple target impurity texture maps, thereby obtaining the offset effects of multiple textures at different depths inward.
[0052] In the above method, by performing UV offset processing on the texture coordinates of the base model and sampling the impurity texture map according to the offset coordinates after the offset, the effect of ice cracks and impurities inside the frozen surface is achieved, further improving the authenticity of the freezing effect.
[0053] like Figure 3 As shown, the frozen interior effect map includes a perturbed texture map; the perturbed texture map can be a texture map of the preset mixed map G channel. The following describes another possible implementation of the above step (1) of offsetting the surface texture of the base model and processing the frozen interior effect map based on the offset surface texture to obtain the target frozen interior effect map:
[0054] For the vertices on the surface of the base model, the camera vector of the vertex is obtained; wherein the camera vector is the vector from the camera to the vertex; according to the camera vector of the vertex and a preset second offset parameter, the initial texture coordinates of the vertex are internally offset to obtain the second offset texture coordinates of the vertex; wherein the second offset parameter is updated at preset time intervals; at preset time intervals, according to the second offset texture coordinates of the vertex, the disturbance texture map is sampled to obtain a target disturbance texture map; the target disturbance texture map is used to render the liquid flow effect inside the surface texture of the base model.
[0055] The above-mentioned second offset parameter is a parameter that changes in real time. That is to say, after the first rendering is completed, since the second offset parameter changes in real time, the target disturbance texture map will be re-acquired and rendered after the second offset parameter changes, so that the interior of the final frozen effect model can present an animation effect of liquid flow.
[0056] The specific implementation steps are the same as those for determining the target impurity texture map described above, with the only difference being that the second offset parameter is updated at preset intervals, and the above steps are re-executed after the second offset parameter is updated. In other words, the base model is re-rendered based on the target disturbance texture at preset intervals to achieve the effect of frozen internal flow. The preset interval can be set as needed, for example, to 1 second or 500 milliseconds. The second offset parameter can be updated randomly or regularly, from small to large.
[0057] In the above method, the texture coordinates of the basic model are UV offset at preset time intervals, and the impurity texture map is sampled and processed according to the offset coordinates after offset at preset time intervals. By rendering different target disturbance texture maps in real time, the effect of liquid flowing inward along the surface is achieved, further improving the authenticity of the freezing effect.
[0058] like Figure 4 As shown, the frozen exterior effect map includes a frost texture map; the frost texture map can be a texture map of the preset mixed map R channel. The following describes a possible implementation method of processing the frozen exterior effect map based on the lighting information of the current scene in which the base model is located in step (2) above to obtain a target frozen exterior effect map:
[0059] According to the lighting and dark information, the Fresnel mask map of the base model is obtained; the initial frost texture map with the same size as the surface of the base model is obtained; the mask value of each pixel position in the Fresnel mask map is multiplied by the texture value of the corresponding pixel position in the initial frost texture map to obtain the target frost texture map; the target frost texture map is used to render the frost effect on the surface texture of the base model.
[0060] The above-mentioned Fresnel mask is derived from the Fresnel effect. The reflectivity of the base model's surface varies at different angles, and the Fresnel effect simulates the effect of the reflectivity of an object's material changing with angle. In this implementation, the frosting effect appears differently in different areas of the model's surface, and can therefore be visually described using the Fresnel effect. Specifically, a Fresnel mask for the base model is derived using the Fresnel effect. Within this Fresnel mask, pixels corresponding to areas where the frosting effect is desired are represented as white, while pixels corresponding to areas where the frosting effect is not desired are represented as black.
[0061] The frost texture map can then be sampled directly based on the initial texture coordinates of the base model to obtain an initial frost texture map. The size of this initial frost texture map is now consistent with the surface size of the Fresnel mask and the base model, with each pixel position corresponding one-to-one. Finally, the mask value of each pixel position in the Fresnel mask is multiplied by the texture value of the corresponding pixel position in the initial frost texture map to obtain a target frost texture map. In this target frost texture map, the texture corresponding to the areas of the base model that require frost is the target frost texture, and the texture corresponding to the areas that do not require frost is a transparent texture, that is, the pixel value corresponding to this area is 1. The texture of frost is similar to a fine granular texture, accompanied by a bumpy surface texture.
[0062] In the above method, the frost area outside the frozen base model is represented by the Fresnel effect. According to the Fresnel mask map and the frost texture map, the texture of the area where frost does not need to be rendered can be filtered out, thereby achieving the frost effect on the frozen outside due to lighting display, and further improving the realism of the frozen model.
[0063] The frozen exterior effect map includes a normal map; the normal map includes normal information of the base model vertices; the normal information generally includes the height value of the normal. The following describes the step (2) of processing the frozen exterior effect map according to the lighting information of the current scene in which the base model is located to obtain the target frozen exterior effect map, including:
[0064] According to the normal information and lighting information in the normal map, the pixel values of the vertices on the surface of the base model are determined; the pixel values of the vertices on the surface of the base model are determined as the texture values of the normal map to obtain the target bump texture map; the target bump texture map is used to render the bump effect on the surface texture of the base model.
[0065] This lighting and dark information typically includes the illumination direction, light intensity, and intensity of light and dark. The normal map above creates a normal at every point on the original object's concave and convex surface, marking its direction using RGB color channels. You can think of it as a different surface parallel to the original concave and convex surface, but in reality, it's just a smooth plane. For visual effects, it's more efficient than the original concave and convex surface. By applying a light source at a specific location, a low-level surface can be transformed into a highly detailed, precise lighting direction and reflection effect.
[0066] Specifically, the normal map of the base model is used to determine the pixel value of each vertex on the surface of the base model according to the light and dark changes of the current scene, that is, the light irradiation line, by multiplication or other calculation methods. The pixel value can indicate the brightness and darkness of the vertex, and finally obtain the target bump texture map representing the brightness and darkness of the vertex and the bump effect. The pixel value of each pixel position in the target bump texture map represents the brightness and darkness value of the vertex corresponding to the pixel position of the base model, and the bump effect of the surface is achieved through the brightness and darkness. It should be noted that the surface of the virtual model is still horizontal to indicate the changes in light and shadow.
[0067] In the above method, the normal map is used to obtain more details of the frozen surface according to the light illumination and dark information, thereby achieving the uneven light and dark effect of the model surface, and further improving the authenticity of the frozen effect.
[0068] Among them, the above-mentioned step of determining the pixel values of the vertices on the surface of the basic model based on the normal information and the illumination and dark information in the normal map, a possible implementation method is: determining the first pixel value of the first vertex in the illuminated area and the second pixel value of the second vertex in the dark area according to the normal height of the vertex in the normal information and the illumination direction and reflection direction in the illumination and dark information; determining the first pixel value of the first vertex and the second pixel value of the second vertex as the pixel values of the vertices on the surface of the basic model; wherein the first pixel value represents the convex effect of the first vertex; the second pixel value represents the concave effect of the second vertex.
[0069] The above-mentioned first pixel value usually indicates that the area is an illuminated area, and the second pixel value usually indicates that the area is a backlit area. Due to the different normal heights, the illuminated area and the backlit area need to be determined based on the normal height and the illumination direction. The size of the first pixel value and the second pixel value needs to be determined based on the illumination intensity. The stronger the illumination, the larger the first pixel value, indicating that the area is brighter and the convex effect is more obvious. In addition, the above-mentioned first pixel value also includes multiple values, which can be specifically determined based on the illumination direction and the reflection direction. If the camera vector of the first vertex coincides with the reflection direction, the larger the data of the first pixel value, the brighter the vertex. If the camera vector of the first vertex does not coincide with the reflection direction, the value of the first pixel value can be determined based on the angle between the camera vector and the reflection direction.
[0070] The above-mentioned target texture map includes a target impurity texture map, a target disturbance texture map, a target frost texture map and a target bump texture map; the following describes the steps of rendering the basic model according to the target texture map to obtain a frozen effect model corresponding to the basic model. A possible implementation method is: mixing the target impurity texture map, the target disturbance texture map, the target frost texture map and the target bump texture map to obtain a mixed texture map; according to the mixed texture map, rendering the basic model to obtain a frozen effect model; wherein, the frozen effect model has an internal freezing effect, an internal liquid flow effect, an external frost effect, and an external bump effect.
[0071] If the actual rendering animation is not considered, the mixed texture map can be directly rendered to the base model to obtain a frozen effect model. In this way, a mixed texture map is directly rendered to the surface of the base model to directly obtain a frozen effect model, which restores the frozen effect more realistically from the surface to the inside, and achieves better results while ensuring performance.
[0072] In order to further improve the visual effect of rendering, such as Figure 5 As shown, the texture map also includes a noise texture map; the noise texture map can be a texture map of channel A of a preset mixed texture map. Before rendering the base model according to the mixed texture map to obtain a frozen effect model, the method further includes: sampling the noise texture map according to the initial texture coordinates of the surface texture of the base model to obtain a target noise texture map.
[0073] In order to apply the noise texture map to the rendering process of the base model, it is necessary to sample the noise texture map according to the initial texture coordinates of the surface texture of the base model, and the obtained target noise texture map is consistent with the size of the base model surface.
[0074] The following is a possible implementation of rendering the base model based on the mixed texture map to obtain the frozen effect model:
[0075] The size value of the base model is obtained through the scene coordinates of the current scene in which the base model is located; wherein the size value includes a height value or a width value; according to the size value of the base model and the target noise texture map, the mixed texture map is gradually rendered in a specified direction to the base model, thereby obtaining an animation that gradually freezes the base model until the mixed texture map rendering is completed, thereby obtaining a frozen effect model; wherein the frozen animation has an ablation effect.
[0076] Specifically, the surface material conversion effect can be achieved through lerp blending animation. The height value of the object from bottom to top is obtained through the value of the local coordinate y, that is, the height value of the base model in the scene coordinates of the current scene where the base model is located. A linear black and white transition effect can be achieved by remapping the height value to the curve animation. Then, a more natural edge transition effect is obtained by adding the remapped height value to the target noise texture map. Figure 6 As shown, the transition of the base model from the original model to the frozen effect model is a random transition method, that is, the above-mentioned ablation effect, thereby obtaining the overall dissolving transformation animation of the technical model and realizing the effect from object to frozen.
[0077] In the above method, the rendering process of the basic model is processed by the noise texture map, and a frozen animation with a melting effect is obtained, which avoids the freezing animation with horizontal or vertical effects, further improves the realism of the freezing effect, and improves the user experience.
[0078] In summary, after analyzing and simulating actual freezing effects, this invention effectively combines technology and textures. Using a single hybrid map, it realistically reproduces the freezing effect from the surface to the interior, achieving a good freezing effect while ensuring performance. There are many similar requirements in real applications, and we can draw inferences from this experience and split the effects into separate parts to achieve a good balance between performance and effect.
[0079] Corresponding to the above method embodiment, the embodiment of the present invention provides a rendering device for a freezing effect model, such as Figure 7 As shown, the device includes:
[0080] The acquisition module 71 is used to acquire a preset texture map; the texture map includes a frozen interior effect map and a frozen exterior effect map; wherein the frozen interior effect map is used to perform a frozen interior effect rendering on the surface texture of the base model; and the frozen exterior effect map is used to perform a light and dark rendering on the surface texture of the base model;
[0081] A determination module 72 is configured to determine a target texture map based on the texture map and the surface texture of the base model;
[0082] The rendering module 73 is used to render the basic model according to the target texture map to obtain a frozen effect model corresponding to the basic model.
[0083] An embodiment of the present invention provides a rendering device for a frozen effect model, which obtains preset texture maps; the texture maps include a frozen internal effect map and a frozen external effect map; a target texture map is determined based on the texture maps and the surface texture of a base model; and the base model is rendered according to the target texture map to obtain a frozen effect model corresponding to the base model. In this method, the surface texture of the base model is rendered with a frozen internal effect using the frozen internal effect map, and the surface texture of the base model is rendered with light and dark using the frozen external effect map. The resulting frozen effect model has both a frozen internal effect and a frozen external effect, realistically restoring the frozen effect from the surface to the interior of the model, thereby improving the authenticity of the frozen effect.
[0084] Furthermore, the above-mentioned determination module also includes: a first determination unit, used to offset the surface texture of the basic model, and process the frozen internal effect map based on the offset surface texture to obtain the target frozen internal effect map; a second determination unit, used to process the frozen external effect map according to the lighting information of the current scene in which the basic model is located, and obtain the target frozen external effect map.
[0085] Furthermore, the above-mentioned frozen internal effect map includes an impurity texture map; the above-mentioned first determination unit is also used to: obtain the camera vector of the vertex on the surface of the base model; wherein the camera vector is the vector from the camera to the vertex; according to the camera vector of the vertex and the preset first offset parameter, the initial texture coordinates of the vertex are internally offset to obtain the first offset texture coordinates of the vertex; according to the first offset texture coordinates of the vertex, the impurity texture map is sampled to obtain the target impurity texture map; the target impurity texture map is used to render the frozen effect inside the model on the surface texture of the base model.
[0086] Furthermore, the above-mentioned frozen internal effect map includes a disturbance texture map; the above-mentioned first determination unit is also used to: obtain the camera vector of the vertex on the surface of the base model; wherein the camera vector is the vector from the camera to the vertex; according to the camera vector of the vertex and the preset second offset parameter, the initial texture coordinates of the vertex are internally offset to obtain the second offset texture coordinates of the vertex; wherein the second offset parameter is updated at preset time intervals; at preset time intervals, the disturbance texture map is sampled according to the second offset texture coordinates of the vertex to obtain the target disturbance texture map; the target disturbance texture map is used to render the liquid flow effect inside the model on the surface texture of the base model.
[0087] Furthermore, the above-mentioned frozen external effect map includes a frost texture map; the above-mentioned second determination unit is also used to: obtain the Fresnel mask map of the basic model according to the lighting and dark information; obtain an initial frost texture map that is consistent with the surface size of the basic model; multiply the mask value of each pixel position in the Fresnel mask map with the texture value of the corresponding pixel position in the initial frost texture map to obtain a target frost texture map; the target frost texture map is used to render the frost effect on the surface texture of the basic model.
[0088] Furthermore, the above-mentioned frozen external effect map includes a normal map; the normal map includes the normal information of the vertices of the base model; the above-mentioned second determination unit is also used to: determine the pixel values of the surface vertices of the base model according to the normal information and lighting information in the normal map; determine the pixel values of the surface vertices of the base model as the texture values of the normal map to obtain the target bump texture map; the target bump texture map is used to render the surface texture of the base model with a bump effect on the outside of the model.
[0089] Furthermore, the above-mentioned second determination unit is also used to: determine the first pixel value of the first vertex in the illuminated area and the second pixel value of the second vertex in the dark area based on the normal height of the vertex in the normal information and the illumination direction and reflection direction in the illumination and darkness information; determine the first pixel value of the first vertex and the second pixel value of the second vertex as the pixel values of the surface vertices of the basic model; wherein the first pixel value represents the convex effect of the first vertex; and the second pixel value represents the concave effect of the second vertex.
[0090] Furthermore, the above-mentioned target texture map includes a target impurity texture map, a target disturbance texture map, a target frost texture map and a target bump texture map; the above-mentioned rendering module is also used to: mix the target impurity texture map, the target disturbance texture map, the target frost texture map and the target bump texture map to obtain a mixed texture map; according to the mixed texture map, the basic model is rendered to obtain a frozen effect model; wherein the frozen effect model has an internal freezing effect, an internal liquid flow effect, an external frost effect, and an external bump effect.
[0091] Furthermore, the above texture map also includes a noise texture map; the above device also includes a noise texture map sampling module, which is used to: sample the noise texture map according to the initial texture coordinates of the surface texture of the base model to obtain a target noise texture map.
[0092] Furthermore, the above-mentioned rendering module is also used to: obtain the size value of the basic model through the scene coordinates of the current scene in which the basic model is located; wherein the size value includes a height value or a width value; according to the size value of the basic model and the target noise texture map, the mixed texture map is gradually rendered in the specified direction to obtain an animation that is gradually frozen from the basic model until the rendering of the mixed texture map is completed to obtain a frozen effect model; wherein, the frozen animation has a melting effect.
[0093] The rendering device of the freezing effect model provided in the embodiment of the present invention has the same technical features as the rendering method of the freezing effect model provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.
[0094] This embodiment further provides an electronic device including a processor and a memory, wherein the memory stores computer-executable instructions executable by the processor, and the processor executes the computer-executable instructions to implement the above-mentioned method for rendering a freezing effect model. The electronic device can be a server or a terminal device.
[0095] See also Figure 8 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores computer-executable instructions that can be executed by the processor 100. The processor 100 executes the computer-executable instructions to implement the above-mentioned rendering method of the freezing effect model.
[0096] Furthermore, Figure 8 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .
[0097] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is achieved through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0098] The processor 100 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 100 or software instructions. The above processor 100 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as a random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or register. The storage medium is located in the memory 101. The processor 100 reads the information in the memory 101 and, in conjunction with its hardware, completes the steps of the method of the aforementioned embodiment.
[0099] This embodiment also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the rendering method of the above-mentioned freezing effect model.
[0100] The computer program product of the rendering method, device, electronic device and system of the freezing effect model provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.
[0101] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems and devices can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0102] In addition, in the description of the embodiments of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0103] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0104] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0105] Finally, it should be noted that the above embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A method for rendering a frozen effect model, characterized in that: The method comprises: Obtaining a preset texture map; the texture map includes a frozen interior effect map and a frozen exterior effect map; wherein the frozen interior effect map is used to perform a frozen interior effect rendering on the surface texture of the base model; and the frozen exterior effect map is used to perform a light and dark rendering on the surface texture of the base model; Determining a target texture map based on the texture map and the surface texture of the base model; Rendering the base model according to the target texture map to obtain a frozen effect model corresponding to the base model; The step of determining a target texture map based on the texture map and the surface texture of the base model comprises: performing an offset process on the surface texture of the base model, and processing the frozen interior effect map based on the offset surface texture to obtain a target frozen interior effect map; and processing the frozen exterior effect map according to lighting information of a current scene in which the base model is located to obtain a target frozen exterior effect map; The frozen interior effect map includes a disturbance texture map; The steps of offsetting the surface texture of the base model, processing the frozen internal effect map based on the offset surface texture, and obtaining a target frozen internal effect map include: obtaining the camera vector of the vertex on the surface of the base model; wherein the camera vector is the vector from the camera to the vertex; performing internal offset processing on the initial texture coordinates of the vertex according to the camera vector of the vertex and a preset second offset parameter to obtain the second offset texture coordinates of the vertex; wherein the second offset parameter is updated at a preset time interval; and sampling the perturbation texture map at the preset time interval according to the second offset texture coordinates of the vertex to obtain a target perturbation texture map; the target perturbation texture map is used to render the liquid flow effect inside the surface texture of the base model.
2. The method according to claim 1, characterized in that The frozen interior effect map includes an impurity texture map; The step of performing an offset process on the surface texture of the base model and processing the frozen interior effect map based on the offset surface texture to obtain a target frozen interior effect map comprises: For a vertex on the surface of the base model, obtain a camera vector of the vertex; wherein the camera vector is a vector from the camera to the vertex; Performing internal offset processing on the initial texture coordinates of the vertex according to the camera vector of the vertex and a preset first offset parameter to obtain a first offset texture coordinate of the vertex; The impurity texture map is sampled according to the first offset texture coordinate of the vertex to obtain a target impurity texture map; the target impurity texture map is used to render a frozen effect inside the model on the surface texture of the base model.
3. The method according to claim 1, characterized in that The frozen exterior effect map includes a frost texture map; The step of processing the frozen external effect map according to the lighting information of the current scene in which the basic model is located to obtain a target frozen external effect map comprises: Obtaining a Fresnel mask map of the base model according to the light illumination and dark information; obtaining an initial frost texture map having the same size as the surface of the base model; The mask value of each pixel position in the Fresnel mask map is multiplied by the texture value of the corresponding pixel position in the initial frost texture map to obtain a target frost texture map; the target frost texture map is used to render the frost effect on the surface texture of the base model.
4. The method according to claim 1, wherein The frozen external effect map includes a normal map; the normal map includes normal information of the vertices of the base model; The step of processing the frozen external effect map according to the lighting information of the current scene in which the basic model is located to obtain a target frozen external effect map comprises: Determining pixel values of vertices on the surface of the base model according to normal information in the normal map and the light and dark information; The pixel values of the vertices on the surface of the base model are determined as the texture values of the normal map to obtain a target concave-convex texture map; the target concave-convex texture map is used to render the surface texture of the base model with a concave-convex effect on the outside of the model.
5. The method according to claim 4, characterized in that The step of determining the pixel values of the vertices on the surface of the base model according to the normal information in the normal map and the illumination and darkness information comprises: Determining a first pixel value of a first vertex in an illuminated area and a second pixel value of a second vertex in a dark area according to a normal height of the vertex in the normal information and an illumination direction and a reflection direction in the illumination-darkness information; The first pixel value of the first vertex and the second pixel value of the second vertex are determined as the pixel values of the vertices on the surface of the basic model; wherein the first pixel value represents the convex effect of the first vertex; and the second pixel value represents the concave effect of the second vertex.
6. The method according to claim 1, characterized in that The target texture maps include target impurity texture maps, target disturbance texture maps, target frost texture maps and target bump texture maps; The step of rendering the base model according to the target texture map to obtain a frozen effect model corresponding to the base model includes: Mixing the target impurity texture map, the target disturbance texture map, the target frost texture map, and the target bump texture map to obtain a mixed texture map; The basic model is rendered according to the mixed texture map to obtain the frozen effect model; wherein the frozen effect model has an internal frozen effect, an internal liquid flow effect, an external frost effect, and an external concave-convex effect.
7. The method according to claim 6, characterized in that The texture map also includes a noise texture map; Before the step of rendering the base model according to the mixed texture map to obtain the frozen effect model, the method further includes: The noise texture map is sampled according to the initial texture coordinates of the surface texture of the base model to obtain a target noise texture map.
8. The method according to claim 7, characterized in that The step of rendering the base model according to the mixed texture map to obtain the frozen effect model further includes: Obtaining a size value of the base model through the scene coordinates of the current scene in which the base model is located; wherein the size value includes a height value or a width value; According to the size value of the basic model and the target noise texture map, the mixed texture map is gradually rendered in a specified direction to the basic model to obtain an animation that is gradually frozen from the basic model until the mixed texture map rendering is completed to obtain the frozen effect model; wherein, the frozen animation has an ablation effect.
9. A rendering device for a frozen effect model, characterized in that: The device comprises: An acquisition module is used to acquire preset texture maps; the texture maps include frozen interior effect maps and frozen exterior effect maps; wherein the frozen interior effect maps are used to perform frozen interior effect rendering on the surface texture of the base model; and the frozen exterior effect maps are used to perform light and dark rendering on the surface texture of the base model; a determination module, configured to determine a target texture map based on the texture map and the surface texture of the base model; A rendering module, configured to render the base model according to the target texture map to obtain a frozen effect model corresponding to the base model; The determination module is further configured to: perform an offset process on the surface texture of the base model, and process the frozen interior effect map based on the offset surface texture to obtain a target frozen interior effect map; and process the frozen exterior effect map according to the lighting information of the current scene in which the base model is located to obtain a target frozen exterior effect map; The frozen interior effect map includes a disturbance texture map; The determination module is also used to: obtain the camera vector of the vertex on the surface of the base model; wherein the camera vector is the vector from the camera to the vertex; perform internal offset processing on the initial texture coordinates of the vertex according to the camera vector of the vertex and a preset second offset parameter to obtain the second offset texture coordinates of the vertex; wherein the second offset parameter is updated at preset time intervals; at preset time intervals, sample the disturbance texture map according to the second offset texture coordinates of the vertex to obtain a target disturbance texture map; the target disturbance texture map is used to render the liquid flow effect inside the surface texture of the base model.
10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the rendering method of the freezing effect model according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the rendering method of the freezing effect model according to any one of claims 1 to 8.
Citation Information
Patent Citations
Crystal stone model rendering method and device, electronic equipment and storage medium
CN111899325A
Ice block model rendering method and device
CN114299212A