Graphical rendering method, apparatus, electronic device, and storage medium

By calculating the final rendered color of each pixel in the graphics rendering and using visual angle adjustment to enhance the sense of wrinkles, the problems of lighting dependence and rendering pressure are solved, and the display effect of wrinkled surfaces is improved in the absence of light.

CN114494560BActive Publication Date: 2026-01-02NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210145990.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-17
Publication Date
2026-01-02
Estimated Expiration
2042-02-17

AI Technical Summary

Technical Problem

Existing technologies for improving the display effect of wrinkled surfaces in graphics rendering suffer from problems such as lighting dependence and excessive graphics rendering pressure due to the increase in the number of model faces.

Method used

By obtaining the normal and camera direction vector of each pixel of the wrinkled surface to be rendered, and combining them with the basic color, the final rendering color of each pixel is calculated. The visual angle adjustment is used to enhance the wrinkle effect, avoid lighting dependence, and reduce the number of model faces.

Benefits of technology

Even in the absence of light, it can effectively enhance the wrinkle effect of wrinkled surfaces, reduce the graphics rendering pressure, and improve the display effect without increasing the number of model faces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494560B_ABST
    Figure CN114494560B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a graphics rendering method and device, electronic equipment and computer readable storage medium; the embodiments of the present application can obtain the basic color of each pixel of the to-be-rendered wrinkled surface based on the color map of the to-be-rendered wrinkled surface; the normal map of the to-be-rendered wrinkled surface is used to obtain the normal of each pixel of the to-be-rendered wrinkled surface; the final rendering color of each pixel of the to-be-rendered wrinkled surface is obtained according to the normal of each pixel, the camera direction vector of the rendering camera of the to-be-rendered wrinkled surface and the basic color of each pixel; the to-be-rendered wrinkled surface is rendered according to the final rendering color of each pixel, and the final rendering effect of the to-be-rendered wrinkled surface is obtained, and the final rendering color of each pixel is used to improve the display effect of the to-be-rendered wrinkled surface. The embodiments of the present application can effectively improve the wrinkling effect of the wrinkled surface in the case of no light, and effectively improve the display effect of the wrinkled surface in the case of reducing the graphics rendering pressure.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a graphics rendering method and device, electronic equipment and computer readable storage medium. BACKGROUND

[0002] In graphics rendering, there are usually many presentations of wrinkled surfaces, such as moss, soil piles, and rock surfaces. That is, improving the display effect of the wrinkled surface (i.e., improving the expressiveness of the wrinkled surface) can improve the authenticity and expressiveness of the graphics.

[0003] There are mainly two ways to improve the display effect of the wrinkled surface in the existing graphics rendering, one is to improve the intensity of the normal line, and the other is to increase the number of surfaces of the model.

[0004] However, the two wrinkled surface effect improvement methods currently have obvious problems. First, when the display effect of the wrinkled surface is improved by improving the intensity of the normal line, the wrinkled effect is closely related to the light direction, so there is a problem that the wrinkled effect can only be shown in the place where the light shines and it is difficult to express the wrinkled effect in the dark. Second, when the display effect of the wrinkled surface is improved by increasing the number of surfaces of the model, the increase in the number of model surfaces will cause high memory, and thus cause the problem of excessive graphics rendering pressure. SUMMARY

[0005] The embodiments of the present application provide a graphics rendering method, device, electronic equipment and computer readable storage medium, which can avoid the inevitable association between the wrinkled effect and the light, thereby effectively improving the wrinkled effect of the wrinkled surface in the absence of light. On the other hand, the number of surfaces of the model does not need to be increased to improve the display effect of the wrinkled surface, thereby effectively improving the display effect of the wrinkled surface while reducing the graphics rendering pressure.

[0006] In a first aspect, the embodiments of the present application provide a graphics rendering method, comprising:

[0007] obtaining a basic color of each pixel of a wrinkled surface to be rendered based on a color map of the wrinkled surface to be rendered;

[0008] obtaining a normal line of each pixel of the wrinkled surface to be rendered based on a normal map of the wrinkled surface to be rendered;

[0009] obtaining a final rendering color of each pixel of the wrinkled surface to be rendered according to the normal line of the each pixel, a camera direction vector of a rendering camera of the wrinkled surface to be rendered, and the basic color of the each pixel, wherein the final rendering color of the each pixel is used to reflect a visual included angle formed between the normal line of the each pixel and the camera direction vector;

[0010] According to the final rendering color of each pixel, the to-be-rendered wrinkled surface is rendered to obtain a final rendering effect of the to-be-rendered wrinkled surface, and the final rendering color of each pixel is used to improve the display effect of the to-be-rendered wrinkled surface.

[0011] In some embodiments, the obtaining, according to the normal of each pixel, a camera direction vector of a rendering camera of the to-be-rendered wrinkled surface and a basic color of each pixel, of a final rendering color of each pixel of the to-be-rendered wrinkled surface comprises:

[0012] According to the normal of each pixel and the camera direction vector, a relative position between each pixel and the rendering camera is obtained;

[0013] The relative position between each pixel and the rendering camera and the basic color of each pixel are multiplied to obtain the final rendering color of each pixel.

[0014] In some embodiments, the obtaining, according to the normal of each pixel and the camera direction vector, of a relative position between each pixel and the rendering camera comprises:

[0015] According to the dot product of the normal of each pixel and the camera direction vector, a camera-facing degree of each pixel is obtained;

[0016] According to the dot product of the normal of each pixel and the camera direction vector, a camera-facing degree of each pixel is obtained;

[0017] According to the camera-facing degree of each pixel and the camera-facing degree of each pixel, the relative position between each pixel and the rendering camera is determined.

[0018] In some embodiments, the obtaining, according to the normal of each pixel and the camera direction vector, of a relative position between each pixel and the rendering camera comprises:

[0019] According to the dot product of the normal of each pixel and the camera direction vector, a camera-facing degree of each pixel is obtained;

[0020] The camera-facing degree of each pixel is taken as the relative position between each pixel and the rendering camera.

[0021] In some embodiments, the obtaining, according to the normal of each pixel and the camera direction vector, of a relative position between each pixel and the rendering camera comprises:

[0022] According to the dot product of the normal of each pixel and the camera direction vector, a camera-facing degree of each pixel is obtained;

[0023] obtaining a degree of facing away from the camera of each pixel as a relative position between the each pixel and the rendering camera.

[0024] In some embodiments, the obtaining the final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel, the camera direction vector of the to-be-rendered wrinkled surface and the basic color of each pixel comprises:

[0025] calculating the final rendering color of each pixel according to the normal of each pixel, the camera direction vector, the basic color of each pixel and a first preset formula, the first preset formula being:

[0026] FinalColor = Color * (K1 * dot(Normal, CameraVector) + K2 * (1-dot(Normal, CameraVector)));

[0027] wherein dot(Normal, CameraVector) represents a dot product of the normal of each pixel and the camera direction vector, K1 is a facing coefficient, K2 is a facing away coefficient, K1 is used to adjust the degree of facing the camera of each pixel, K2 is used to adjust the degree of facing away from the camera of each pixel, Color represents the basic color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0028] In some embodiments, the obtaining the final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel, the camera direction vector of the to-be-rendered wrinkled surface and the basic color of each pixel comprises:

[0029] calculating the final rendering color of each pixel according to the normal of each pixel, the camera direction vector, the basic color of each pixel and a second preset formula, the second preset formula being: FinalColor = Color * (K1 * dot(Normal, CameraVector));

[0030] wherein dot(Normal, CameraVector) represents a dot product of the normal of each pixel and the camera direction vector, K1 is a facing coefficient, K1 is used to adjust the degree of facing the camera of each pixel, Color represents the basic color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0031] In some embodiments, the obtaining the final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel, the camera direction vector of the to-be-rendered wrinkled surface, and the base color of each pixel comprises:

[0032] The final rendering color of each pixel is calculated according to the normal of each pixel, the camera direction vector, the base color of each pixel, and a third preset formula, and the third preset formula is FinalColor = Color * (K2 * (1-dot(Normal, CameraVector)));

[0033] Wherein, dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K2 is a back coefficient, K2 is used to adjust the degree of back camera of each pixel, Color represents the base color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0034] In a second aspect, the embodiments of the present application further provide a graphics rendering device, comprising:

[0035] A first obtaining unit is configured to obtain the base color of each pixel of the to-be-rendered wrinkled surface based on a color map of the to-be-rendered wrinkled surface.

[0036] The first obtaining unit is further configured to obtain the normal of each pixel of the to-be-rendered wrinkled surface based on a normal map of the to-be-rendered wrinkled surface.

[0037] A second obtaining unit is configured to obtain the final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel, the camera direction vector of the rendering camera of the to-be-rendered wrinkled surface, and the base color of each pixel, wherein the final rendering color of each pixel is used to reflect the visual included angle formed between the normal of each pixel and the camera direction vector.

[0038] A rendering unit is configured to render the to-be-rendered wrinkled surface according to the final rendering color of each pixel, so as to obtain the final rendering effect of the to-be-rendered wrinkled surface, and the final rendering color of each pixel is used to improve the display effect of the to-be-rendered wrinkled surface.

[0039] In some embodiments, the second obtaining unit is specifically configured to:

[0040] According to the normal of each pixel and the camera direction vector, the relative position between each pixel and the rendering camera is obtained.

[0041] multiplying the relative position between the each pixel and the rendering camera and the base color of the each pixel, to obtain a final rendering color of the each pixel.

[0042] In some embodiments, the second obtaining unit is specifically configured to:

[0043] performing dot product on the normal of the each pixel and the camera direction vector, to obtain a camera-facing degree of the each pixel;

[0044] performing dot product on the normal of the each pixel and the camera direction vector, to obtain a camera-facing degree of the each pixel;

[0045] determining the relative position between the each pixel and the rendering camera according to the camera-facing degree of the each pixel and the camera-facing degree of the each pixel.

[0046] In some embodiments, the second obtaining unit is specifically configured to:

[0047] performing dot product on the normal of the each pixel and the camera direction vector, to obtain a camera-facing degree of the each pixel;

[0048] taking the camera-facing degree of the each pixel as the relative position between the each pixel and the rendering camera.

[0049] In some embodiments, the second obtaining unit is specifically configured to:

[0050] performing dot product on the normal of the each pixel and the camera direction vector, to obtain a camera-facing degree of the each pixel;

[0051] taking the camera-facing degree of the each pixel as the relative position between the each pixel and the rendering camera.

[0052] In some embodiments, the second obtaining unit is specifically configured to:

[0053] calculating the final rendering color of the each pixel according to the normal of the each pixel, the camera direction vector, the base color of the each pixel and a first preset formula, the first preset formula being:

[0054] FinalColor = Color * (K1 * dot(Normal, CameraVector) + K2 * (1 - dot(Normal, CameraVector)));

[0055] dot(Normal,CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K1 is a forward coefficient, K2 is a backward coefficient, K1 is used to adjust the degree of each pixel facing the camera, K2 is used to adjust the degree of each pixel facing away from the camera, Color represents the basic color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0056] In some embodiments, the second obtaining unit is specifically configured to:

[0057] According to the normal of each pixel, the camera direction vector, the basic color of each pixel, and a second preset formula, the final rendering color of each pixel is calculated, and the second preset formula is FinalColor=Color*(K1*dot(Normal,CameraVector));

[0058] dot(Normal,CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K1 is a forward coefficient, K1 is used to adjust the degree of each pixel facing the camera, Color represents the basic color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0059] In some embodiments, the second obtaining unit is specifically configured to:

[0060] According to the normal of each pixel, the camera direction vector, the basic color of each pixel, and a third preset formula, the final rendering color of each pixel is calculated, and the third preset formula is FinalColor=Color*(K2*(1-dot(Normal,CameraVector)));

[0061] dot(Normal,CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K2 is a backward coefficient, K2 is used to adjust the degree of each pixel facing away from the camera, Color represents the basic color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0062] In a third aspect, the embodiments of the present application also provide an electronic device, including a memory storing a plurality of instructions; the processor loads the instructions from the memory to execute the steps in any one of the graphic rendering methods provided by the embodiments of the present application.

[0063] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium storing a plurality of instructions, which are adapted to be loaded by a processor to execute the steps in any of the graphic rendering methods provided by the embodiments of the present application.

[0064] The embodiments of the present application render the to-be-rendered wrinkled surface by obtaining the final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel of the to-be-rendered wrinkled surface, the camera direction vector of the rendering camera of the to-be-rendered wrinkled surface, and the basic color of each pixel of the to-be-rendered wrinkled surface, and obtaining the final rendering effect of the to-be-rendered wrinkled surface; in the first aspect, since the visual angle between each pixel and the rendering camera can be applied to the basic color of each pixel, the visual angle between each pixel and the rendering camera on the to-be-rendered wrinkled surface can be enhanced or weakened by artificially adjusting the visual angle between each pixel and the rendering camera, thereby improving the richness of the wrinkled surface; in the second aspect, since the final rendering effect of the to-be-rendered wrinkled surface is only related to the normal of each pixel and the camera direction vector, and is not related to the light, the inevitable association between the wrinkled effect and the light can be avoided, thereby effectively improving the wrinkled feeling of the wrinkled surface in the case of no light; in the third aspect, since the number of surfaces of the model does not need to be increased to improve the display effect of the wrinkled surface, the display effect of the wrinkled surface is effectively improved in the case of reducing the graphic rendering pressure. BRIEF DESCRIPTION OF DRAWINGS

[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort.

[0066] Figure 1 is an embodiment flowchart of the graphic rendering method provided by the embodiments of the present application;

[0067] Figure 2 is a schematic diagram of the normal of the to-be-rendered wrinkled surface in the embodiments of the present application;

[0068] Figure 3 is a schematic diagram of the visual angle between the normal of each pixel and the rendering camera provided by the embodiments of the present application;

[0069] Figure 4 is an embodiment description schematic diagram of the graphic rendering process provided by the embodiments of the present application;

[0070] Figure 5 is a structural schematic diagram of the graphic rendering device provided by the embodiments of the present application;

[0071] Figure 6 FIG. 1 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0072] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application. Meanwhile, in the description of the embodiments of the present application, the terms "first", "second", and the like are only used for differentiation and description, and cannot be understood as indicating or implying relative importance. Therefore, the features with "first" and "second" can explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise specifically limited.

[0073] The embodiments of the present application provide a graphics rendering method and device, an electronic device and a computer readable storage medium.

[0074] Specifically, the graphics rendering method of the embodiments of the present application can be executed by an electronic device, where the electronic device can be a terminal, a server, and the like. The terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, a touch screen, a game console, or a personal computer (PC), and the like. The server can be a single server or a server cluster composed of multiple servers.

[0075] For example, the electronic device can be a mobile terminal, which can acquire a basic color of each pixel of a to-be-rendered wrinkled surface based on a color map of the to-be-rendered wrinkled surface through a network; acquire a normal of each pixel of the to-be-rendered wrinkled surface based on a normal map of the to-be-rendered wrinkled surface; acquire a final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel, a camera direction vector of a rendering camera of the to-be-rendered wrinkled surface, and the basic color of each pixel, where the final rendering color of each pixel is used to reflect a visual included angle formed between the normal of each pixel and the camera direction vector; and render the to-be-rendered wrinkled surface according to the final rendering color of each pixel to obtain a final rendering effect of the to-be-rendered wrinkled surface, where the final rendering color of each pixel is used to improve the display effect of the to-be-rendered wrinkled surface.

[0076] The graphic rendering device can be integrated in an electronic device, and in some embodiments, the graphic rendering device can also be integrated in multiple electronic devices, for example, the graphic rendering device can be integrated in multiple servers, and the graphic rendering method of the present application can be implemented by the multiple servers. For another example, the graphic rendering device can be integrated in multiple terminals, and the graphic rendering method of the present application can be implemented by the multiple terminals.

[0077] In some embodiments, the server can also be implemented in the form of a terminal, for example, a personal computer can be set as a server to integrate the graphic rendering device, and the graphic rendering method of the present application can be implemented by the server set by the personal computer.

[0078] The following will be described in detail respectively. It should be noted that the serial numbers of the following embodiments are not regarded as the limitation of the preferred order of the embodiments.

[0079] Reference Figure 1 , Figure 1 is a flowchart of a graphic rendering method provided by an embodiment of the present application. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here, for example, step 101 can be executed before step 102, or step 102 can be executed before step 101, or steps 101 and 102 can be executed simultaneously. In the present embodiment, the graphic rendering method comprises steps 101-104, wherein:

[0080] 101. Based on a color map of a to-be-rendered wrinkled surface, obtain the basic color of each pixel of the to-be-rendered wrinkled surface.

[0081] The to-be-rendered wrinkled surface is the surface of a virtual object that needs to be rendered with a wrinkled effect, for example, moss, soil pile, rock surface, etc.

[0082] The color map is a map used to store the color of a surface in graphic rendering, and in the present embodiment, the color map is specifically used to store the basic color of each pixel of the to-be-rendered wrinkled surface. For example, the color map of the to-be-rendered wrinkled surface can be a Diffuse Map, Albedo, Base Color, etc.

[0083] In step 101, the basic color of each pixel is extracted from the color map of the to-be-rendered wrinkled surface when the wrinkled surface is rendered.

[0084] 102. Based on a normal map of the to-be-rendered wrinkled surface, obtain the normal of each pixel of the to-be-rendered wrinkled surface.

[0085] The normal map is an application of the bump mapping technique, and the normal map stores the normal of the surface, and is specifically used to store the normal of each pixel of the to-be-rendered wrinkled surface. Since the direction is a relative coordinate space, there are three different normal maps in the graphic rendering: the tangent space normal map, the object space normal map, and the world space normal map. The three normal maps have respective advantages and disadvantages and can achieve the same effect, only the calculation method is different.

[0086] The world space normal map is a normal map based on global coordinates.

[0087] The object space (or model space) normal map is based on the entire object rather than each face.

[0088] The tangent space normal is based on the tangent direction of each face. The normal map in the tangent space is the most common form of normal map. In this paper, the normal map in the tangent space is taken as an example to illustrate the graphic rendering method of the embodiments of the application, as shown in Figure 2 Figure 2 is a schematic diagram of the normal of the to-be-rendered wrinkled surface in the embodiments of the application. The normal map stores the normal of each pixel on the to-be-rendered wrinkled surface.

[0089] In step 101, the normal of each pixel is extracted from the normal map of the to-be-rendered wrinkled surface when the wrinkled surface is rendered.

[0090] 103. Obtain the final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel, the camera direction vector of the rendering camera of the to-be-rendered wrinkled surface, and the basic color of each pixel.

[0091] The final rendering color of each pixel is used to reflect the visual included angle constructed between the normal of each pixel and the camera direction vector.

[0092] The normal of each pixel and the camera direction vector are used to construct the visual included angle between each pixel and the rendering camera, and the final rendering color of each pixel is specifically used to act the visual included angle between each pixel and the rendering camera on the basic color of each pixel.

[0093] The rendering camera is a camera used to render the to-be-rendered wrinkled surface. For example, if the to-be-rendered wrinkled surface is a moss surface in a game scene, the game camera of the moss surface in the game scene is the rendering camera of the to-be-rendered wrinkled surface.

[0094] The camera direction vector refers to a representation vector of the direction of the rendering camera.

[0095] ​There are various ways to determine the final rendering color of each pixel of the wrinkled surface to be rendered in step 103, exemplarily including:

[0096] (I) First, determine the orientation degree of each pixel to the rendering camera, and then apply the orientation degree to the color map to obtain the final rendering color. At this time, step 103 can specifically include steps 1031A-1032A as follows:

[0097] 1031A, according to the normal of each pixel and the camera direction vector, obtaining the relative position between each pixel and the rendering camera.

[0098] Wherein, the relative position between each pixel and the rendering camera is used to indicate the degree of each pixel facing or facing away from the rendering camera.

[0099] There are various ways to determine the relative position of each pixel in step 1031A, exemplarily including:

[0100] ①The degree of each pixel facing the rendering camera (i.e. the camera orientation degree of each pixel) is used as the relative position between each pixel and the rendering camera. At this time, step 1031A can specifically include steps A1-A2 as follows:

[0101] A1, according to the dot product of the normal of each pixel and the camera direction vector, obtaining the camera orientation degree of each pixel.

[0102] Wherein, the camera orientation degree of each pixel is used to reflect the degree of each pixel facing the rendering camera. By changing the camera orientation degree of each pixel, the visual angle between each pixel and the rendering camera can be enhanced or weakened, and the basic color of each pixel is affected, thereby showing the richness of the wrinkled surface.

[0103] As shown in Figure 3 , Figure 3is a schematic diagram of a visual angle between a normal of each pixel and a rendering camera provided in an embodiment of the present application, a dot product of the normal of each pixel and a camera direction vector (denoted as "dot(Normal, CameraVector)") is equivalent to a dot product of two vectors (the normal vector and the camera direction vector), and the dot product of vectors can be used to describe an included angle between two directions in graphics rendering. Therefore, the dot product of the normal of each pixel and the camera direction vector ("dot(Normal, CameraVector)") reflects a degree to which each pixel faces the rendering camera; the dot product of the normal of each pixel and the camera direction vector is multiplied by a facing coefficient (denoted as "K1") again, and by adjusting a size of the facing coefficient K1, the degree to which each pixel faces the rendering camera can be adjusted to represent a richness of the wrinkled surface. As shown in the following formula (1), the normal of each pixel, the camera direction vector, and a preset facing formula can be substituted into the preset facing formula to directly calculate the degree to which each pixel faces the camera. At this time, the step A1 can specifically include: calculating the degree to which each pixel faces the camera according to the normal of each pixel, the camera direction vector, and the preset facing formula. Similarly, the degree to which each pixel in the wrinkled surface to be rendered faces the camera can be obtained. The preset facing formula is as follows:

[0104] P1 = K1 * dot(Normal, CameraVector) Formula (1)

[0105] In formula (1), dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K1 is a facing coefficient, K1 is used to adjust the degree to which each pixel faces the camera, and P1 represents the degree to which each pixel faces the camera.

[0106] In some embodiments, when the degree to which each pixel faces the camera is calculated, the facing coefficient K1 used by each pixel in the wrinkled surface to be rendered can have the same value.

[0107] In other embodiments, when the degree to which each pixel faces the camera is calculated, the facing coefficient K1 used by each pixel in the wrinkled surface to be rendered can also have different values.

[0108] A2, taking the degree to which each pixel faces the camera as a relative position between each pixel and the rendering camera.

[0109] By taking the camera-facing degree of each pixel as the relative position between each pixel and the rendering camera, the camera-facing degree of each pixel can be changed by adjusting the size of the facing coefficient K1, so as to enhance or weaken the visual angle between each pixel and the rendering camera, and finally act on the basic color of each pixel in combination with step 1032A, so as to improve the richness of the rendered wrinkle surface. Therefore, based on the camera-facing degree of each pixel as the relative position between each pixel and the rendering camera, the richness of the wrinkle surface to be rendered can be improved at the level of the visual angle of the pixel facing the camera.

[0110] ②Taking the degree of each pixel facing away from the rendering camera (i.e., the camera-facing degree of each pixel) as the relative position between each pixel and the rendering camera. At this time, step 1031A can specifically include the following steps B1-B2:

[0111] B1, obtaining the camera-facing degree of each pixel by performing dot product on the normal of each pixel and the camera direction vector.

[0112] Wherein, the camera-facing degree of each pixel is used to reflect the degree of each pixel facing away from the rendering camera. By changing the camera-facing degree of each pixel, the visual angle between each pixel and the rendering camera can be enhanced or weakened, and acts on the basic color of each pixel, so as to show the richness of the wrinkle surface.

[0113] Wherein, the dot product of the normal of each pixel and the camera direction vector (denoted as "dot(Normal,CameraVector)") is the dot product of two vectors (normal vector and camera direction vector), which can be used to describe the angle between two directions in graphics rendering. Therefore, (1-dot(Normal,CameraVector)) reflects the degree of each pixel facing away from the rendering camera; multiplying (1-dot(Normal,CameraVector)) by a facing coefficient (denoted as "K2"), the degree of each pixel facing away from the rendering camera can be adjusted by adjusting the size of the facing coefficient K2, so as to show the richness of the wrinkle surface. As shown in the following formula (2), the normal of each pixel and the camera direction vector can be directly calculated to obtain the camera-facing degree of each pixel by substituting them into the preset facing formula. At this time, step B1 can specifically include: calculating the camera-facing degree of each pixel according to the normal of each pixel, the camera direction vector and the preset facing formula. Wherein, the preset facing formula is as follows:

[0114] P2=K2*(1-dot(Normal,CameraVector) Formula (2)

[0115] In formula (2), dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K2 is a back coefficient, K2 is used to adjust the back camera degree of each pixel, and P2 represents the back camera degree of each pixel.

[0116] In some embodiments, the same value of the back coefficient K2 can be used for each pixel in the wrinkle surface to be rendered when calculating the back camera degree of each pixel.

[0117] In other embodiments, the back coefficient K2 used by each pixel in the wrinkle surface to be rendered can also take different values when calculating the back camera degree of each pixel.

[0118] B2, taking the back camera degree of each pixel as the relative position between each pixel and the rendering camera.

[0119] By taking the back camera degree of each pixel as the relative position between each pixel and the rendering camera, the back camera degree of each pixel can be changed by adjusting the size of the back coefficient K2 to enhance or weaken the visual angle between each pixel and the rendering camera, and finally acts on the basic color of each pixel in combination with step 1032A, thereby improving the richness of the rendered wrinkle surface. Therefore, determining the relative position between each pixel and the rendering camera based on the back camera degree of each pixel can improve the richness of the wrinkle surface to be rendered at the level of the visual angle of the pixel back camera.

[0120] ③ Based on the degree of each pixel towards the rendering camera and the degree of each pixel away from the rendering camera, determine the relative position between each pixel and the rendering camera. At this time, step 1031A can specifically include the following steps C1-C3:

[0121] C1, obtain the camera degree of each pixel by dot product of the normal of each pixel and the camera direction vector.

[0122] The way of obtaining the camera degree of each pixel in step C1 is similar to the way of obtaining the camera degree of each pixel in step A1 described above, and specific reference can be made to the related description in step A1 described above, which will not be repeated here.

[0123] For example, the normal of each pixel and the camera direction vector can be substituted into the above formula (1) to calculate the camera degree of each pixel.

[0124] C2, obtain the back camera degree of each pixel by dot product of the normal of each pixel and the camera direction vector.

[0125] The back camera degree of each pixel in step C2 is obtained in a similar manner to the back camera degree of each pixel obtained in step B1 described above, and details can be referred to the description of step A1 above, which will not be repeated here.

[0126] For example, the normal vector of each pixel and the camera direction vector can be substituted into formula (2) above to calculate the back camera degree of each pixel.

[0127] C3, determining the relative position between each pixel and the rendering camera according to the camera facing degree of each pixel and the back camera degree of each pixel.

[0128] For example, the camera facing degree of each pixel and the back camera degree of each pixel can be added together as the relative position between each pixel and the rendering camera. For example, the camera facing degree of each pixel, the back camera degree of each pixel can be substituted into formula (3) as follows to calculate the relative position between each pixel and the rendering camera.

[0129] P = P1 + P2 Formula (3)

[0130] In formula (3), P1 represents the camera facing degree of each pixel, P2 represents the back camera degree of each pixel, and P represents the relative position between each pixel and the rendering camera.

[0131] In steps C1-C3, on the one hand, the dot product of the normal of each pixel and the camera direction vector (dot(Normal, CameraVector)) reflects the degree to which each pixel faces the rendering camera; the dot product of the normal of each pixel and the camera direction vector is multiplied by a facing coefficient K1, and by adjusting the size of the facing coefficient K1, the degree to which each pixel faces the rendering camera can be adjusted; thus, based on the degree to which each pixel faces the camera, the relative position between each pixel and the rendering camera is determined, which can improve the richness of the to-be-rendered wrinkled surface in the visual angle of the pixel facing the camera. On the other hand, (1-dot(Normal, CameraVector)) reflects the degree to which each pixel faces away from the rendering camera; (1-dot(Normal, CameraVector)) is multiplied by a facing-away coefficient K2, and by adjusting the size of the facing-away coefficient K2, the degree to which each pixel faces away from the rendering camera can be adjusted; thus, based on the degree to which each pixel faces away from the camera, the relative position between each pixel and the rendering camera is determined, which can improve the richness of the to-be-rendered wrinkled surface in the visual angle of the pixel facing away from the camera. Therefore, by determining the relative position between each pixel and the rendering camera according to the degree to which each pixel faces the camera and the degree to which each pixel faces away from the camera, the richness of the to-be-rendered wrinkled surface can be improved in the visual angles of the pixel facing and facing away from the camera, so that the to-be-rendered wrinkled surface is more richly represented.

[0132] 1032A, multiplying the relative position between each pixel and the rendering camera and the basic color of each pixel to obtain the final rendering color of each pixel.

[0133] According to different determination methods of the relative position between each pixel and the rendering camera, there are various methods for obtaining the final rendering color of each pixel in step 1032A, which exemplarily include:

[0134] 1) The degree to which each pixel faces the rendering camera (i.e., the degree to which each pixel faces the camera) is taken as the relative position between each pixel and the rendering camera. Exemplarily, as shown in the following formula (4), step 1032A can specifically include: multiplying the degree to which each pixel faces the camera and the basic color of each pixel to obtain the final rendering color of each pixel.

[0135] FinalColor = Color*P1 Formula (4)

[0136] In formula (4), FinalColor represents the final rendering color of each pixel, Color represents the basic color of each pixel, and P1 represents the degree to which each pixel faces the camera.

[0137] Since the degree of each pixel facing the camera can improve the richness of the creased surface to be rendered on the level of the visual angle of the pixel facing the camera, by taking the result of multiplying the degree of each pixel facing the camera and the basic color of each pixel as the final rendering color of each pixel, the visual angle of each pixel facing the camera can be effectively applied to the basic color of each pixel, thereby effectively improving the richness of the creased surface.

[0138] 2) Taking the degree of each pixel facing away from the rendering camera (i.e., the degree of each pixel facing away from the camera) as the relative position between each pixel and the rendering camera. Exemplarily, as shown in the following formula (5), step 1032A can specifically include taking the result of multiplying the degree of each pixel facing away from the camera and the basic color of each pixel as the final rendering color of each pixel.

[0139] FinalColor = Color * P2 Formula (5)

[0140] In formula (5), FinalColor represents the final rendering color of each pixel, Color represents the basic color of each pixel, and P2 represents the degree of each pixel facing away from the camera.

[0141] Since the degree of each pixel facing away from the camera can improve the richness of the creased surface to be rendered on the level of the visual angle of the pixel facing away from the camera, by taking the result of multiplying the degree of each pixel facing away from the camera and the basic color of each pixel as the final rendering color of each pixel, the visual angle of each pixel facing away from the camera can be effectively applied to the basic color of each pixel, thereby effectively improving the richness of the creased surface.

[0142] 3) Based on the degree of each pixel facing the rendering camera and the degree of each pixel facing away from the rendering camera, determining the relative position between each pixel and the rendering camera. Exemplarily, as shown in the following formula (6), step 1032A can specifically include taking the result of multiplying the result of adding the degree of each pixel facing the camera and the degree of each pixel facing away from the camera and the basic color of each pixel as the final rendering color of each pixel.

[0143] FinalColor = Color * (P1 + P2) Formula (6)

[0144] In formula (6), FinalColor represents the final rendering color of each pixel, Color represents the basic color of each pixel, P1 represents the degree of each pixel facing the camera, and P2 represents the degree of each pixel facing away from the camera.

[0145] On the one hand, the degree of each pixel facing the camera can improve the richness of the wrinkle surface to be rendered on the level of the visual angle of the pixel facing the camera; on the other hand, the degree of each pixel facing away from the camera can improve the richness of the wrinkle surface to be rendered on the level of the visual angle of the pixel facing away from the camera; therefore, the result obtained by adding the degree of each pixel facing the camera and the degree of each pixel facing away from the camera, and the result of multiplying the basic color of each pixel, as the final rendering color of each pixel, can effectively act the visual angle of each pixel facing the camera on the basic color of each pixel, and effectively act the visual angle of each pixel facing away from the camera on the basic color of each pixel, thereby more comprehensively and effectively improving the richness of the wrinkle surface.

[0146] (ii) substituting the basic color, the normal, and the camera direction vector of each pixel into a preset formula to directly calculate the final rendering color.

[0147] (iv) the preset formula is a formula in which the degree of each pixel facing the rendering camera and the degree of each pixel facing away from the rendering camera finally act on the basic color of each pixel. Illustratively, at this time, step 103 can specifically include the following step 1031B:

[0148] 1031B, according to the normal of each pixel, the camera direction vector, the basic color of each pixel, and the first preset formula, the final rendering color of each pixel is calculated.

[0149] wherein the first preset formula is shown in the following formula (7):

[0150] FinalColor = Color * (K1 * dot(Normal, CameraVector) + K2 * (1-dot(Normal, CameraVector))) formula (7)

[0151] wherein dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K1 is a facing coefficient, K2 is an away-from coefficient, K1 is used to adjust the degree of each pixel facing the camera, K2 is used to adjust the degree of each pixel facing away from the camera, Color represents the basic color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0152] Specifically, after the base color of each pixel of the creased surface to be rendered is obtained in step 101 and the normal of each pixel of the creased surface to be rendered is obtained in step 102, in step 1031B, the base color of each pixel of the creased surface to be rendered obtained in step 101, the normal of each pixel of the creased surface to be rendered obtained in step 102, and the camera direction vector of the rendering camera are substituted into the first preset formula, the calculation of the first preset formula is performed, and the calculation result of the first preset formula, i.e., the final rendering color of each pixel, is obtained.

[0153] In step 1031B, in the first aspect, since K1*dot(Normal,CameraVector) reflects the visual angle of each pixel toward the camera and K2*(1-dot(Normal,CameraVector)) reflects the visual angle of each pixel away from the camera, the visual angle of each pixel toward the camera and the visual angle of each pixel away from the camera can be effectively applied to the base color of each pixel through the first preset formula, thereby effectively improving the richness of the creased surface. In the second aspect, by substituting the base color of each pixel of the creased surface to be rendered, the normal of each pixel, and the camera direction vector of the rendering camera into the first preset formula for calculation, the final rendering color of each pixel is obtained. Since one formula calculation is performed, the final rendering color of each pixel can be quickly calculated, and the rendering speed of the creased surface to be rendered can be improved.

[0154] ⑤The preset formula is a formula for finally applying the degree of each pixel toward the rendering camera to the base color of each pixel. Illustratively, at this time, step 103 can specifically include the following step 1031C:

[0155] 1031C, according to the normal of each pixel, the camera direction vector, the base color of each pixel, and the second preset formula, the final rendering color of each pixel is calculated.

[0156] The second preset formula is shown in the following formula (8):

[0157] FinalColor = Color*(K1*dot(Normal,CameraVector)) formula (8)

[0158] Wherein, dot(Normal,CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K1 is the orientation coefficient, K1 is used to adjust the degree of each pixel toward the camera, Color represents the base color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0159] Specifically, after the base color of each pixel of the creased surface to be rendered is obtained in step 101 and the normal of each pixel of the creased surface to be rendered is obtained in step 102, in step 1031C, the base color of each pixel of the creased surface to be rendered obtained in step 101, the normal of each pixel of the creased surface to be rendered obtained in step 102, and the camera direction vector of the rendering camera are substituted into the second preset formula, the calculation of the second preset formula is performed, and the calculation result of the second preset formula, i.e., the final rendering color of each pixel, is obtained.

[0160] In step 1031C, first, since K1*dot(Normal,CameraVector) reflects the visual angle of each pixel toward the camera, the visual angle of each pixel toward the camera can be effectively applied to the base color of each pixel by the second preset formula, thereby effectively improving the richness of the creased surface. Second, by substituting the base color of each pixel of the creased surface to be rendered, the normal of each pixel, and the camera direction vector of the rendering camera into the second preset formula for calculation, the final rendering color of each pixel is obtained. Since one formula calculation is performed, the final rendering color of each pixel can be quickly calculated, and the rendering speed of the creased surface to be rendered can be improved.

[0161] ⑥The preset formula is a formula for finally applying the degree of each pixel facing away from the rendering camera to the base color of each pixel. Exemplarily, at this time, step 103 can specifically include the following step 1031D:

[0162] 1031D, according to the normal of each pixel, the camera direction vector, the base color of each pixel, and the third preset formula, the final rendering color of each pixel is calculated.

[0163] The third preset formula is shown in the following formula (9):

[0164] FinalColor = Color * (K2 * (1-dot(Normal,CameraVector))) formula (9)

[0165] Wherein, dot(Normal,CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K2 is a back coefficient, K2 is used to adjust the degree of each pixel facing away from the camera, Color represents the base color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0166] Specifically, after the base color of each pixel of the to-be-rendered wrinkled surface is obtained in step 101 and the normal of each pixel of the to-be-rendered wrinkled surface is obtained in step 102, in step 1031B, the base color of each pixel of the to-be-rendered wrinkled surface obtained in step 101, the normal of each pixel of the to-be-rendered wrinkled surface obtained in step 102, and the camera direction vector of the rendering camera are substituted into a third preset formula, a calculation of the third preset formula is performed, and a result of the calculation of the third preset formula, that is, a final rendering color of each pixel, is obtained.

[0167] In step 1031B, first, since K2*(1-dot(Normal,CameraVector)) reflects the visual angle of each pixel facing away from the camera, the visual angle of each pixel facing away from the camera can be effectively reflected on the base color of each pixel by the third preset formula, so that the richness of the wrinkled surface is effectively improved. Second, by substituting the base color of each pixel of the to-be-rendered wrinkled surface, the normal of each pixel, and the camera direction vector of the rendering camera into the third preset formula for calculation, the final rendering color of each pixel is obtained. Since only one formula calculation is performed, the final rendering color of each pixel can be quickly calculated, and the rendering speed of the to-be-rendered wrinkled surface can be improved.

[0168] 104. rendering the to-be-rendered wrinkled surface according to the final rendering color of each pixel to obtain a final rendering effect of the to-be-rendered wrinkled surface.

[0169] The final rendering color of each pixel is used to improve the display effect of the to-be-rendered wrinkled surface.

[0170] For example, in step 104, during rendering, the final rendering color of each pixel is rendered to the corresponding position of the to-be-rendered wrinkled surface. When the final rendering color of each pixel of the to-be-rendered wrinkled surface is rendered to the corresponding position of the to-be-rendered wrinkled surface, the final rendering effect of the to-be-rendered wrinkled surface is obtained, and is sent to the screen for display. At this time, the final rendering effect of the to-be-rendered wrinkled surface will be enhanced or weakened in the visual angle of each pixel facing toward or away from the camera, so as to improve the richness of the wrinkled surface.

[0171] In order to better understand the graphic rendering method of the embodiment of the present application, the graphic rendering process is described below by taking the to-be-rendered wrinkled surface as a moss surface in a game scene and the rendering camera as a game main camera of the game scene as examples. Please refer to Figure 4 , Figure 4 is an embodiment of the graphic rendering process provided in the embodiment of the present application, and the graphic rendering process can specifically include the following steps 401-405.

[0172] 401. provide a moss surface with a color map, and extract a base color (denoted as Color) of each pixel of the moss surface from the color map of the moss surface.

[0173] wherein the color map of the moss surface is the base color of the moss surface.

[0174] 402. provide a moss surface with a normal map, and extract a normal (denoted as Normal) of each pixel of the moss surface from the normal map of the moss surface.

[0175] 403. obtain a camera direction vector of a game main camera of a game scene.

[0176] 404. substitute the base color of each pixel of the moss surface, the normal of each pixel of the moss surface, and the camera direction vector of the game main camera into a first preset formula, and calculate to obtain a final rendering color of each pixel of the moss surface.

[0177] The implementation of step 404 is similar to the implementation of step 1031B described above, and specific reference can be made to the related description of step 1031B described above. For the sake of simplifying the description, no further description is given here.

[0178] 405. render the moss surface according to the final rendering color of each pixel of the moss surface, and obtain a final rendering effect of the moss surface.

[0179] The implementation of step 405 is similar to the implementation of step 104 described above, and specific reference can be made to the related description of step 104 described above. For the sake of simplifying the description, no further description is given here.

[0180] As can be seen from the above, by obtaining a final rendering color of each pixel of the to-be-rendered wrinkled surface according to a normal of each pixel of the to-be-rendered wrinkled surface, a camera direction vector of a rendering camera of the to-be-rendered wrinkled surface, and a base color of each pixel of the to-be-rendered wrinkled surface, rendering the to-be-rendered wrinkled surface to obtain a final rendering effect of the to-be-rendered wrinkled surface; in the first aspect, since the visual angle between each pixel and the rendering camera can be applied to the base color of each pixel, the visual angle between each pixel and the rendering camera on the to-be-rendered wrinkled surface can be enhanced or weakened by artificially adjusting the visual angle between each pixel and the rendering camera, thereby improving the richness of the wrinkled surface; in the second aspect, since the final rendering effect of the to-be-rendered wrinkled surface is only related to the normal of each pixel and the camera direction vector, and is not related to the light, the inevitable association between the wrinkled effect and the light can be avoided, thereby effectively improving the wrinkled feeling of the wrinkled surface in the absence of light; in the third aspect, since the number of faces of the model does not need to be increased to improve the display effect of the wrinkled surface, the display effect of the wrinkled surface is effectively improved under the condition of reducing the pressure of graphic rendering.

[0181] To better implement the above method, an embodiment of the present application further provides a graphics rendering device, which can be specifically integrated in an electronic device, such as a computer device, which can be a terminal, a server or the like.

[0182] The terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, a personal computer or the like, and the server can be a single server or a server cluster composed of multiple servers.

[0183] For example, in the present embodiment, the method of the present application is described in detail by taking the graphics rendering device as an example which is specifically integrated in a smart phone.

[0184] For example, as shown in Figure 5 The graphics rendering device can include:

[0185] The first obtaining unit 501 is configured to obtain a basic color of each pixel of the to-be-rendered wrinkled surface based on a color map of the to-be-rendered wrinkled surface.

[0186] The first obtaining unit 501 is further configured to obtain a normal of each pixel of the to-be-rendered wrinkled surface based on a normal map of the to-be-rendered wrinkled surface.

[0187] The second obtaining unit 502 is configured to obtain a final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel, a camera direction vector of a rendering camera of the to-be-rendered wrinkled surface and the basic color of each pixel, wherein the final rendering color of each pixel is used to reflect a visual included angle formed between the normal of each pixel and the camera direction vector.

[0188] The rendering unit 503 is configured to render the to-be-rendered wrinkled surface according to the final rendering color of each pixel to obtain a final rendering effect of the to-be-rendered wrinkled surface, and the final rendering color of each pixel is used to improve the display effect of the to-be-rendered wrinkled surface.

[0189] In some embodiments, the second obtaining unit 502 is specifically configured to:

[0190] obtain a relative position between each pixel and the rendering camera according to the normal of each pixel and the camera direction vector;

[0191] multiply the relative position between each pixel and the rendering camera and the basic color of each pixel to obtain the final rendering color of each pixel.

[0192] In some embodiments, the second obtaining unit 502 is specifically configured to:

[0193] dot product of the normal of each pixel and the camera direction vector, to obtain a camera-facing degree of each pixel;

[0194] dot product of the normal of each pixel and the camera direction vector, to obtain a camera-facing degree of each pixel;

[0195] determine the relative position between each pixel and the rendering camera according to the camera-facing degree of each pixel and the camera-facing degree of each pixel.

[0196] In some embodiments, the second obtaining unit 502 is specifically configured to:

[0197] dot product of the normal of each pixel and the camera direction vector, to obtain a camera-facing degree of each pixel;

[0198] take the camera-facing degree of each pixel as the relative position between each pixel and the rendering camera.

[0199] In some embodiments, the second obtaining unit 502 is specifically configured to:

[0200] dot product of the normal of each pixel and the camera direction vector, to obtain a camera-facing degree of each pixel;

[0201] take the camera-facing degree of each pixel as the relative position between each pixel and the rendering camera.

[0202] In some embodiments, the second obtaining unit 502 is specifically configured to:

[0203] calculate the final rendering color of each pixel according to the normal of each pixel, the camera direction vector, the basic color of each pixel and a first preset formula, the first preset formula being:

[0204] FinalColor = Color * (K1 * dot(Normal, CameraVector) + K2 * (1-dot(Normal, CameraVector)));

[0205] dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K1 is a facing coefficient, K2 is a back-facing coefficient, K1 is used to adjust the camera-facing degree of each pixel, K2 is used to adjust the back-facing degree of each pixel, Color represents the basic color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0206] In some embodiments, the second obtaining unit 502 is specifically configured to:

[0207] According to the normal of each pixel, the camera direction vector, the basic color of each pixel, and a second preset formula, a final rendering color of each pixel is calculated, and the second preset formula is FinalColor = Color * (K1 * dot(Normal, CameraVector));

[0208] dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K1 is a toward coefficient, K1 is used to adjust the degree of each pixel toward the camera, Color represents the basic color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0209] In some embodiments, the second obtaining unit 502 is specifically configured to:

[0210] According to the normal of each pixel, the camera direction vector, the basic color of each pixel, and a third preset formula, a final rendering color of each pixel is calculated, and the third preset formula is FinalColor = Color * (K2 * (1-dot(Normal, CameraVector)));

[0211] dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K2 is a back coefficient, K2 is used to adjust the degree of each pixel away from the camera, Color represents the basic color of each pixel, and FinalColor represents the final rendering color of each pixel.

[0212] As can be seen, the graphic rendering device in the embodiment can acquire the basic color of each pixel of the to-be-rendered wrinkled surface based on the color map of the to-be-rendered wrinkled surface by the first acquisition unit 501; acquire the normal of each pixel of the to-be-rendered wrinkled surface based on the normal map of the to-be-rendered wrinkled surface by the first acquisition unit 501; acquire the final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel, the camera direction vector of the rendering camera of the to-be-rendered wrinkled surface and the basic color of each pixel by the second acquisition unit 502, wherein the final rendering color of each pixel is used to reflect the visual included angle formed between the normal of each pixel and the camera direction vector; and render the to-be-rendered wrinkled surface according to the final rendering color of each pixel by the rendering unit 503 to obtain the final rendering effect of the to-be-rendered wrinkled surface, and the final rendering color of each pixel is used to improve the display effect of the to-be-rendered wrinkled surface. Thus, in the first aspect of the embodiment, the visual included angle between each pixel and the rendering camera can be applied to the basic color of each pixel, so that the visual included angle between each pixel on the to-be-rendered wrinkled surface and the rendering camera can be enhanced or weakened by artificially adjusting the visual included angle between each pixel and the rendering camera, thereby improving the richness of the wrinkled surface. In the second aspect, the final rendering effect of the to-be-rendered wrinkled surface is only related to the normal of each pixel and the camera direction vector, and is not related to the light, so that the inevitable association between the wrinkled effect and the light can be avoided, thereby effectively improving the wrinkled feeling of the wrinkled surface in the case of no light. In the third aspect, the display effect of the wrinkled surface can be effectively improved without increasing the number of models, thereby effectively improving the display effect of the wrinkled surface under the condition of reducing the graphic rendering pressure.

[0213] Correspondingly, the embodiment of the present application further provides an electronic device. The electronic device can be a terminal, which can be a smart phone, a tablet computer, a notebook computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (PDA, Personal Digital Assistant) and the like. As shown in Figure 6 Figure 6 The electronic device provided by the embodiment of the present application is shown in the structural schematic diagram. The electronic device 600 includes a processor 601 having one or more processing cores, a memory 602 having one or more computer readable storage media, and a computer program stored on the memory 602 and executable on the processor. The processor 601 is electrically connected to the memory 602. Those skilled in the art can understand that the structure of the electronic device shown in the figure does not constitute a limitation on the electronic device, and can include more or fewer components than shown, or combine certain components, or different component arrangements.

[0214] ​The processor 601 is the control center of the electronic device 600, connects all parts of the electronic device 600 through various interfaces and lines, executes various functions of the electronic device 600 and processes data by running or loading software programs and / or modules stored in the memory 602 and calling data stored in the memory 602, thereby overall monitoring the electronic device 600.

[0215] In the embodiment of the present application, the processor 601 in the electronic device 600 loads the instructions corresponding to the processes of one or more application programs into the memory 602, and runs the application programs stored in the memory 602 by the processor 601, thereby realizing various functions according to the following steps:

[0216] Based on the color map of the to-be-rendered wrinkled surface, the basic color of each pixel of the to-be-rendered wrinkled surface is obtained;

[0217] Based on the normal map of the to-be-rendered wrinkled surface, the normal of each pixel of the to-be-rendered wrinkled surface is obtained;

[0218] According to the normal of each pixel, the camera direction vector of the rendering camera of the to-be-rendered wrinkled surface, and the basic color of each pixel, the final rendering color of each pixel of the to-be-rendered wrinkled surface is obtained, wherein the final rendering color of each pixel is used to reflect the visual included angle formed between the normal of each pixel and the camera direction vector;

[0219] According to the final rendering color of each pixel, the to-be-rendered wrinkled surface is rendered to obtain the final rendering effect of the to-be-rendered wrinkled surface.

[0220] The specific implementation of each operation can refer to the previous embodiments, which will not be repeated here.

[0221] Optionally, as shown in Figure 6 The electronic device 600 further includes a touch display screen 603, a radio frequency circuit 604, an audio circuit 605, an input unit 606, and a power supply 607. The processor 601 is electrically connected with the touch display screen 603, the radio frequency circuit 604, the audio circuit 605, the input unit 606, and the power supply 607, respectively. Those skilled in the art can understand that the electronic device structure shown in Figure 6 The electronic device structure shown in the embodiment of the present application does not constitute a limitation on the electronic device, and can include more or fewer components than shown, or combine certain components, or different component arrangements.

[0222] The touch display screen 603 can be used to display a graphical user interface and receive operation instructions generated by user acting on the graphical user interface. The touch display screen 603 can include a display panel and a touch panel. The display panel can be used to display information input by the user or provided to the user and various graphical user interfaces of the electronic device, which can be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect touch operations (such as operations of the user using a finger, a stylus or any suitable object or accessory on or near the touch panel) of the user thereon or therearound, and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel can include two parts of a touch detection device and a touch controller. The touch detection device detects the touch position of the user and detects signals generated by the touch operation, and transmits the signals to the touch controller; the touch controller receives the touch information from the touch detection device, and converts it into touch coordinates, and then sends it to the processor 601, and can also receive commands from the processor 601 and execute them. The touch panel can cover the display panel, and when the touch panel detects a touch operation thereon or therearound, it transmits to the processor 601 to determine the type of the touch event, and then the processor 601 provides corresponding visual output on the display panel according to the type of the touch event. In the embodiments of the present application, the touch panel and the display panel can be integrated into the touch display screen 603 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can realize the input and output functions as two independent components. That is, the touch display screen 603 can also realize the input function as part of the input unit 606.

[0223] The radio frequency circuit 604 can be used to transceive radio frequency signals to establish wireless communication with network devices or other electronic devices.

[0224] The audio circuit 605 can be used to provide an audio interface between the user and the electronic device through the speaker and the microphone. The audio circuit 605 can convert the received audio data into an electrical signal and transmit it to the speaker, which converts it into a sound signal output. On the other hand, the microphone collects sound signals and converts them into electrical signals, which are received by the audio circuit 605 and converted into audio data. After being processed by the processor 601, the audio data is transmitted to another electronic device through the radio frequency circuit 604, or output to the memory 602 for further processing. The audio circuit 605 can also include an earphone jack to provide communication between the external earphone and the electronic device.

[0225] The input unit 606 can be configured to receive inputted digital, character information or user feature information (e.g. fingerprint, iris, face information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0226] The power supply 607 is configured to supply power to various components of the electronic device 600. Optionally, the power supply 607 can be logically connected to the processor 601 through a power management system, so as to realize functions such as management of charging, discharging and power consumption management through the power management system. The power supply 607 can also include one or more direct current or alternating current power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, etc.

[0227] Although Figure 6 The electronic device 600 can also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc. which are not shown in the embodiments and will not be described herein.

[0228] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0229] As can be seen from the above, the electronic device provided in the embodiments can obtain the final rendering color of each pixel of the to-be-rendered wrinkled surface according to the normal of each pixel of the to-be-rendered wrinkled surface, the camera direction vector of the rendering camera of the to-be-rendered wrinkled surface, and the basic color of each pixel of the to-be-rendered wrinkled surface, render the to-be-rendered wrinkled surface, and obtain the final rendering effect of the to-be-rendered wrinkled surface; in the first aspect, since the visual angle between each pixel and the rendering camera can be applied to the basic color of each pixel, the visual angle between each pixel and the rendering camera can be enhanced or weakened by artificially adjusting the visual angle between each pixel and the rendering camera, so as to improve the richness of the wrinkled surface; in the second aspect, since the final rendering effect of the to-be-rendered wrinkled surface is only related to the normal of each pixel and the camera direction vector, and is not related to the light, the inevitable association between the wrinkled effect and the light can be avoided, so as to effectively improve the wrinkled feeling of the wrinkled surface in the case of no light; in the third aspect, since the number of surfaces of the model does not need to be increased to improve the display effect of the wrinkled surface, the display effect of the wrinkled surface can be effectively improved in the case of reducing the pressure of graphic rendering.

[0230] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by instructions controlling related hardware, which can be stored in a computer readable storage medium and loaded and executed by a processor.

[0231] To this end, the embodiment of the present application provides a computer readable storage medium, wherein a plurality of computer programs are stored, the computer programs can be loaded by a processor to execute steps in any of the graphic rendering methods provided by the embodiment of the present application. For example, the computer programs can execute the following steps:

[0232] Based on the color map of the to-be-rendered wrinkled surface, a basic color of each pixel of the to-be-rendered wrinkled surface is obtained;

[0233] Based on the normal map of the to-be-rendered wrinkled surface, a normal of each pixel of the to-be-rendered wrinkled surface is obtained;

[0234] According to the normal of each pixel, a camera direction vector of a rendering camera of the to-be-rendered wrinkled surface, and the basic color of each pixel, a final rendering color of each pixel of the to-be-rendered wrinkled surface is obtained, wherein the final rendering color of each pixel is used to reflect a visual included angle formed between the normal of each pixel and the camera direction vector;

[0235] According to the final rendering color of each pixel, the to-be-rendered wrinkled surface is rendered to obtain a final rendering effect of the to-be-rendered wrinkled surface.

[0236] The specific implementation of each operation can refer to the foregoing embodiments, which will not be described here.

[0237] The computer readable storage medium can include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0238] Since the computer programs stored in the computer readable storage medium can execute the steps in any of the graphic rendering methods provided by the embodiment of the present application, the beneficial effects of any of the graphic rendering methods provided by the embodiment of the present application can be achieved, which will be described in detail in the foregoing embodiments, and will not be described here.

[0239] The graphic rendering method, device, electronic equipment and computer readable storage medium provided by the embodiment of the present application are described in detail above, and the specific examples are applied to describe the principles and implementation manners of the present application, and the above embodiment is only used to help understand the method and its core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range can be changed, and the above description should not be understood as the limitation of the present application.

Claims

1. A graphics rendering method, characterized in that, include: Based on the color map of the wrinkled surface to be rendered, obtain the basic color of each pixel of the wrinkled surface to be rendered; Based on the normal map of the wrinkled surface to be rendered, obtain the normal of each pixel of the wrinkled surface to be rendered; Based on the normal of each pixel, the camera orientation vector of the rendering camera of the wrinkled surface to be rendered, and the basic color of each pixel, the final rendering color of each pixel of the wrinkled surface to be rendered is obtained, wherein the final rendering color of each pixel is used to reflect the visual angle constructed between the normal of each pixel and the camera orientation vector. The wrinkled surface to be rendered is rendered according to the final rendering color of each pixel to obtain the final rendering effect of the wrinkled surface to be rendered. The final rendering color of each pixel is used to improve the display effect of the wrinkled surface to be rendered. The step of obtaining the final rendered color of each pixel of the wrinkled surface to be rendered based on the normal of each pixel, the camera orientation vector of the rendering camera of the wrinkled surface to be rendered, and the basic color of each pixel includes: The final rendered color of each pixel is calculated based on the normal of each pixel, the camera direction vector, the basic color of each pixel, and the second preset formula, where the second preset formula is: FinalColor=Color*(K1*dot(Normal,CameraVector)). Where dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera orientation vector, K1 is the orientation coefficient, K1 is used to adjust the degree of orientation of each pixel toward the camera, Color represents the basic color of each pixel, and FinalColor represents the final rendered color of each pixel.

2. The graphics rendering method as described in claim 1, characterized in that, The step of obtaining the final rendered color of each pixel of the wrinkled surface to be rendered based on the normal of each pixel, the camera orientation vector of the rendering camera of the wrinkled surface to be rendered, and the basic color of each pixel includes: The relative position between each pixel and the rendering camera is obtained based on the normal of each pixel and the camera orientation vector; The final rendered color of each pixel is obtained by multiplying the relative position of each pixel with the rendering camera and the basic color of each pixel.

3. The graphics rendering method as described in claim 2, characterized in that, The step of obtaining the relative position between each pixel and the rendering camera based on the normal of each pixel and the camera orientation vector includes: The degree of orientation of each pixel toward the camera is obtained by performing a dot product between the normal of each pixel and the camera orientation vector. The degree to which each pixel is away from the camera is obtained by performing a dot product between the normal of each pixel and the camera orientation vector. The relative position of each pixel to the rendering camera is determined based on the degree to which each pixel faces the camera and the degree to which each pixel faces away from the camera.

4. The graphics rendering method as described in claim 2, characterized in that, The step of obtaining the relative position between each pixel and the rendering camera based on the normal of each pixel and the camera orientation vector includes: The degree of orientation of each pixel toward the camera is obtained by performing a dot product between the normal of each pixel and the camera orientation vector. The degree to which each pixel faces the camera is used as the relative position between each pixel and the rendering camera.

5. The graphics rendering method as described in claim 2, characterized in that, The step of obtaining the relative position between each pixel and the rendering camera based on the normal of each pixel and the camera orientation vector includes: The degree to which each pixel is away from the camera is obtained by performing a dot product between the normal of each pixel and the camera orientation vector. The degree to which each pixel is facing away from the camera is used as the relative position between each pixel and the rendering camera.

6. The graphics rendering method as described in claim 1, characterized in that, The step of obtaining the final rendered color of each pixel of the wrinkled surface to be rendered based on the normal of each pixel, the camera orientation vector of the rendering camera of the wrinkled surface to be rendered, and the basic color of each pixel includes: The final rendered color of each pixel is calculated based on the normal of each pixel, the camera direction vector, the basic color of each pixel, and a first preset formula, wherein the first preset formula is: FinalColor=Color*(K1*dot(Normal,CameraVector)+K2*(1-dot(Normal,CameraVector))); Where dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K1 is the orientation coefficient and K2 is the back orientation coefficient. K1 is used to adjust the degree of orientation of each pixel toward the camera and K2 is used to adjust the degree of back orientation of each pixel toward the camera. Color represents the basic color of each pixel and FinalColor represents the final rendered color of each pixel.

7. The graphics rendering method as described in claim 1, characterized in that, The step of obtaining the final rendered color of each pixel of the wrinkled surface to be rendered based on the normal of each pixel, the camera orientation vector of the rendering camera of the wrinkled surface to be rendered, and the basic color of each pixel includes: The final rendered color of each pixel is calculated based on the normal of each pixel, the camera direction vector, the basic color of each pixel, and the third preset formula. The third preset formula is: FinalColor=Color*(K2*(1-dot(Normal,CameraVector))). Where dot(Normal, CameraVector) represents the dot product of the normal of each pixel and the camera direction vector, K2 is the backsight coefficient, K2 is used to adjust the degree of backsight of each pixel to the camera, Color represents the basic color of each pixel, and FinalColor represents the final rendered color of each pixel.

8. A graphics rendering apparatus, characterized in that, include: The first acquisition unit is used to acquire the basic color of each pixel of the wrinkled surface to be rendered based on the color map of the wrinkled surface to be rendered. The first acquisition unit is further configured to acquire the normal of each pixel of the wrinkled surface to be rendered based on the normal map of the wrinkled surface to be rendered; The second acquisition unit is used to acquire the final rendering color of each pixel of the wrinkled surface to be rendered based on the normal of each pixel, the camera direction vector of the rendering camera of the wrinkled surface to be rendered, and the basic color of each pixel, wherein the final rendering color of each pixel is used to reflect the visual angle constructed between the normal of each pixel and the camera direction vector. The rendering unit is used to render the wrinkled surface to be rendered according to the final rendering color of each pixel to obtain the final rendering effect of the wrinkled surface to be rendered. The final rendering color of each pixel is used to improve the display effect of the wrinkled surface to be rendered. The second acquisition unit is used to calculate the final rendered color of each pixel based on the normal of each pixel, the camera orientation vector, the basic color of each pixel, and a second preset formula. The second preset formula is: FinalColor=Color*(K1*dot(Normal,CameraVector)); where dot(Normal,CameraVector) represents the dot product of the normal of each pixel and the camera orientation vector, K1 is the orientation coefficient, which is used to adjust the orientation of each pixel towards the camera, Color represents the basic color of each pixel, and FinalColor represents the final rendered color of each pixel.

9. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to perform the steps of the graphics rendering method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the graphics rendering method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image generation system, program and information storage medium

    JP2010033288A