Ice cube model rendering method and device

By obtaining the noise map and light source direction information of the ice model, distinguishing the front and backlit surfaces, and combining parallax processing and rendering color determination, the problem of large computational complexity in rendering the ice model is solved, and efficient rendering of the light-transmitting effect is achieved.

CN114299212BActive Publication Date: 2025-09-12NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111603615.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2025-09-12
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

Existing physical rendering methods require a lot of computation when rendering ice models, especially when expressing the light transmittance effect, which requires adding thickness information, resulting in excessive computational burden.

Method used

By obtaining the noise map of the ice model and the orientation information under the light source, the front-lit side and the back-lit side are distinguished, and parallax processing is performed based on the noise map. The rendering color is determined by combining the dot product result of the light vector and the normal vector to achieve the light-transmitting effect of the ice model.

Benefits of technology

It reduces the computational complexity of the rendering process and improves the controllability of the rendering effect. It can show the light transmittance effect of the ice model without setting thickness information, which increases the controllability of the code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114299212B_ABST
    Figure CN114299212B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides an ice model rendering method and device, the method comprising: obtaining an ice model to be rendered and a noise map of the ice model, the noise map being used to indicate the texture of the ice model; determining the orientation information of the ice model under a light source, the orientation information being used to indicate whether each surface of the ice model is a front-lit surface or a back-lit surface; performing parallax processing on the ice model according to the noise map to obtain an ice model containing internal texture; and rendering the ice model containing internal texture according to the orientation information to obtain a rendered ice model. When expressing the light-transmitting effect of the ice model, there is no need to set the thickness information of the ice model and the scene information behind the ice model, and the drawing can be performed on an opaque layer, which reduces the computational complexity of the rendering process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a method and device for rendering an ice cube model. Background Art

[0002] In the game rendering process, rendering of various models is often involved. Rendering is the process of generating images from models. The rendering process can show the display effects of various models.

[0003] Currently, the most commonly used rendering method is Physically Based Rendering (PRB). PRB is a general term for a range of rendering methods based on physical principles, including rendering based on the bidirectional reflectance distribution function and the bidirectional scattering distribution function. PRB rendering methods offer excellent realism and versatility.

[0004] Ice models are common in game rendering. Unlike ordinary models, ice models require a certain degree of light transmittance during rendering. However, current PRB rendering solutions require thickness information to achieve this, which is computationally intensive. Summary of the Invention

[0005] The embodiments of the present application provide a method and device for rendering an ice model to reduce the computational complexity of rendering the ice model.

[0006] In a first aspect, an embodiment of the present application provides an ice model rendering method, comprising:

[0007] Obtaining an ice model to be rendered and a noise map of the ice model, wherein the noise map is used to indicate the texture of the ice model;

[0008] determining orientation information of the ice cube model under a light source, wherein the orientation information is used to indicate whether each side of the ice cube model is a front-lit side or a back-lit side;

[0009] performing parallax processing on the ice model according to the noise map to obtain an ice model including internal texture;

[0010] The ice cube model including the internal texture is rendered according to the orientation information to obtain a rendered ice cube model.

[0011] In a possible implementation, determining the orientation information of the ice model under the light source includes:

[0012] Obtaining the light vector of the light source and the normal vector of each surface of the ice model;

[0013] The orientation information is determined according to the light vector and the normal vector.

[0014] In a possible implementation, determining the orientation information according to the light vector and the normal vector includes:

[0015] Performing a dot product process on the light vector and the normal vector to obtain a dot product result, where the dot product result is used to indicate an angle between the light vector and the normal vector;

[0016] The front light side and the back light side of the ice cube model are determined according to the dot product result.

[0017] In a possible implementation, performing parallax processing on the ice model according to the noise map to obtain the ice model including internal texture includes:

[0018] Get parallax processing parameters;

[0019] According to the parallax processing parameters, the noise map is moved and superimposed within the ice model to obtain the ice model containing the internal texture.

[0020] In a possible implementation, rendering the ice model including the internal texture according to the orientation information to obtain a rendered ice model includes:

[0021] Determining the rendering color of the front light surface and the rendering color of the back light surface according to the dot product result;

[0022] Determining a rendering color at a junction of the front light surface and the back light surface;

[0023] The ice cube model including the internal texture is rendered according to the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction to obtain the rendered ice cube model.

[0024] In a possible implementation, determining the rendering color of the front-lit surface and the rendering color of the back-lit surface according to the dot product result includes:

[0025] Get the first color parameter and the second color parameter;

[0026] Determining the rendering color of each of the front light surfaces according to the first color parameter and the dot product result corresponding to each of the front light surfaces;

[0027] The rendering color of each backlight surface is determined according to the second color parameter and the dot product result corresponding to each backlight surface.

[0028] In a possible implementation, determining the rendering color at the boundary between the front light surface and the back light surface includes:

[0029] Linear interpolation processing is performed on the rendering color of the front light surface and the rendering color of the back light surface corresponding to the intersection to obtain the rendering color of the intersection.

[0030] In a possible implementation, rendering the ice model including the internal texture according to the rendering color of the front surface, the rendering color of the backlight surface, and the rendering color of the boundary to obtain the rendered ice model includes:

[0031] determining a highlight region in the ice model;

[0032] The ice model including the internal texture is rendered according to the rendering color of the highlight area, the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction to obtain the rendered ice model.

[0033] In a second aspect, an embodiment of the present application provides an ice model rendering device, comprising:

[0034] an acquisition module, configured to acquire an ice model to be rendered and a noise map of the ice model, wherein the noise map is used to indicate a texture of the ice model;

[0035] a determination module, configured to determine orientation information of the ice cube model under a light source, wherein the orientation information is used to indicate whether each surface of the ice cube model is a front-lit surface or a back-lit surface;

[0036] a processing module, configured to perform parallax processing on the ice model according to the noise map to obtain an ice model including internal texture;

[0037] A rendering module is used to render the ice model including the internal texture according to the orientation information to obtain a rendered ice model.

[0038] In a possible implementation, the determining module is specifically configured to:

[0039] Obtaining the light vector of the light source and the normal vector of each surface of the ice model;

[0040] The orientation information is determined according to the light vector and the normal vector.

[0041] In a possible implementation, the determining module is specifically configured to:

[0042] Performing a dot product process on the light vector and the normal vector to obtain a dot product result, where the dot product result is used to indicate an angle between the light vector and the normal vector;

[0043] The front light side and the back light side of the ice cube model are determined according to the dot product result.

[0044] In a possible implementation, the processing module is specifically configured to:

[0045] Get overlay parameters;

[0046] According to the superposition parameters, the noise map is moved and superimposed within the ice model to obtain the ice model containing the internal texture.

[0047] In a possible implementation, the rendering module is specifically configured to:

[0048] Determining the rendering color of the front light surface and the rendering color of the back light surface according to the dot product result;

[0049] Determining a rendering color at a junction of the front light surface and the back light surface;

[0050] The ice cube model including the internal texture is rendered according to the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction to obtain the rendered ice cube model.

[0051] In a possible implementation, the rendering module is specifically configured to:

[0052] Get the first color parameter and the second color parameter;

[0053] Determining the rendering color of each of the front light surfaces according to the first color parameter and the dot product result corresponding to each of the front light surfaces;

[0054] The rendering color of each backlight surface is determined according to the second color parameter and the dot product result corresponding to each backlight surface.

[0055] In a possible implementation, the rendering module is specifically configured to:

[0056] Linear interpolation processing is performed on the rendering color of the front light surface and the rendering color of the back light surface corresponding to the intersection to obtain the rendering color of the intersection.

[0057] In a possible implementation, the rendering module is specifically configured to:

[0058] determining a highlight region in the ice model;

[0059] The ice model including the internal texture is rendered according to the rendering color of the highlight area, the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction to obtain the rendered ice model.

[0060] In a third aspect, an embodiment of the present application provides an ice model rendering device, comprising:

[0061] Memory, used to store programs;

[0062] A processor is used to execute the program stored in the memory. When the program is executed, the processor is used to execute the ice model rendering method as described in any one of the first aspects.

[0063] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium comprising instructions, which, when executed on a computer, enables the computer to execute the ice model rendering method as described in any one of the first aspects.

[0064] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the ice model rendering method as described in any one of the first aspects.

[0065] The ice model rendering method and device provided in the embodiments of the present application first obtain an ice model to be rendered and a noise map of the ice model, then determine the orientation information of the ice model under the light source to distinguish the front and backlit sides of the ice model. Since the noise map can indicate the texture of the ice model, parallax processing is performed on the ice model based on the noise map to obtain an ice model containing internal texture, making the ice model more visually three-dimensional. Finally, the ice model containing internal texture is rendered based on the orientation information to obtain a rendered ice model. The scheme of the embodiments of the present application distinguishes the front and backlit sides of the ice model by obtaining orientation information, and then renders the ice model containing internal texture based on the orientation information. The front and backlit sides of the ice model can be rendered in different colors, which can show the light-transmitting effect of the ice model and achieve good rendering effect. When showing the light-transmitting effect of the ice model, there is no need to set the thickness information of the ice model or the scene information behind the ice model. The rendering can be performed on an opaque layer, which reduces the computational complexity of the rendering process and increases the controllability of the code. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0067] Figure 1 Schematic diagram of the process of the ice cube model rendering method provided in the embodiment of the present application Figure 1 ;

[0068] Figure 2 Schematic diagram of the process of the ice cube model rendering method provided in the embodiment of the present application Figure 2 ;

[0069] Figure 3 Schematic diagram of light vectors and normal vectors provided in an embodiment of the present application;

[0070] Figure 4 A schematic diagram of the rendering interface provided in an embodiment of the present application;

[0071] Figure 5 A schematic diagram showing a comparison of ice cube models provided in an embodiment of the present application;

[0072] Figure 6 Schematic diagram of the rendered ice model provided in the embodiment of the present application Figure 1 ;

[0073] Figure 7 Schematic diagram of the rendered ice model provided in the embodiment of the present application Figure 2 ;

[0074] Figure 8 A schematic structural diagram of an ice cube model rendering device provided in an embodiment of the present application;

[0075] Figure 9 A schematic diagram of the hardware structure of an ice model rendering device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0076] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0077] To facilitate understanding, first, the relevant concepts involved in this application are introduced:

[0078] PBR stands for Physically Based Rendering, a rendering method based on the simulation of physical laws. PBR is a commonly used rendering method in game rendering pipelines. It offers the following advantages: realism, enabling better physically based rendering of realistic objects in realistic games; versatility, using real physical parameters (smoothness, metallicity, etc.) to express the physical characteristics of different materials, allowing it to be used on a variety of objects in a scene and standardizing workflows; and uniformity, ensuring that objects display correct results under any lighting conditions.

[0079] BRDF: Bidirectional Reflectance Distribution Function, which is used to define how the radiant illumination in a given incident direction affects the radiance in a given outgoing direction.

[0080] BSDF: Bidirectional Scattering Distribution Function, used to study the optical properties of surface roughness of objects.

[0081] ALU: Arithmetic Logic Unit, arithmetic logic unit.

[0082] Texture mapping coordinates: also known as UV coordinates, means that all image files are a two-dimensional screen, the horizontal direction is U, and the vertical direction is V. Any pixel on the image can be located through the plane's UV coordinate system.

[0083] Ice is a common virtual object in games. Current methods for rendering ice models primarily use a BSDF to simulate the scattering of light entering the ice model's surface. The ice model is then rendered in a semi-transparent layer, and the scene behind it is distorted to simulate its transparency.

[0084] When ice models appear in large numbers in a game scene, simulating light scattering on their surfaces using BSDFs places significant ALU pressure on the GPU. Furthermore, this method introduces thickness information to describe the light transmittance of the ice models at different locations, and the additional texture sampling increases the pressure on the CPU to transmit data to the GPU. Furthermore, rendering the transparent layers of the ice models increases performance overhead, and the interweaving of other semi-transparent objects in the scene, such as volumetric fog, also increases maintenance costs.

[0085] Based on this, the embodiment of the present application provides an ice model rendering solution, which reduces the amount of calculation in the rendering process while ensuring the display effect of the ice model. The solution of the present application will be introduced below with reference to the accompanying drawings.

[0086] Figure 1 Schematic diagram of the process of the ice cube model rendering method provided in the embodiment of the present application Figure 1 ,like Figure 1 As shown, the method may include:

[0087] S11, obtaining an ice model to be rendered and a noise map of the ice model, where the noise map is used to indicate the texture of the ice model.

[0088] Rendering refers to the processing of visual effects on models during the game production process. For example, by setting relevant parameters of the model's lighting, materials, textures, colors, environment, etc., the effect of the model in a three-dimensional environment can be achieved.

[0089] In the embodiments of this application, an ice model is used. Unlike ordinary object models, an ice model has a certain degree of transparency. That is, under lighting conditions, the ice model has a certain degree of light transmittance, while ordinary object models do not. When constructing an ice cube in a game scene, the first step is to obtain the ice model to be rendered, and then to render the ice model. The ice model may include multiple faces, with different faces facing different directions.

[0090] S12: Determine orientation information of the ice cube model under the light source, where the orientation information is used to indicate whether each surface of the ice cube model is a front-lit surface or a back-lit surface.

[0091] Since the ice cube model is composed of multiple faces, different faces may present different visual effects. Therefore, after obtaining the ice cube model, the orientation information of the ice cube model under the light source can be determined.

[0092] Orientation information indicates whether each face of the ice cube model is directly illuminated or not. Different light source directions correspond to different orientation information for each face of the ice cube model. When constructing an ice cube under a specific light source, the direction of that light source is fixed. Given a fixed light source, the relationship between each face of the ice cube model and the direction of the light source can be used to determine whether it is directly illuminated or not. A directly illuminated face is a face that is directly illuminated by the light source, while a not directly illuminated face is a face that is not directly illuminated by the light source.

[0093] S13, performing parallax processing on the ice model according to the noise map to obtain an ice model including internal texture.

[0094] Since ice cubes are somewhat translucent, parallax processing is performed on the ice cube model based on the noise map to show its translucency under a light source. The noise map is used to indicate the texture of the ice cube model. Different areas of the ice cube model may have different translucency, and this variation can be expressed through the ice cube model's texture.

[0095] The noise map can be sampled using textures of different sizes, such as 256-bit textures or 128-bit textures, etc. After obtaining the noise map, multiple texture samplings can be performed based on the noise map to obtain an ice model containing internal textures.

[0096] S14, rendering the ice cube model including the internal texture according to the orientation information to obtain a rendered ice cube model.

[0097] After obtaining the orientation information, the ice model including the internal texture can be rendered based on the orientation information. For example, the orientation information can be used to distinguish the front and back lit sides of the ice model, and then different base colors can be set for the front and back lit sides based on color parameters to achieve the rendering of the ice model.

[0098] Since the front light side and the back light side of the ice model are distinguished, the internal texture of the ice model can be displayed after parallax processing is performed on the ice model in combination with the noise map, thereby simulating the light transmittance effect of the ice model.

[0099] The ice model rendering method provided in the embodiment of the present application first obtains the ice model to be rendered and a noise map of the ice model, then determines the orientation information of the ice model under the light source to distinguish the front and backlit sides of the ice model. Since the noise map can indicate the texture of the ice model, parallax processing is performed on the ice model according to the noise map to obtain an ice model containing internal texture, making the ice model more visually three-dimensional. Finally, the ice model containing internal texture is rendered according to the orientation information to obtain a rendered ice model. The scheme of the embodiment of the present application distinguishes the front and backlit sides of the ice model by obtaining orientation information, and then renders the ice model containing internal texture according to the orientation information. The front and backlit sides of the ice model can be rendered in different colors, which can show the light transmission effect of the ice model and achieve good rendering effect. When showing the light transmission effect of the ice model, there is no need to set the thickness information of the ice model or the scene information behind the ice model. The rendering can be performed on an opaque layer, which reduces the computational complexity of the rendering process and increases the controllability of the code.

[0100] The solution of the embodiment of the present application can be developed using Unity, based on the Unity URP pipeline, and the BRDF function in Unity is modified. First, the positive and negative points of the normal vectors of each face of the ice model and the light vector are used to distinguish the front and back surfaces of the ice model. Then, the corresponding diffuse reflection rendering color is calculated according to the front surface of the ice model, and the corresponding diffuse reflection rendering color is calculated according to the back surface of the ice model. The rendering colors of the front and back surfaces are linearly interpolated, and the front and back surfaces are merged to obtain the rendering color at the junction of the front and back surfaces. Finally, the rendering color of the highlight area in the Unity URP pipeline is added to perform rendering to obtain the display effect of the rendered ice model.

[0101] Figure 2 Schematic diagram of the process of the ice cube model rendering method provided in the embodiment of the present application Figure 2 ,like Figure 2 Shown, including:

[0102] S21, determining the orientation information of the ice cube model under the light source.

[0103] The ice cube model includes multiple surfaces. The orientation information of the ice cube model under the light source refers to whether each surface of the ice cube model is directly illuminated or not. Generally, when the object is non-translucent, the directly illuminated surface is the surface that the light source can directly illuminate, and the not directly illuminated surface is the surface that the light source cannot directly illuminate. Since the ice cube model has a certain degree of light transmittance, both the directly illuminated and not directly illuminated surfaces of the ice cube model should be displayed. However, the display effects of the directly illuminated and not directly illuminated surfaces will vary, so it is necessary to first determine the directly illuminated and not directly illuminated surfaces of the ice cube model.

[0104] One possible implementation is to obtain the light vector of the light source and the normal vectors of each face of the ice model. Since the light vector reflects the direction of the light source and the normal vector reflects the direction of each face of the ice model, the orientation information of each face of the ice model can be determined based on the light vector and the normal vector.

[0105] Specifically, we can perform a dot product on the light vector and the normal vector to get the corresponding dot product result. Let the light vector be a, the normal vector be b, and the angle between the light vector a and the normal vector b be θ (0=<θ=<π), then the dot product between the light vector a and the normal vector b is:

[0106] a·b=|a||b|cosθ.

[0107] Since both the light vector and the normal vector are vectors, the dot product result obtained by performing dot product processing on the light vector and the normal vector can be used to indicate the angle between the light vector and the normal vector. Therefore, the front lit side and the back lit side of the ice cube model can be determined based on the dot product result.

[0108] Among them, when the angle between the light vector and the normal vector is between 0 degrees and 90 degrees, the surface corresponding to the normal vector is the front-lit surface; when the angle between the light vector and the normal vector is between 90 degrees and 180 degrees, the surface corresponding to the normal vector is the backlit surface.

[0109] Figure 3 A schematic diagram of light vectors and normal vectors provided in the embodiment of this application is shown in FIG. Figure 3 As shown, vector a is the light vector, and the light comes from the right. Vector b is the normal vector of surface ACD, and vector c is the normal vector of surface ABC. Then the angle between vector a and vector b, and the angle between vector a and vector c are as follows: Figure 3 shown.

[0110] Based on the range of the angle between the light vector and the normal vector, it can be determined whether the corresponding surface is a front-lit surface or a back-lit surface. When the dot product of the light vector and the normal vector is a positive number, it means that the angle between the light vector and the normal vector is between 0 and 90 degrees. At this time, the surface corresponding to the normal vector is a front-lit surface under this light source. When the dot product of the light vector and the normal vector is a negative number, it means that the angle between the light vector and the normal vector is between 90 and 180 degrees. At this time, the surface corresponding to the normal vector is a back-lit surface under this light source.

[0111] For any face on the ice model, the dot product result between the normal vector of the face and the light vector can be used to determine whether the face is a front-lit face or a back-lit face, thereby distinguishing the entire ice model.

[0112] S22, performing parallax processing on the ice model according to the noise map to obtain an ice model including internal texture.

[0113] First, obtain the parallax processing parameters. Then, based on the parallax processing parameters, move and overlay the noise map within the ice model to obtain an ice model that includes the internal texture. Specifically, the noise map can be moved up and down based on the ice model's tangent space realization and the surface tangent space normal, thus simulating a parallax effect by performing multiple moves and overlays. Figure 4 A schematic diagram of the rendering interface provided in the embodiment of the present application is shown as follows: Figure 4 As shown, the parallax processing parameters of the ice model can be set in Unity. The parallax processing parameters can be, for example, noise color, noise range, noise intensity, noise uv, parallax intensity, etc. By setting the parallax processing parameters such as noise color, noise range, noise intensity, etc., different properties can be set for the noise map. For example, by adjusting the noise intensity, the transmittance of the ice model after the noise map is moved and superimposed in the ice model can be changed. In addition to noise color, noise range, noise intensity, noise uv, parallax intensity, etc., the parallax processing parameters can also include the number of superpositions, which is used to indicate the number of times the noise map is moved and superimposed in the ice model. The more superpositions, the better the display effect of the ice model, but the amount of calculation also increases accordingly. The parallax processing parameters can be adjusted by, for example, Figure 4 The interface in is set up in Unity.

[0114] S23, determining the rendering color of the front light side and the rendering color of the back light side of the ice cube model.

[0115] The ice cube model includes multiple front-lit surfaces and multiple back-lit surfaces, and each surface may have a different angle with the direction of the light source. For example, among the front-lit surfaces of the ice cube model, there may be a front-lit surface whose normal vector forms a 30-degree angle with the light vector, another may form a 50-degree angle with the light vector, another may form a 72-degree angle with the light vector, and so on. Among the back-lit surfaces of the ice cube model, there may be a back-lit surface whose normal vector forms a 100-degree angle with the light vector, another may form a 145-degree angle with the light vector, another may form a 122-degree angle with the light vector, and so on.

[0116] The surfaces on the ice model that are at different angles to the light vector should have different display effects. For example, two positive light surfaces whose normal vectors are at angles of 30 degrees and 50 degrees to the light vector should have different display effects, even though they are both positive light surfaces. Therefore, the rendering colors of these two positive light surfaces should be different.

[0117] In a possible implementation, the rendering color of the front-lit surface and the rendering color of the back-lit surface may be determined according to a dot product result of a light vector and a normal vector.

[0118] Since the dot product result can reflect the angle between the light vector and the normal vector, the dot product result can also indirectly reflect the angle between each face of the ice model and the light.

[0119] After obtaining the orientation information of the ice model, each surface on the ice model can be divided into a front-lit surface and a back-lit surface. Then, a base color can be set for the front-lit surface and the back-lit surface, and the rendering color of each surface at different angles can be determined based on the dot product result.

[0120] Specifically, first obtain the first color parameter and the second color parameter, wherein the first color parameter is the basic color parameter of the front light side of the ice cube model, and the second color parameter is the basic color parameter of the back light side of the ice cube model. For the ice cube model, the first color parameter can be set to light blue, and the second color parameter can be set to a dark blue that is slightly darker than the color corresponding to the first color parameter. For example, Figure 4 In the interface shown, the first color parameter of the front light side can be set through "Front Color", and the second color parameter of the back light side can be set through "Back Color". In another implementation, a color map can also be obtained, and the first color parameter and the second color parameter can be obtained based on the color map.

[0121] Then, the rendering color of each frontal surface can be determined based on the first color parameter and the dot product results corresponding to each frontal surface of the ice cube model. Specifically, the dot product results corresponding to each frontal surface can be mapped to a range of 0 to 1 and then subjected to a semi-Lambertian process to obtain the intensity of the reflected light on the frontal surface.

[0122] Semi-Lambert processing is the process of obtaining diffuse light intensity based on the Semi-Lambert lighting model. The Semi-Lambert lighting model is relative to the Lambert lighting model. For the Lambert lighting model, the brightness of the material surface directly depends on the cosine value of the angle between the light vector and the normal vector. The Lambert lighting model can be expressed as follows:

[0123] Diffuse1=(light*mdiffuse)*max(0,L·N),

[0124] Where light is the intensity of the light source, mdiffuse is the diffuse color of the model, L is the light vector, N is the normal vector, L·N is the dot product of the light vector and the normal vector, and Diffuse1 is the intensity of the reflected light of the material under the Lambert lighting model.

[0125] The semi-Lambert illumination model can be expressed as follows:

[0126] Diffuse2=(light*mdiffuse)*(0.5*(L·N)+0.5),

[0127] Where light is the intensity of the light source, mdiffuse is the diffuse color of the model, L is the light vector, N is the normal vector, L·N is the dot product of the light vector and the normal vector, and Diffuse2 is the intensity of the reflected light of the material under the semi-Lambert lighting model.

[0128] Figure 5 This is a schematic diagram comparing ice cube models provided in the embodiments of the present application. Figure 5 The above is the display effect of the ice model without semi-Lambert treatment. Figure 5 Below is the display effect of the ice model with semi-Lambert treatment, according to Figure 5 It can be seen that the ice model after semi-Lambert processing can avoid the problem of too dark display color in the backlight area, and the display effect is more natural.

[0129] The first color parameter is then added to the parallax of the front light surface of the ice cube model to obtain the summed result. The intensity of the reflected light on the front light surface is multiplied by the summed result to obtain a rendering color parameter of the front light surface, which is used to indicate the rendering color of the front light surface.

[0130] The rendering color of each backlit surface can be determined based on the second color parameter and the dot product results corresponding to each backlit surface on the ice cube model. Specifically, the dot product results corresponding to each backlit surface can be mapped to a range of -1 to 0 and subjected to Lambert processing to obtain the intensity of the reflected light on the backlit surface. The second color parameter is then added to the parallax of the backlit surface on the ice cube model to obtain the added result. The intensity of the reflected light on the backlit surface is multiplied by the added result to obtain the rendering color parameter of the backlit surface, which is used to indicate the rendering color of the backlit surface.

[0131] S24, determining the rendering color at the junction of the front light surface and the back light surface.

[0132] The dot product of the normal vector and the light vector can be used to distinguish the illuminated and unilluminated sides of the ice cube model. A illuminated side is one where the dot product of the corresponding normal vector and the light vector is positive, while an unilluminated side is one where the dot product of the corresponding normal vector and the light vector is negative.

[0133] In the ice cube model, the junction of the front-lit surface and the back-lit surface is also included. The junction is the surface where the dot product of the corresponding normal vector and the light vector is 0.

[0134] In S23 , the rendering color of the front light surface and the rendering color of the back light surface are determined respectively according to the first color parameter and the second color parameter.

[0135] To create a more natural transition between the front and backlight surfaces, linear interpolation can be performed at the interface between the two surfaces based on the rendered colors of the front and backlight surfaces. For example, the rendered color parameters of the front and backlight surfaces can be interpolated and averaged to obtain the rendered color parameters at the interface. This linear interpolation creates a more natural color transition at the interface between the front and backlight surfaces, without creating an abrupt display effect.

[0136] After determining the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction, the ice model containing the internal texture can be rendered according to the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction to obtain a rendered ice model.

[0137] S25, determining the rendering color of the highlight area.

[0138] Because the ice model has texture, different areas reflect differently. For example, some areas are rougher, where light primarily reflects diffusely; others are smoother, where light primarily reflects specularly. Therefore, to achieve a more natural display, you can identify the highlight areas of the ice model and set a corresponding rendering color for these areas.

[0139] S26 , rendering the ice model including the internal texture according to the rendering color of the highlight area, the rendering color of the front light surface, the rendering color of the back light surface, and the rendering color of the boundary to obtain a rendered ice model.

[0140] Figure 6 and Figure 7 shows the ice model rendered according to the above ice model rendering method, Figure 6 Schematic diagram of the rendered ice model provided in the embodiment of the present application Figure 1 , Figure 7 Schematic diagram of the rendered ice model provided in the embodiment of the present application Figure 2 ,like Figure 6 and Figure 7 As shown, Figure 6 This is the display effect of the positive light surface of the rendered ice model in Unity. Figure 7 This is the display effect of the backlit side of the rendered ice model in Unity. Figure 6 and Figure 7 In the rendering method of the ice model provided by the present application, the rendering color of each surface of the ice model presents different colors according to the angle between the light and the surface, and the highlight area of ​​the ice model shows a highlight display effect.

[0141] The ice model rendering method provided in the embodiment of the present application first obtains the ice model to be rendered and a noise map of the ice model, then determines the orientation information of the ice model under the light source to distinguish the front and backlit sides of the ice model. Since the noise map can indicate the texture of the ice model, parallax processing is performed on the ice model according to the noise map to obtain an ice model containing internal texture, making the ice model more visually three-dimensional. Finally, the ice model containing internal texture is rendered according to the orientation information to obtain a rendered ice model. The scheme of the embodiment of the present application distinguishes the front and backlit sides of the ice model by obtaining orientation information, and then renders the ice model containing internal texture according to the orientation information. The front and backlit sides of the ice model can be rendered in different colors, which can show the light transmission effect of the ice model and achieve good rendering effect. When showing the light transmission effect of the ice model, there is no need to set the thickness information of the ice model or the scene information behind the ice model. The rendering can be performed on an opaque layer, which reduces the computational complexity of the rendering process and increases the controllability of the code.

[0142] Figure 8 A schematic diagram of the structure of an ice cube model rendering device provided in an embodiment of the present application is shown as follows: Figure 8 As shown, the device includes:

[0143] An acquisition module 81 is configured to acquire an ice model to be rendered and a noise map of the ice model, wherein the noise map is used to indicate a texture of the ice model;

[0144] a determination module 82 for determining orientation information of the ice cube model under a light source, wherein the orientation information is used to indicate whether each surface of the ice cube model is a front-lit surface or a back-lit surface;

[0145] a processing module 83 for performing parallax processing on the ice model according to the noise map to obtain an ice model including internal texture;

[0146] The rendering module 84 is configured to render the ice model including the internal texture according to the orientation information to obtain a rendered ice model.

[0147] In a possible implementation, the determining module 82 is specifically configured to:

[0148] Obtaining the light vector of the light source and the normal vector of each surface of the ice model;

[0149] The orientation information is determined according to the light vector and the normal vector.

[0150] In a possible implementation, the determining module 82 is specifically configured to:

[0151] Performing a dot product process on the light vector and the normal vector to obtain a dot product result, where the dot product result is used to indicate an angle between the light vector and the normal vector;

[0152] The front light side and the back light side of the ice cube model are determined according to the dot product result.

[0153] In a possible implementation, the processing module 83 is specifically configured to:

[0154] Get overlay parameters;

[0155] According to the superposition parameters, the noise map is moved and superimposed within the ice model to obtain the ice model containing the internal texture.

[0156] In a possible implementation, the rendering module 84 is specifically configured to:

[0157] Determining the rendering color of the front light surface and the rendering color of the back light surface according to the dot product result;

[0158] Determining a rendering color at a junction of the front light surface and the back light surface;

[0159] The ice cube model including the internal texture is rendered according to the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction to obtain the rendered ice cube model.

[0160] In a possible implementation, the rendering module 84 is specifically configured to:

[0161] Get the first color parameter and the second color parameter;

[0162] Determining the rendering color of each of the front light surfaces according to the first color parameter and the dot product result corresponding to each of the front light surfaces;

[0163] The rendering color of each backlight surface is determined according to the second color parameter and the dot product result corresponding to each backlight surface.

[0164] In a possible implementation, the rendering module 84 is specifically configured to:

[0165] Linear interpolation processing is performed on the rendering color of the front light surface and the rendering color of the back light surface corresponding to the intersection to obtain the rendering color of the intersection.

[0166] In a possible implementation, the rendering module 84 is specifically configured to:

[0167] determining a highlight region in the ice model;

[0168] The ice model including the internal texture is rendered according to the rendering color of the highlight area, the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction to obtain the rendered ice model.

[0169] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.

[0170] Figure 9 A hardware structure diagram of an ice cube model rendering device provided by an embodiment of the present invention is shown in FIG. Figure 9 As shown, the ice model rendering device 90 of this embodiment includes: a processor 91 and a memory 92;

[0171] Memory 92, for storing computer-executable instructions;

[0172] The processor 91 is configured to execute computer-executable instructions stored in the memory to implement the various steps of the ice cube model rendering method in the above embodiment. For details, please refer to the relevant description in the above method embodiment.

[0173] Optionally, the memory 92 may be independent or integrated with the processor 91 .

[0174] When the memory 92 is independently provided, the ice cube model rendering device further includes a bus 93 for connecting the memory 92 and the processor 91 .

[0175] An embodiment of the present invention further provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the ice model rendering method executed by the above ice model rendering device is implemented.

[0176] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or module, which can be electrical, mechanical or other forms.

[0177] The integrated modules implemented in the form of software functional modules can be stored in a computer-readable storage medium. The software functional modules stored in a storage medium include instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute some of the steps of the methods described in various embodiments of the present invention.

[0178] It should be understood that the processor described above may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), or application-specific integrated circuits (ASICs). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.

[0179] The memory may include a high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk.

[0180] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses shown in the drawings of the present invention are not limited to just one bus or just one type of bus.

[0181] The storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0182] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0183] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for rendering an ice model, characterized in that: include: Obtaining an ice model to be rendered and a noise map of the ice model, wherein the noise map is used to indicate the texture of the ice model; determining orientation information of the ice cube model under a light source, wherein the orientation information is used to indicate whether each side of the ice cube model is a front-lit side or a back-lit side; performing parallax processing on the ice model according to the noise map to obtain an ice model including internal texture; Rendering the ice model including the internal texture according to the orientation information to obtain a rendered ice model; The performing parallax processing on the ice model according to the noise map to obtain an ice model including internal texture includes: Get parallax processing parameters; According to the parallax processing parameters, the noise map is moved and superimposed within the ice model to obtain the ice model containing the internal texture.

2. The method according to claim 1, characterized in that Determining the orientation information of the ice model under the light source includes: Obtaining the light vector of the light source and the normal vector of each surface of the ice model; The orientation information is determined according to the light vector and the normal vector.

3. The method according to claim 2, characterized in that The determining the orientation information according to the light vector and the normal vector includes: Performing a dot product process on the light vector and the normal vector to obtain a dot product result, where the dot product result is used to indicate an angle between the light vector and the normal vector; The front light side and the back light side of the ice cube model are determined according to the dot product result.

4. The method according to claim 3, characterized in that The step of rendering the ice model including the internal texture according to the orientation information to obtain a rendered ice model includes: Determining the rendering color of the front light surface and the rendering color of the back light surface according to the dot product result; Determining a rendering color at a junction of the front light surface and the back light surface; The ice cube model including the internal texture is rendered according to the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction to obtain the rendered ice cube model.

5. The method according to claim 4, characterized in that Determining the rendering color of the front light surface and the rendering color of the back light surface according to the dot product result includes: Get the first color parameter and the second color parameter; Determining the rendering color of each of the front light surfaces according to the first color parameter and the dot product result corresponding to each of the front light surfaces; The rendering color of each backlight surface is determined according to the second color parameter and the dot product result corresponding to each backlight surface.

6. The method according to claim 4, characterized in that The determining of the rendering color at the boundary between the front light surface and the back light surface includes: Linear interpolation processing is performed on the rendering color of the front light surface and the rendering color of the back light surface corresponding to the intersection to obtain the rendering color of the intersection.

7. The method according to claim 4, characterized in that The step of rendering the ice model including the internal texture according to the rendering color of the front surface, the rendering color of the backlight surface, and the rendering color of the boundary to obtain the rendered ice model includes: determining a highlight region in the ice model; The ice model including the internal texture is rendered according to the rendering color of the highlight area, the rendering color of the front light surface, the rendering color of the back light surface and the rendering color of the junction to obtain the rendered ice model.

8. An ice model rendering device, characterized in that: include: an acquisition module, configured to acquire an ice model to be rendered and a noise map of the ice model, wherein the noise map is used to indicate a texture of the ice model; a determination module, configured to determine orientation information of the ice cube model under a light source, wherein the orientation information is used to indicate whether each surface of the ice cube model is a front-lit surface or a back-lit surface; a processing module, configured to perform parallax processing on the ice model according to the noise map to obtain an ice model including internal texture; a rendering module, configured to render the ice model including the internal texture according to the orientation information to obtain a rendered ice model; A processing module, specifically used to obtain parallax processing parameters; According to the parallax processing parameters, the noise map is moved and superimposed within the ice model to obtain the ice model containing the internal texture.

9. An ice model rendering device, characterized in that: include: Memory, used to store programs; A processor is used to execute the program stored in the memory. When the program is executed, the processor is used to execute the ice model rendering method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The method comprises instructions which, when executed on a computer, enable the computer to execute the ice model rendering method according to any one of claims 1 to 7.

11. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the ice model rendering method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Crystal stone model rendering method and device, electronic equipment and storage medium

    CN111899325A