Skin rendering method and device, computer equipment and storage medium
By using light information to determine the diffuse and specular light information of the skin in a virtual scene, and recording these information with two color maps, the problems of memory overhead and low rendering efficiency caused by large data volume in the prior art are solved, and the problem of low data efficiency is achieved. Efficient rendering on mobile devices.
Patent Information
- Application Number
- CN202310708949.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-14
- Publication Date
- 2024-12-17
AI Technical Summary
In the prior art, when rendering virtual character skins, the large amount of data leads to an increase in memory overhead, affecting rendering efficiency.
The diffuse and specular light information of the initial skin are determined through the lighting information in the virtual scene, and the two color maps are used to record this information, reducing the amount of data and improving rendering efficiency.
It reduces the memory overhead of the rendering process, improves the rendering efficiency of the skin, is suitable for mobile devices, and does not need to simulate the subsurface scattering effect from the perspective of resource design.
Smart Images

Figure CN119152105A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a skin rendering method, apparatus, computer equipment and storage medium. Background Art
[0002] With the development of computer technology, virtual characters have also emerged. Virtual characters usually have skin. As a material with complex properties, the physical structure of skin is composed of multiple layers, and the effect formed under lighting conditions is also relatively complex. How to render realistic skin is the focus of research in this field.
[0003] At present, the commonly used method is to render the skin of virtual characters by using texture space diffusion. That is, the diffuse light information of the skin is stored in the texture map, and then different Gaussian blur functions are used multiple times to generate multiple blurred texture maps, and finally the final diffuse light effect of the skin is rendered based on these texture maps.
[0004] However, in the above technical solution, the skin of each virtual character needs to first calculate multiple texture maps that record diffuse light, which has a large amount of data and increases memory overhead; then when calculating the final rendering effect, the large amount of data to be processed affects the rendering efficiency of the skin. Summary of the invention
[0005] The embodiments of the present application provide a skin rendering method, apparatus, computer equipment and storage medium, which can reduce the amount of texture data in the rendering process, thereby reducing the memory overhead of the rendering process, and can also improve the skin rendering efficiency. The technical solution is as follows:
[0006] In one aspect, a skin rendering method is provided, the method comprising:
[0007] Rendering is performed based on the rendering data of the skin in the virtual scene to obtain an initial skin, wherein the initial skin is an opaque skin;
[0008] Determining diffuse reflection light information and specular reflection light information of the initial skin based on lighting information in the virtual scene and the initial skin;
[0009] Generate a first map based on the diffuse reflection light information and the color map, wherein the color map is used to represent the color of the initial skin, and the first map is used to reflect the effect of the diffuse reflection light on the initial skin;
[0010] generating a second map based on the specular reflection light information and the color map, wherein the second map is used to reflect the effect of the initial skin being subjected to the specular reflection light;
[0011] The initial skin is updated based on the first map and the second map.
[0012] In another aspect, a skin rendering device is provided, the device comprising:
[0013] A rendering module, used for rendering based on the rendering data of the skin in the virtual scene to obtain an initial skin, wherein the initial skin is an opaque skin;
[0014] A first determination module, configured to determine diffuse reflection light information and specular reflection light information of the initial skin based on lighting information in the virtual scene and the initial skin;
[0015] A first generating module, configured to generate a first map based on the diffuse reflection light information and the color map, wherein the color map is used to represent the color of the initial skin, and the first map is used to reflect the effect of the diffuse reflection light on the initial skin;
[0016] A second generating module, used to generate a second map based on the specular reflection light information and the color map, wherein the second map is used to reflect the effect of the initial skin being subjected to the specular reflection light;
[0017] An updating module is used to update the initial skin based on the first map and the second map.
[0018] In some embodiments, the first generation module is used to update the pixel value of any pixel in the initial skin based on the diffuse reflection light information of the pixel in the color map to obtain the first map.
[0019] In some embodiments, the second generation module is used to update the pixel value of any pixel in the initial skin based on the specular reflection light information of the pixel in the color map to obtain the second map.
[0020] In some embodiments, the apparatus further comprises:
[0021] A second determination module, configured to determine a scattering intensity of the initial skin based on light information in the virtual scene and the initial skin, wherein the scattering intensity is used to reflect a subsurface scattering phenomenon of the initial skin;
[0022] The second generating module is further used to store the scattering intensity in the second map.
[0023] In some embodiments, the update module includes:
[0024] a processing unit, configured to convolve pixel values of pixel points in the initial skin in the first map based on scattering intensities in the second map to obtain a third map, wherein the scattering intensities are used to reflect a subsurface scattering phenomenon of the initial skin;
[0025] An updating unit is used to update the initial skin based on the second map and the third map.
[0026] In some embodiments, the processing unit comprises:
[0027] a determination subunit, configured to determine, for any pixel of the initial skin in the first map, a sampling step size based on a scattering intensity corresponding to the pixel in the second map, a scene camera parameter, and a first convolution direction, wherein the scene camera parameter is used to represent information of a virtual camera in the virtual scene, the virtual camera is used to represent an observer for the pixel, and the sampling step size is used to represent the number of pixel values used in the convolution process;
[0028] A first processing subunit, configured to perform convolution on the pixel value of the pixel point based on the sampling step along the first convolution direction;
[0029] The second processing subunit is used to obtain the third map based on the pixel values after convolution of multiple pixel points in the first map.
[0030] In some embodiments, the first processing subunit is used to determine a plurality of reference pixel points near the pixel point along the first convolution direction based on the sampling step; determine the weights of the plurality of reference pixel points and the weight of the pixel point based on a Gaussian distribution function; perform weighted summation of the pixel values of the plurality of reference pixel points and the pixel value of the pixel point based on the weights of the plurality of reference pixel points and the weight of the pixel point to obtain a new pixel value; and update the pixel value of the pixel point with the new pixel value.
[0031] In some embodiments, the second processing sub-unit is used to obtain a fourth map based on a plurality of pixel values in the first map convolved along the first convolution direction; and convolve a plurality of pixel values in the fourth map along the second convolution direction respectively to obtain the third map.
[0032] In some embodiments, the update unit is used to perform weighted summation of the pixel value of the pixel point in the second map and the pixel value of the pixel point in the third map for any pixel point in the initial skin to obtain the pixel value of the pixel point; and update the initial skin based on the pixel values of multiple pixels.
[0033] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory is used to store at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the skin rendering method in the embodiment of the present application.
[0034] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the skin rendering method in the embodiment of the present application.
[0035] On the other hand, a computer program product is provided, including a computer program, which is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the skin rendering method provided in the above-mentioned various aspects or various optional implementations of various aspects.
[0036] The embodiment of the present application provides a skin rendering method, which determines the diffuse reflection light information and specular reflection light information received by the initial skin of the preliminary rendering in the virtual scene through the lighting information in the virtual scene; then, a first map is generated through the diffuse reflection light information and the color map to achieve the purpose of recording the diffuse reflection light information in the color map, and similarly, the specular reflection light information is recorded in another color map; compared with the prior art of recording the diffuse reflection light information and the specular reflection light information in multiple texture maps, since the texture map generally stores a variety of texture information such as color and concave and convex conditions, and the data volume is larger than that of the color map, the present application ensures that the skin has obvious lighting that conforms to the actual physical properties of the skin. In the case of the effect, skin rendering can be achieved by using data of the size of two color maps, which reduces the amount of map data in the rendering process, thereby reducing the memory overhead of the rendering process, and can be suitable for rendering on mobile devices, ensuring the rendering performance of mobile devices. Compared with the rendering solution through a fixed terminal with larger running memory, the effect after rendering through a mobile device is better; and subsequently, the effect of the skin under light is rendered according to the two maps generated previously. Since the amount of data of the first map and the second map is small, the efficiency of data processing can be improved, thereby improving the rendering efficiency of the skin; and, the requirements for the production of art materials are low, and there is no need to simulate the subsurface scattering effect from the perspective of resource design. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0038] Figure 1 is a schematic diagram of an implementation environment of a skin rendering method provided according to an embodiment of the present application;
[0039] Figure 2 is a flowchart of a skin rendering method provided according to an embodiment of the present application;
[0040] Figure 3 is a flow chart of another skin rendering method provided according to an embodiment of the present application;
[0041] Figure 4 is a data storage distribution diagram of a first map provided according to an embodiment of the present application;
[0042] Figure 5 is a data storage distribution diagram of a second map provided according to an embodiment of the present application;
[0043] Figure 6 is a schematic diagram of generating a first map and a second map according to an embodiment of the present application;
[0044] Figure 7 is a schematic diagram of performing convolution on initial skin according to an embodiment of the present application;
[0045] Figure 8 is another schematic diagram of performing convolution on initial skin according to an embodiment of the present application;
[0046] Fig. 9 is a schematic diagram of combining diffuse reflection light and specular reflection light provided according to an embodiment of the present application;
[0047] Fig.10 This is a rendering of a combination of diffuse reflection light and specular reflection light provided according to an embodiment of the present application;
[0048] Fig.11 is a schematic diagram of a skin rendering method provided in an embodiment of the present application;
[0049] Fig.12 is a block diagram of a skin rendering device provided according to an embodiment of the present application;
[0050] Fig.13 is a block diagram of another skin rendering device provided according to an embodiment of the present application;
[0051] Fig.14 It is a structural block diagram of a terminal provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0053] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with basically the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on quantity and execution order.
[0054] In the present application, the term "at least one" means one or more, and the term "plurality" means two or more.
[0055] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions. For example, the rendering data and lighting information involved in this application are obtained with full authorization.
[0056] For ease of understanding, the terms involved in this application are explained below.
[0057] Bidirectional Reflectance Distribution Function (BRDF): refers to a function that defines the reflection of light on an opaque surface, the ratio of the radiance of the light in the outgoing direction to the irradiance of the light in the incident direction at the same point.
[0058] Bidirectional Subsurface Scattering Reflection Distribution Function (BSSRDF): It refers to the ratio function of the radiance of the outgoing direction and the radiant flux of the incident direction when the light undergoes subsurface scattering on a translucent surface (the outgoing light and the incident light may not be at the same point).
[0059] Diffuse Reflection: refers to the phenomenon that when a parallel incident light beam hits a rough surface, the rough surface will reflect the light in all directions. Although the incident rays are parallel to each other, the normal directions of each point on the rough surface are inconsistent, causing the reflected light to be reflected irregularly in different directions. This reflected light is called diffuse light.
[0060] Specular Reflection: If the reflective surface is relatively smooth, when parallel incident light hits this reflective surface, it will still be reflected in parallel in one direction. The light is reflected in a certain direction; the angle between the direction of the reflected light and the normal of the reflecting plane (reflection angle) is equal to the angle between the direction of the incident light and the normal of the reflecting plane (incident angle), and the incident light, reflected light and the plane normal are in the same plane. Specular reflection follows the law of reflection of light.
[0061] Radiant flux: refers to the measurement of the total power of all electromagnetic radiation (including infrared, ultraviolet and visible light) passing through a certain area per unit time. It can refer to the power of radiation emitted by a radiation source or the power of radiation energy reaching a specific surface.
[0062] Irradiance: In optics, it refers to the power per unit area when electromagnetic radiation is incident on a curved surface.
[0063] Radiance: refers to the physical quantity that describes the intensity of a light source per unit area when it is a non-point light source. It is defined as the radiation flux per unit solid angle in a specified direction and per unit area perpendicular to this direction.
[0064] The skin rendering method provided in the embodiment of the present application can be executed by a computer device. In some embodiments, the computer device is a terminal or a server. The following first takes the computer device as an example to introduce the implementation environment of the skin rendering method provided in the embodiment of the present application. Figure 1 Schematic diagram of an implementation environment of a skin rendering method provided according to an embodiment of the present application. Figure 1 The implementation environment includes a terminal 101 and a server 102. The terminal 101 and the server 102 can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0065] In some embodiments, the terminal 101 is a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, an intelligent voice interaction device, a smart home appliance, a vehicle-mounted terminal, etc., but is not limited thereto. The terminal 101 installs and runs an application that supports virtual scenes. The application can be any one of a first-person shooter game (First-Person Shooting game, FPS), a third-person shooter game, a multiplayer online tactical competitive game (Multiplayer Online Battle Arena games, MOBA), a virtual reality application, a video application, a three-dimensional map program, or a multiplayer gun battle survival game. Schematically, the terminal 101 is a terminal used by a user, and the user uses the terminal 101 to operate a virtual object located in a virtual scene to perform an activity, and the activity includes but is not limited to: adjusting body posture, crawling, walking, running, riding, jumping, driving, picking up, shooting, attacking, and throwing. Schematically, the virtual object is a virtual character, such as a simulated character or an anime character.
[0066] Those skilled in the art will appreciate that the number of the above terminals may be more or less. For example, the above terminal may be only one, or the above terminals may be dozens or hundreds, or more. The embodiment of the present application does not limit the number of terminals and device types.
[0067] In some embodiments, server 102 is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), big data and artificial intelligence platforms. Server 102 is used to provide background services for applications that support virtual scenes. In some embodiments, server 102 undertakes the main computing work and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work and terminal 101 undertakes the main computing work; or, server 102 and terminal 101 use a distributed computing architecture for collaborative computing.
[0068] Figure 2 is a flowchart of a skin rendering method provided according to an embodiment of the present application, see Figure 2 The method can be executed by a computer device. In the embodiment of the present application, the computer device is a terminal as an example. The method includes the following steps:
[0069] 201. The terminal performs rendering based on the rendering data of the skin in the virtual scene to obtain an initial skin, where the initial skin is an opaque skin.
[0070] In an embodiment of the present application, the virtual scene may be a three-dimensional virtual scene or a two-dimensional virtual scene, which is not limited in the embodiment of the present application. The virtual scene includes a virtual character. The virtual character includes skin. When rendering the virtual character in the virtual scene, the terminal renders the skin of the virtual character. Among them, the terminal renders the skin according to the rendering data of the virtual character's skin to obtain the initial skin. The rendering data can be used to indicate the skin color of the virtual character. The terminal can perform color mapping according to the skin color indicated by the rendering data to achieve the rendering of the initial skin. The rendered initial skin is opaque. The real skin has a translucent feature, and when exposed to light, it will show the features inside the surface of the skin. Accordingly, the terminal can process the initial skin through subsequent steps 202 to 205 to render the translucent features of the skin.
[0071] 202. The terminal determines diffuse reflection light information and specular reflection light information of the initial skin based on the lighting information in the virtual scene and the initial skin.
[0072] In an embodiment of the present application, lighting information refers to information such as the position and type of the light source in the virtual scene. The light source in the virtual environment may include point light sources and ambient light. Under normal circumstances, when the light emitted by the light source contacts the skin, about 94% of the light will directly enter the sub-surface layer of the skin and be scattered by the sub-surface layer of the skin, forming a diffuse reflection phenomenon; about 6% of the light will be reflected, forming a mirror reflection phenomenon. The diffuse reflection phenomenon and the mirror reflection phenomenon are superimposed to form the effect of the skin being irradiated by light. Accordingly, in order to render the effect of the initial skin under the lighting conditions of the virtual environment, the terminal can determine the diffuse reflection light information and the mirror reflection light information of the initial skin based on the lighting information and the initial skin in the virtual scene. Among them, the diffuse reflection light information of the initial skin is used to reflect the diffuse reflection phenomenon of the initial skin under the lighting conditions of the virtual environment. The mirror reflection light information of the initial skin is used to reflect the mirror reflection phenomenon of the initial skin under the lighting conditions of the virtual environment.
[0073] 203. The terminal generates a first map based on the diffuse reflection light information and the color map, where the color map is used to represent the color of the initial skin, and the first map is used to reflect the effect of the diffuse reflection light on the initial skin.
[0074] In an embodiment of the present application, the color map includes the pixel value of each pixel in the initial skin. For any pixel, the pixel value of the pixel is used to indicate the color at the corresponding position in the initial skin. The pixel value of the pixel can be composed of three color values of the RGB (Red Green Blue) channel, or it can be composed of the value of the YUV (a color space) channel, and the embodiment of the present application is not limited to this. The terminal generates a first map based on the diffuse reflection light information and the color map. The first map can indicate the diffuse reflection phenomenon of the initial skin under the lighting conditions of the virtual environment. It is equivalent to that the terminal records the diffuse reflection light information in the color map to obtain the first map.
[0075] 204. The terminal generates a second map based on the specular reflection light information and the color map, where the second map is used to reflect the effect of the specular reflection light on the initial skin.
[0076] In an embodiment of the present application, the terminal generates a second map based on the mirror reflection light information and the color map. The second map can indicate the mirror reflection phenomenon of the initial skin under the lighting conditions of the virtual environment. Equivalently, the terminal records the mirror reflection light information in the color map to obtain the second map. The embodiment of the present application does not limit the order of generating the first map and the second map, that is, the embodiment of the present application does not limit the execution order of step 203 and step 204. Optionally, the terminal may execute step 204 first, and then execute step 203; or execute step 203 and step 204 at the same time.
[0077] 205. The terminal updates the initial skin based on the first texture and the second texture.
[0078] In the embodiment of the present application, the terminal can determine the pixel value of each pixel in the initial skin under the light according to the first map and the second map. Then, the terminal updates the color of the initial skin according to the pixel value of each pixel under the light to obtain the effect of the skin under the light.
[0079] The embodiment of the present application provides a skin rendering method, which determines the diffuse reflection light information and mirror reflection light information received by the initial skin of the preliminary rendering in the virtual scene through the lighting information in the virtual scene; then, a first map is generated through the diffuse reflection light information and the color map to achieve the purpose of recording the diffuse reflection light information in the color map, and similarly, the mirror reflection light information is recorded in another color map; compared with the prior art of recording the diffuse reflection light information and the mirror reflection light information in multiple texture maps, since the texture map generally stores a variety of texture information such as color and concave and convex conditions, and the data volume is larger than that of the color map, the present application ensures that the skin has obvious lighting effects that conform to the actual physical properties of the skin. In this case, skin rendering can be achieved by using data of the size of two color maps, which reduces the amount of map data during the rendering process, thereby reducing the memory overhead of the rendering process. It can be applied to mobile devices for rendering, and the rendering performance of mobile devices is guaranteed. That is, compared with the rendering solution through a fixed terminal with larger running memory, the effect after rendering through a mobile device is better; and subsequently, the effect of the skin under light is rendered according to the two maps generated previously. Since the amount of data of the first map and the second map is small, the efficiency of data processing can be improved, thereby improving the rendering efficiency of the skin; and, the requirements for the production of art materials are low, and there is no need to simulate the subsurface scattering effect from the perspective of resource design.
[0080] Figure 3 is a flowchart of another skin rendering method provided in an embodiment of the present application, see Figure 3 The method can be executed by a computer device. In the embodiment of the present application, the computer device is a terminal as an example. The skin rendering method includes the following steps:
[0081] Step 301: The terminal performs rendering based on the rendering data of the skin in the virtual scene to obtain an initial skin, where the initial skin is an opaque skin.
[0082] In an embodiment of the present application, before displaying the virtual scene, the terminal traverses the virtual objects in the entire virtual scene. Then, the terminal obtains rendering data of each virtual object in the virtual scene. Virtual objects include opaque virtual objects and translucent virtual objects. Opaque virtual objects can be virtual stones, virtual tables, or virtual metals, etc.; translucent virtual objects can be the skin, glass, or water of a virtual character, which is not limited in the embodiment of the present application.
[0083] The terminal may first render an opaque virtual object, and then render a translucent virtual object. For any virtual object, the terminal renders the virtual object at the position of the virtual object in the virtual scene according to information such as the color, shape, and material of the virtual object in the rendering data of the virtual object. Since the skin includes a multi-layer structure, light can pass through the surface layer of the skin, but basically will not penetrate the entire skin; therefore, in the present application, the terminal may first render the opaque effect of the skin, and then process the opaque skin to achieve a translucent effect. Accordingly, the terminal executes step 301 to render an opaque initial skin. The initial skin reflects the essential color of the skin, similar to the effect of solid color filling. Then, the terminal executes steps 302 to 306 to render the translucent effect of the skin.
[0084] 302. The terminal determines diffuse reflection light information and specular reflection light information of the initial skin based on the lighting information in the virtual scene and the initial skin.
[0085] In an embodiment of the present application, for any pixel in the initial skin, the terminal determines the diffuse reflection light information and the mirror reflection light information of the pixel according to the position of the pixel and the lighting information in the virtual scene. Specifically, the terminal can determine the radiation flux of the pixel according to the position of the pixel and the lighting information in the virtual scene. Then, the terminal can calculate the irradiance and emissivity of the pixel according to the radiation flux of the pixel. Then, the terminal can determine the diffuse reflection light information and the mirror reflection light information of the pixel according to the irradiance and emissivity of the pixel. Among them, the terminal can use a bidirectional subsurface reflection distribution function to determine the diffuse reflection light information of the pixel; and use a bidirectional reflection distribution function to determine the mirror reflection light information of the pixel. The embodiment of the present application does not limit the method for determining the diffuse reflection light information and the mirror reflection light information.
[0086] 303. The terminal generates a first map based on the diffuse reflection light information and the color map, where the color map is used to represent the color of the initial skin, and the first map is used to reflect the effect of the diffuse reflection light on the initial skin.
[0087] In an embodiment of the present application, in addition to the color information of the initial skin, the color map also includes the color information of other opaque virtual objects. That is, the terminal obtains the above-mentioned color map based on the opaque virtual object rendered in step 301. In other words, the color map saves the result of rendering the opaque object. The format of the color map can be RGBA16, which is not limited by the embodiment of the present application. Among them, the pixel value of each pixel occupies 8 bytes, a total of 64 bits. The three channels of RGB record the color value, and the A channel records the depth value. The value recorded in each channel occupies 2 bytes. The terminal generates a first map based on the diffuse reflection light information and the color map. That is, for any pixel in the initial skin, the terminal updates the pixel value of the pixel in the color map based on the diffuse reflection light information of the pixel to obtain the first map. The pixel value in the first map is used to represent the color of the corresponding pixel under the irradiation of diffuse reflection light. The format of the first map is the same as that of the color map. The solution provided in the embodiment of the present application records the diffuse reflection light information in a color map. Compared with the prior art of recording the diffuse reflection light information in multiple texture maps, the present application reduces the amount of map data used in the rendering process, thereby reducing the memory overhead of the rendering process; and, in the subsequent rendering process, reduces the amount of data processed, thereby helping to improve the rendering efficiency of the skin.
[0088] In some embodiments, in addition to storing the diffuse reflection light information of the initial skin in the color map, the terminal can also store the illumination results of other areas except the initial skin in the color map. Other areas include other opaque virtual objects rendered in the virtual scene except the initial skin. The illumination results of other areas may refer to the diffuse reflection light information of other areas; or may be the final illumination results of other areas, including diffuse reflection light information and specular reflection light information, which is not limited in the embodiments of the present application.
[0089] For example, Figure 4 is a data storage distribution diagram of a first map provided according to an embodiment of the present application. Figure 4 , the terminal saves the diffuse reflection light information of the initial skin in the color map, and saves the final illumination results of other areas except the initial skin in the color map, thereby obtaining the first map. Specifically, the terminal updates the color value of the initial skin in the RGB channel of the color map according to the diffuse reflection light information of the initial skin; updates the color values of other areas in the RGB channel of the color map according to the final illumination results determined by the reflection light information of other areas and the specular reflection light information. The value of the A channel in the color map remains unchanged.
[0090] 304. The terminal generates a second map based on the specular reflection light information and the color map, where the second map is used to reflect the effect of the initial skin being subjected to the specular reflection light.
[0091] In an embodiment of the present application, for any pixel in the initial skin, the terminal updates the pixel value of the pixel in the color map based on the specular reflection light information of the pixel to obtain a second map. The pixel value in the second map is used to represent the color of the corresponding pixel under the irradiation of specular reflection light. The format of the second map is the same as the format of the color map. The solution provided in the embodiment of the present application records the specular reflection light information in the color map. Compared with the prior art of recording the specular reflection light information in multiple texture maps, the present application reduces the amount of map data used in the rendering process, thereby reducing the memory overhead of the rendering process; and, in the subsequent rendering process, reduces the amount of data processed, thereby helping to improve the rendering efficiency of the skin.
[0092] In some embodiments, after passing through the surface of a translucent object, the light interacts with the object and causes the light to be scattered, so the light will also pass through the object at other positions, forming a subsurface scattering phenomenon. This is also an important factor affecting the diffuse reflection phenomenon. The terminal can determine the subsurface scattering phenomenon of the initial skin based on the lighting information in the virtual scene. Accordingly, the terminal determines the scattering intensity of the initial skin based on the lighting information and the initial skin in the virtual scene. The scattering intensity is used to reflect the subsurface scattering phenomenon of the initial skin. Then, the terminal stores the scattering intensity in the second map. Specifically, for any pixel in the initial skin, the terminal calculates the scattering intensity of the pixel based on the position and lighting information of the pixel. The solution provided in the embodiment of the present application calculates the scattering intensity of each pixel in the initial skin through the lighting information and the initial skin in the virtual scene, so that the subsurface scattering phenomenon at each position of the initial skin can be determined, so that the skin can be rendered in the subsequent case of considering the subsurface scattering phenomenon, so that the rendered skin has an obvious lighting effect that conforms to the actual physical properties of the skin, which is more in line with the real situation.
[0093] In some embodiments, in order to process the initial skin more accurately later, the terminal can also mark the position of the initial skin in the virtual scene. Then, the terminal can store the marked position of the initial skin in the second map. This method can accurately determine the position of the initial skin later, so as to process the initial skin and ensure the accuracy of rendering. The position of the initial skin refers to the position of the initial skin in the screen space, that is, it can be used to indicate the position on the display screen.
[0094] For example, Figure 5 is a data storage distribution diagram of a second map provided according to an embodiment of the present application. Figure 5, the terminal saves the specular reflection light information of the initial skin in the color map; saves the scattering intensity of the initial skin in the first 8 bytes of channel A; saves the position of the marked initial skin in the last 8 bytes of channel A, thereby obtaining the second map. Specifically, for any pixel point, the terminal updates the color value of the initial skin in the RGB channel of the color map according to the specular reflection light information of the pixel point; updates the first 8 bytes of channel A according to the scattering intensity of the pixel point; and updates the last 8 bytes of channel A according to the marking of the pixel.
[0095] It should be noted that the embodiment of the present application does not limit the execution order of step 303 and step 304. Optionally, the terminal may execute step 304 first, and then execute step 303; or execute step 303 and step 304 simultaneously.
[0096] In order to more clearly describe the process of the terminal generating the first sticker and the second sticker, it is further described below with reference to the accompanying drawings. Figure 6 is a schematic diagram of generating a first map and a second map according to an embodiment of the present application. Figure 6 , the terminal traverses the virtual object list and the scene light list in the virtual scene. Then, the terminal obtains rendering data according to the virtual object list and renders an opaque virtual object. Then, for any virtual object, the terminal determines the diffuse reflection light information and the specular reflection light information on the surface of the virtual object according to the light information corresponding to the scene light list and the virtual object. Then, in the case where the virtual object is skin, the diffuse reflection light information of the virtual object is written into the color map to obtain a first map; the specular reflection light information, scattering intensity and skin mark of the virtual object are written into another map to obtain a second map. In the case where the virtual object is not skin, the final lighting result formed by the diffuse reflection light information and the specular reflection light information of the virtual object is written into the color map to obtain a first map.
[0097] 305. The terminal convolves the pixel values of the pixel points in the initial skin in the first map based on the scattering intensity in the second map to obtain a third map, where the scattering intensity is used to reflect the subsurface scattering phenomenon of the initial skin.
[0098] In some embodiments, for any pixel point in the initial skin in the first map, the terminal can perform convolution by sampling some pixel values around the pixel point in the horizontal or vertical direction based on the scattering intensity in the second map to obtain a third map. The third map can reflect the subsurface scattering phenomenon of the initial skin.
[0099] In some embodiments, when rendering the effect of the skin under illumination, in addition to paying attention to the illumination information received by the skin itself, the observer's angle needs to be considered. Because the light received at different positions is different, the observed skin effect is also different. Accordingly, the terminal convolves the pixel values of the pixels in the initial skin in the first map based on the scattering intensity in the second map, and the process of obtaining the third map includes: for any pixel of the initial skin in the first map, the terminal determines the sampling step length based on the scattering intensity corresponding to the pixel in the second map, the scene camera parameter, and the first convolution direction. Then, the terminal convolves the pixel value of the pixel along the first convolution direction based on the sampling step length. Then, the terminal obtains the third map based on the pixel value after convolution of multiple pixels in the first map. Among them, the scene camera parameter is used to represent the information of the virtual camera in the virtual scene. The virtual camera is used to represent the observer for the pixel. The sampling step length is used to represent the number of pixel values used in the convolution process. The first convolution direction can be a horizontal direction or a vertical direction, which is not limited in the embodiment of the present application. The method provided in the embodiment of the present application calculates the sampling step of the convolution through information such as scattering intensity, scene camera parameters and the first convolution direction. It not only takes into account the lighting conditions of the observed skin, but also takes into account the viewing angle of observing the skin. This makes the determined sampling step more accurate, and the skin after convolution with the sampling step is more realistic, thereby improving the performance of rendering the skin.
[0100] Among them, the process in which the terminal convolves the pixel value of the pixel point along the first convolution direction based on the sampling step includes: the terminal determines multiple reference pixel points near the pixel point along the first convolution direction based on the sampling step. Then, the terminal determines the weights of the multiple reference pixel points and the weights of the pixel points based on the Gaussian distribution function. Then, the terminal performs weighted summation of the pixel values of the multiple reference pixel points and the pixel values of the pixel points based on the weights of the multiple reference pixel points and the weights of the pixel points to obtain a new pixel value. Then, the terminal updates the pixel value of the pixel point with the new pixel value. The solution provided in the embodiment of the present application adopts a Gaussian distribution function to determine the weights of multiple reference pixel points and the weights of the pixel points, taking into account that the closer the distance between pixels, the greater the correlation and the closer the color, so that the determined sampling step is more accurate, the skin after the sampling step convolution is more realistic, and the performance of rendering the skin is improved.
[0101] For example, Figure 7 is a schematic diagram of performing convolution on the initial skin according to an embodiment of the present application. Figure 7, the terminal can read the scattering intensity and skin marks and other information from the second map. Then, the terminal determines the sampling step size according to the scattering intensity, scene camera parameters and convolution direction in the second map. Then, based on the sampling step size and Gaussian distribution function, the terminal performs horizontal or vertical convolution on the pixel values of the pixels in the first map. Then, the terminal writes the pixel values of the multiple pixels in the first map after convolution into the third map.
[0102] Among them, the process of the terminal obtaining the third map based on the pixel values after convolution of multiple pixel points in the first map includes: the terminal obtains the fourth map based on the multiple pixel values after convolution along the first convolution direction in the first map. Then, the terminal convolves the multiple pixel values in the fourth map along the second convolution direction respectively to obtain the third map. Among them, the first convolution direction is different from the second convolution direction. The solution provided in the embodiment of the present application first records the convolution result of the pixel values included in the initial skin along the first convolution direction in the fourth map, which ensures the accuracy of the convolution result along the first convolution direction and will not be affected by the second convolution direction; then, on the basis of the fourth map, the pixel values included in the initial skin are convolved along the second convolution direction, so as to obtain the final third map, thereby improving the accuracy of the third map.
[0103] For example, Figure 8 FIG. 1 is another schematic diagram of performing convolution on the initial skin according to an embodiment of the present application. Figure 8 , the terminal performs horizontal convolution on the pixel values of the pixels in the first map. Then, the terminal writes the convolved pixel values into the fourth map. Then, the terminal performs vertical convolution on the pixel values of the pixels in the fourth map. Then, the terminal writes the convolved pixel values into the third map. The fourth map can be regarded as a temporary map. The above processing method can be regarded as a screen space algorithm.
[0104] 306. The terminal updates the initial skin based on the second map and the third map.
[0105] In an embodiment of the present application, the terminal can update the pixel value of each pixel in the initial skin according to the second map and the third map. Specifically, for any pixel, the terminal can obtain a pixel value for reflecting the specular reflection light effect at the pixel from the second map, and obtain a pixel value for reflecting the diffuse reflection light effect at the pixel from the third map. Then, the terminal updates the pixel value of the pixel in the initial skin according to the above two pixel values. Accordingly, the process of updating the initial skin by the terminal based on the second map and the third map includes: for any pixel in the initial skin, the terminal performs a weighted summation of the pixel value of the pixel in the second map and the pixel value of the pixel in the third map to obtain the pixel value of the pixel. Then, the terminal updates the initial skin based on the pixel values of multiple pixels. The solution provided in the embodiment of the present application uses two maps of the size of color maps to achieve skin rendering, reducing the amount of data of the maps used in the rendering process, thereby reducing the memory overhead of the rendering process; and subsequently, the effect of the skin under light irradiation is rendered according to the two maps generated previously. Since the amount of data of the first map and the second map is small, the efficiency of data processing can be improved, thereby improving the rendering efficiency of the skin.
[0106] The weights of the pixel values of the pixels in the second map and the pixel values of the pixels in the third map may be equal or unequal, and the embodiment of the present application does not limit this. When the weights of the pixel values of the pixels in the second map and the pixel values of the pixels in the third map are both 1, it is equivalent to directly adding the pixel values of the pixels in the second map and the pixel values of the pixels in the third map to update the pixel values in the initial skin.
[0107] In order to more clearly describe the effect of the terminal updating the initial skin, the following is further described with reference to the accompanying drawings: Fig. 9 is a schematic diagram of combining diffuse reflection light and specular reflection light according to an embodiment of the present application. Fig. 9 , the terminal obtains a pixel value reflecting the specular reflection effect at the pixel point from the second map, and obtains a pixel value reflecting the diffuse reflection effect at the pixel point from the third map. Then, the terminal adds the two pixel values to update the pixel value in the initial skin.
[0108] For example, Fig.10 This is a rendering of a combination of diffuse reflection light and specular reflection light provided according to an embodiment of the present application. Fig.10 , Fig.10 (a) in the figure shows the diffuse light effect of the initial skin by way of example; Fig.10 (b) in the figure shows the diffuse light effect of the initial skin after convolution processing; Fig.10 (c) in the figure shows the specular reflection light effect of the initial skin by way of example; Fig.10(d) in the figure shows the final effect of the initial skin. By comparing the above four figures, it can be seen that the final effect of combining diffuse light and specular light is more realistic and consistent with the state of real skin. For example, the position of the lips of the virtual character is better than that of the other three effect figures. Fig.10 The lips in (d) are not only shiny, but also have the waxy texture and transparent effect of human skin, which makes them more realistic.
[0109] After the terminal renders the skin, it can also render other translucent objects in the virtual scene. Then, after all virtual objects in the virtual scene are rendered, the terminal can perform post-processing on the rendered scene screen, such as anti-aliasing, color grading, and tone mapping, etc., which are not limited in the embodiments of the present application. Then, the terminal displays the scene screen. The skin is displayed in the scene screen.
[0110] In order to more clearly describe the skin rendering method provided by the embodiment of the present application, the following is further described in conjunction with the accompanying drawings. Fig.11 is a schematic diagram of a skin rendering method provided in an embodiment of the present application. Fig.11 , the terminal traverses the virtual objects in the entire virtual scene and obtains the rendering data of each virtual object in the virtual scene. Then, the terminal renders the opaque virtual objects in the virtual scene. Among them, the opaque virtual objects include opaque initial skin. Then, the terminal stores the diffuse reflection light information and the specular reflection light information of the initial skin in different color maps. Then, the terminal convolves the diffuse reflection light information of the initial skin in the horizontal direction. Then, the terminal convolves the diffuse reflection light information of the initial skin in the vertical direction. Then, the terminal superimposes the effect of the specular reflection light and the effect of the convolved diffuse reflection light, thereby realizing the rendering of the translucent skin. Then, the terminal can also render other translucent objects such as water bodies or glass. Then, the terminal post-processes each of the virtual objects rendered above. Then, the terminal displays each of the virtual objects rendered above.
[0111] The embodiment of the present application provides a skin rendering method, which determines the diffuse reflection light information and mirror reflection light information received by the initial skin of the preliminary rendering in the virtual scene through the lighting information in the virtual scene; then, a first map is generated through the diffuse reflection light information and the color map to achieve the purpose of recording the diffuse reflection light information in the color map, and similarly, the mirror reflection light information is recorded in another color map; compared with the prior art of recording the diffuse reflection light information and the mirror reflection light information in multiple texture maps, since the texture map generally stores a variety of texture information such as color and concave and convex conditions, and the data volume is larger than that of the color map, the present application ensures that the skin has obvious lighting effects that conform to the actual physical properties of the skin. In this case, skin rendering can be achieved by using data of the size of two color maps, which reduces the amount of map data during the rendering process, thereby reducing the memory overhead of the rendering process. It can be applied to mobile devices for rendering, and the rendering performance of mobile devices is guaranteed. That is, compared with the rendering solution through a fixed terminal with larger running memory, the effect after rendering through a mobile device is better; and subsequently, the effect of the skin under light is rendered according to the two maps generated previously. Since the amount of data of the first map and the second map is small, the efficiency of data processing can be improved, thereby improving the rendering efficiency of the skin; and, the requirements for the production of art materials are low, and there is no need to simulate the subsurface scattering effect from the perspective of resource design.
[0112] Fig.12 is a block diagram of a skin rendering device provided according to an embodiment of the present application. The skin rendering device is used to execute the steps of the above-mentioned skin rendering method. Fig.12 The device includes: a rendering module 1201, a first determining module 1202, a first generating module 1203, a second generating module 1204 and an updating module 1205.
[0113] A rendering module 1201 is used to render based on the rendering data of the skin in the virtual scene to obtain an initial skin, where the initial skin is an opaque skin;
[0114] A first determination module 1202 is used to determine diffuse reflection light information and specular reflection light information of the initial skin based on the lighting information and the initial skin in the virtual scene;
[0115] A first generating module 1203 is used to generate a first map based on diffuse reflection light information and a color map, where the color map is used to represent the color of the initial skin, and the first map is used to reflect the effect of diffuse reflection light on the initial skin;
[0116] A second generating module 1204 is used to generate a second map based on the specular reflection light information and the color map, where the second map is used to reflect the effect of the initial skin being subjected to the specular reflection light;
[0117] The updating module 1205 is used to update the initial skin based on the first texture and the second texture.
[0118] In some embodiments, Fig.13 is a block diagram of another skin rendering device provided according to an embodiment of the present application. Fig.13 The first generation module 1203 is used to update the pixel value of the pixel in the color map for any pixel in the initial skin based on the diffuse reflection light information of the pixel to obtain a first map.
[0119] In some embodiments, see Fig.13 The second generation module 1204 is used to update the pixel value of the pixel in the color map for any pixel in the initial skin based on the specular reflection light information of the pixel to obtain a second map.
[0120] In some embodiments, see Fig.13 , the device further comprises:
[0121] A second determination module 1206 is used to determine the scattering intensity of the initial skin based on the lighting information in the virtual scene and the initial skin, where the scattering intensity is used to reflect the subsurface scattering phenomenon of the initial skin;
[0122] The second generating module 1204 is further configured to store the scattering intensity in the second map.
[0123] In some embodiments, see Fig.13 , the update module 1205 includes:
[0124] The processing unit 12051 is used to convolve the pixel values of the pixel points in the initial skin in the first map based on the scattering intensity in the second map to obtain a third map, wherein the scattering intensity is used to reflect the subsurface scattering phenomenon of the initial skin;
[0125] The updating unit 12052 is used to update the initial skin based on the second map and the third map.
[0126] In some embodiments, see Fig.13 , processing unit 12051, including:
[0127] A determination subunit 1301 is used to determine a sampling step for any pixel of the initial skin in the first map based on the scattering intensity corresponding to the pixel in the second map, the scene camera parameter and the first convolution direction, where the scene camera parameter is used to represent information of a virtual camera in the virtual scene, the virtual camera is used to represent an observer for the pixel, and the sampling step is used to represent the number of pixel values used in the convolution process;
[0128] A first processing subunit 1302 is used to convolve the pixel value of the pixel point based on the sampling step along a first convolution direction;
[0129] The second processing sub-unit 1303 is used to obtain a third map based on the pixel values after convolution of multiple pixel points in the first map.
[0130] In some embodiments, see Fig.13 The first processing sub-unit 1302 is used to determine multiple reference pixel points near the pixel point along the first convolution direction based on the sampling step size; determine the weights of the multiple reference pixel points and the weights of the pixel points based on the Gaussian distribution function; based on the weights of the multiple reference pixel points and the weights of the pixel points, perform weighted summation on the pixel values of the multiple reference pixel points and the pixel value of the pixel point to obtain a new pixel value; and update the pixel value of the pixel point with the new pixel value.
[0131] In some embodiments, see Fig.13 The second processing sub-unit 1303 is used to obtain a fourth map based on multiple pixel values in the first map after convolution along the first convolution direction; and convolve multiple pixel values in the fourth map along the second convolution direction to obtain a third map.
[0132] In some embodiments, see Fig.13 , the updating unit 12052 is used to perform weighted summation of the pixel value of the pixel point in the second map and the pixel value of the pixel point in the third map for any pixel point in the initial skin to obtain the pixel value of the pixel point; and update the initial skin based on the pixel values of multiple pixels.
[0133] The embodiment of the present application provides a skin rendering device, which determines the diffuse reflection light information and mirror reflection light information received by the initial skin to be rendered in the virtual scene through the lighting information in the virtual scene; then, a first map is generated through the diffuse reflection light information and the color map to achieve the purpose of recording the diffuse reflection light information in the color map, and similarly, the mirror reflection light information is recorded in another color map; compared with the prior art of recording the diffuse reflection light information and the mirror reflection light information in multiple texture maps, since the texture map generally stores a variety of texture information such as color and concave and convex conditions, and the data volume is larger than that of the color map, the present application ensures that the skin has an obvious lighting effect that conforms to the actual physical properties of the skin. In this case, skin rendering can be achieved by using data of the size of two color maps, which reduces the amount of map data during the rendering process, thereby reducing the memory overhead of the rendering process. It can be applied to mobile devices for rendering, and the rendering performance of mobile devices is guaranteed. That is, compared with the rendering solution through a fixed terminal with larger running memory, the effect after rendering through a mobile device is better; and subsequently, the effect of the skin under light is rendered according to the two maps generated previously. Since the amount of data of the first map and the second map is small, the efficiency of data processing can be improved, thereby improving the rendering efficiency of the skin; and, the requirements for the production of art materials are low, and there is no need to simulate the subsurface scattering effect from the perspective of resource design.
[0134] It should be noted that: when the skin rendering device provided in the above embodiment runs an application, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the skin rendering device provided in the above embodiment and the skin rendering method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0135] In the embodiments of the present application, the computer device can be configured as a terminal or a server. When the computer device is configured as a terminal, the terminal can be used as the execution subject to implement the technical solution provided in the embodiments of the present application. When the computer device is configured as a server, the server can be used as the execution subject to implement the technical solution provided in the embodiments of the present application. The technical solution provided in the present application can also be implemented through interaction between the terminal and the server. The embodiments of the present application are not limited to this.
[0136] Fig.14 It is a structural block diagram of a terminal 1400 provided according to an embodiment of the present application.
[0137] Typically, the terminal 1400 includes a processor 1401 and a memory 1402 .
[0138] The processor 1401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 1401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1401 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0139] The memory 1402 may include one or more computer-readable storage media, which may be non-transitory. The memory 1402 may also include a high-speed random access memory and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1402 is used to store at least one computer program, which is executed by the processor 1401 to implement the skin rendering method provided in the method embodiment of the present application.
[0140] In some embodiments, the terminal 1400 may further optionally include: a peripheral device interface 1403 and at least one peripheral device. The processor 1401, the memory 1402 and the peripheral device interface 1403 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1403 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1404, a display screen 1405, a camera assembly 1406, an audio circuit 1407 and a power supply 1408.
[0141] The peripheral device interface 1403 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1401 and the memory 1402. In some embodiments, the processor 1401, the memory 1402, and the peripheral device interface 1403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1401, the memory 1402, and the peripheral device interface 1403 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0142] The radio frequency circuit 1404 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1404 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1404 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. In some embodiments, the radio frequency circuit 1404 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 1404 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1404 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0143] The display screen 1405 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1405 is a touch display screen, the display screen 1405 also has the ability to collect touch signals on the surface or above the surface of the display screen 1405. The touch signal can be input to the processor 1401 as a control signal for processing. At this time, the display screen 1405 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1405 can be one, set on the front panel of the terminal 1400; in other embodiments, the display screen 1405 can be at least two, respectively set on different surfaces of the terminal 1400 or in a folding design; in other embodiments, the display screen 1405 can be a flexible display screen, set on a curved surface or a folding surface of the terminal 1400. Even, the display screen 1405 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1405 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0144] The camera assembly 1406 is used to capture images or videos. In some embodiments, the camera assembly 1406 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1406 may also include a flash. The flash may be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0145] The audio circuit 1407 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 1401 for processing, or input them into the radio frequency circuit 1404 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 1400. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 1401 or the radio frequency circuit 1404 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1407 may also include a headphone jack.
[0146] The power supply 1408 is used to power various components in the terminal 1400. The power supply 1408 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1408 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery charged through a wired line, and a wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0147] In some embodiments, the terminal 1400 further includes one or more sensors 1409 . The one or more sensors 1409 include, but are not limited to: an acceleration sensor 1410 , a gyroscope sensor 1411 , a pressure sensor 1412 , an optical sensor 1413 , and a proximity sensor 1414 .
[0148] The acceleration sensor 1410 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 1400. For example, the acceleration sensor 1410 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 1401 can control the display screen 1405 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 1410. The acceleration sensor 1410 can also be used for collecting game or user motion data.
[0149] The gyro sensor 1411 can detect the body direction and rotation angle of the terminal 1400, and the gyro sensor 1411 can cooperate with the acceleration sensor 1410 to collect the user's 3D actions on the terminal 1400. The processor 1401 can implement the following functions based on the data collected by the gyro sensor 1411: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0150] The pressure sensor 1412 may be provided at the side frame of the terminal 1400 and / or the lower layer of the display screen 1405. When the pressure sensor 1412 is provided at the side frame of the terminal 1400, it may detect the user's holding signal of the terminal 1400, and the processor 1401 may perform left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 1412. When the pressure sensor 1412 is provided at the lower layer of the display screen 1405, the processor 1401 may control the operability control on the UI interface according to the user's pressure operation on the display screen 1405. The operability control includes at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0151] The optical sensor 1413 is used to collect the ambient light intensity. In one embodiment, the processor 1401 can control the display brightness of the display screen 1405 according to the ambient light intensity collected by the optical sensor 1413. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1405 is increased; when the ambient light intensity is low, the display brightness of the display screen 1405 is reduced. In another embodiment, the processor 1401 can also dynamically adjust the shooting parameters of the camera assembly 1406 according to the ambient light intensity collected by the optical sensor 1413.
[0152] The proximity sensor 1414, also called a distance sensor, is usually arranged on the front panel of the terminal 1400. The proximity sensor 1414 is used to collect the distance between the user and the front of the terminal 1400. In one embodiment, when the proximity sensor 1414 detects that the distance between the user and the front of the terminal 1400 is gradually decreasing, the processor 1401 controls the display screen 1405 to switch from the screen-on state to the screen-off state; when the proximity sensor 1414 detects that the distance between the user and the front of the terminal 1400 is gradually increasing, the processor 1401 controls the display screen 1405 to switch from the screen-off state to the screen-on state.
[0153] Those skilled in the art will understand that Fig.14 The structure shown in the figure does not constitute a limitation on the terminal 1400, and the terminal 1400 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0154] The embodiment of the present application also provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is loaded and executed by a processor of a computer device to implement the operation performed by the computer device in the skin rendering method of the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0155] The embodiment of the present application also provides a computer program product, including a computer program, which is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the skin rendering method provided in the above various optional implementations.
[0156] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0157] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A skin rendering method, characterized in that: The method comprises: Rendering is performed based on the rendering data of the skin in the virtual scene to obtain an initial skin, wherein the initial skin is an opaque skin; Determining diffuse reflection light information and specular reflection light information of the initial skin based on the lighting information in the virtual scene and the initial skin; Generate a first map based on the diffuse reflection light information and the color map, wherein the color map is used to represent the color of the initial skin, and the first map is used to reflect the effect of the diffuse reflection light on the initial skin; generating a second map based on the specular reflection light information and the color map, wherein the second map is used to reflect the effect of the initial skin being subjected to the specular reflection light; The initial skin is updated based on the first map and the second map.
2. The method according to claim 1, characterized in that The step of generating a first map based on the diffuse reflection light information and the color map comprises: For any pixel point in the initial skin, the pixel value of the pixel point in the color map is updated based on the diffuse reflection light information of the pixel point to obtain the first map.
3. The method according to claim 1, characterized in that The generating a second map based on the specular reflection light information and the color map comprises: For any pixel point in the initial skin, the pixel value of the pixel point in the color map is updated based on the specular reflection light information of the pixel point to obtain the second map.
4. The method according to claim 1, characterized in that The method further comprises: Determining a scattering intensity of the initial skin based on lighting information in the virtual scene and the initial skin, wherein the scattering intensity is used to reflect a subsurface scattering phenomenon of the initial skin; The scattered intensity is stored in the second map.
5. The method according to claim 1, characterized in that: The updating of the initial skin based on the first map and the second map includes: Based on the scattering intensity in the second map, convolving the pixel values of the pixel points in the initial skin in the first map to obtain a third map, wherein the scattering intensity is used to reflect the subsurface scattering phenomenon of the initial skin; The initial skin is updated based on the second map and the third map.
6. The method according to claim 5, characterized in that The step of convolving the pixel values of the pixel points in the initial skin in the first map based on the scattering intensity in the second map to obtain the third map comprises: For any pixel of the initial skin in the first map, determining a sampling step size based on a scattering intensity corresponding to the pixel in the second map, a scene camera parameter, and a first convolution direction, wherein the scene camera parameter is used to represent information of a virtual camera in the virtual scene, the virtual camera is used to represent an observer for the pixel, and the sampling step size is used to represent the number of pixel values used in the convolution process; Convolving the pixel values of the pixel points based on the sampling step along the first convolution direction; The third map is obtained based on the pixel values after convolution of multiple pixel points in the first map.
7. The method according to claim 6, characterized in that The step of convolving the pixel values of the pixel points along the first convolution direction based on the sampling step size includes: Based on the sampling step size, determining a plurality of reference pixel points near the pixel point along the first convolution direction; Based on a Gaussian distribution function, determining weights of the plurality of reference pixels and a weight of the pixel; Based on the weights of the multiple reference pixels and the weight of the pixel, performing weighted summation on the pixel values of the multiple reference pixels and the pixel value of the pixel to obtain a new pixel value; The pixel value of the pixel point is updated with the new pixel value.
8. The method according to claim 6, characterized in that The obtaining the third map based on the pixel values after convolution of a plurality of pixel points in the first map comprises: Obtaining a fourth map based on a plurality of pixel values in the first map after convolution along the first convolution direction; Convolving the plurality of pixel values in the fourth map along the second convolution direction respectively to obtain the third map.
9. The method according to claim 5, characterized in that The updating of the initial skin based on the second map and the third map includes: For any pixel point in the initial skin, weighted sum is performed on the pixel value of the pixel point in the second map and the pixel value of the pixel point in the third map to obtain the pixel value of the pixel point; The initial skin is updated based on the pixel values of the plurality of pixel points.
10. A skin rendering device, characterized in that: The device comprises: A rendering module, used for rendering based on the rendering data of the skin in the virtual scene to obtain an initial skin, wherein the initial skin is an opaque skin; A first determination module, configured to determine diffuse reflection light information and specular reflection light information of the initial skin based on lighting information in the virtual scene and the initial skin; A first generating module, configured to generate a first map based on the diffuse reflection light information and the color map, wherein the color map is used to represent the color of the initial skin, and the first map is used to reflect the effect of the diffuse reflection light on the initial skin; A second generating module, used to generate a second map based on the specular reflection light information and the color map, wherein the second map is used to reflect the effect of the initial skin being subjected to the specular reflection light; An updating module is used to update the initial skin based on the first map and the second map.
11. A computer device, characterized in that: The computer device comprises a processor and a memory, wherein the memory is used to store at least one computer program, and the at least one computer program is loaded by the processor and executes the skin rendering method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store at least one computer program, and the at least one computer program is used to execute the skin rendering method according to any one of claims 1 to 9.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the skin rendering method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Real-time data visualization method and device and electronic equipment
CN121705480A
