Character skin rendering method and device, storage medium, and electronic device

By generating and applying the second texture data, the subsurface scattering effect of the virtual character's face is enhanced, solving the problem of low facial fidelity caused by insufficient light scattering in the existing technology, and achieving a more natural and vivid facial rendering effect.

CN111862285BActive Publication Date: 2024-10-29BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010660981.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-10
Publication Date
2024-10-29
Estimated Expiration
2040-07-10

AI Technical Summary

Technical Problem

The existing technology fails to effectively consider the subsurface scattering of light when rendering character skin, resulting in low facial fidelity, stiffness, and lack of layering.

Method used

By obtaining the data and material information of the virtual character's facial map on the pre-integrated skin model, the second map data is generated, the subsurface scattering skin model is used to enhance the light scattering effect, and the diffuse reflection, front scattering and mask parameters in the map data are adjusted. Blend roughness and normal channels to enhance highlight and backlight effects on faces.

Benefits of technology

The layering of the facial skin is improved, making the virtual character's face more vivid, natural, smart and real, and solving the problem of stiff and rigid faces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111862285B_ABST
    Figure CN111862285B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for rendering human skin, a storage medium, and an electronic device, wherein the method comprises: obtaining first texture data of a virtual character's facial texture on a pre-integrated skin model, and material information of the virtual character, wherein the material information is used to characterize the subsurface scattering state of the virtual character; generating second texture data according to the material information and the first texture data; and rendering the facial texture on the subsurface scattering skin model using the second texture data. The present invention solves the technical problem of stiff and rigid facial features of virtual characters in the related art, making the facial features of virtual characters more vivid, natural, smart and real.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for rendering human skin, a storage medium, and an electronic device. Background Art

[0002] With the development of computer graphics in related technologies, people are pursuing higher and higher image fidelity. Using image technology, more and more real images can be described, among which the method of normal mapping can improve the fidelity of the description of three-dimensional images. When the computer processing power is limited or the rendering of animation is limited by time, normal mapping is also a better solution. Normal mapping is mostly used in the rendering of CG animation and the production of game screens. The high-detailed model is baked out of the normal map through mapping, and then assigned to the normal map channel of the low-end model, so that the surface has a rendering effect of light and shadow distribution, which can greatly reduce the number of faces and calculation content required to express the object, thereby optimizing the rendering effect of animation and games.

[0003] In the related art, when using textures to render characters, especially faces, usually only the reflection and shadow of light are considered, without considering the light changes caused by sub-surface scattering of light. As a result, the face is relatively stiff and rigid. Therefore, the three-dimensional image simulation technology of the related art has the defect of low realism.

[0004] With respect to the above-mentioned problems existing in the related technologies, no effective solutions have been found so far. Summary of the invention

[0005] The embodiments of the present invention provide a method and device for rendering human skin, a storage medium, and an electronic device.

[0006] According to one embodiment of the present invention, a method for rendering human skin is provided, comprising: obtaining first map data of a facial map of a virtual character on a pre-integrated skin model, and material information of the virtual character, wherein the material information is used to characterize a subsurface scattering state of the virtual character; generating second map data according to the material information and the first map data; and rendering the facial map on a subsurface scattering skin model using the second map data.

[0007] Optionally, generating the second map data according to the material information and the first map data includes: obtaining a texture lookup LUT map in the material information; and modifying the diffuse reflection intensity of direct light of the NdotL item in the first map data according to the LUT map to generate the second map data.

[0008] Optionally, generating second map data according to the material information and the first map data includes: obtaining an NdotH parameter in the material information; and adjusting a front scattering parameter and a front subsurface diffuse reflection parameter in the first map data according to the NdotH parameter to generate the second map data.

[0009] Optionally, generating the second map data according to the material information and the first map data includes: obtaining curvature parameters in the material information; intercepting the auricle area in the facial map according to the curvature parameters; adjusting the scattering parameters of the auricle area in the first map data to generate the second map data, wherein the scattering parameters include: half3 TransLightDir, half TransDot, half WrapNoL, half backSSSMask, half3backSSSDiffuse.

[0010] Optionally, generating second map data according to the material information and the first map data includes: calculating the roughness of the fat layer in the facial map according to the material information; and mixing a second GGX highlight of the roughness in a first microsurface distribution function GGX highlight of the first map data according to a predetermined proportion to generate the second map data.

[0011] Optionally, generating the second map data according to the material information and the first map data includes: obtaining curvature parameters in the material information; generating a facial mask according to the curvature parameters; and respectively mixing the detail normal and roughness of the facial mask in the normal channel and roughness channel of the first map data to generate the second map data.

[0012] Optionally, generating the second map data according to the material information and the first map data includes: obtaining the roughness of the facial map from the GGX bidirectional reflectance distribution function BRDF model of the material information; adjusting the highlight parameters in the first map data according to the roughness to generate the second map data, wherein the highlight parameters include: half3 crystalMaskMap, half3crystalMap01, half3 crystalMap02, half3crystalMap03, half3 crystalMask, half3crystalSpecularColor.

[0013] Optionally, the method further includes: intercepting a backlit surface of the facial map; supplementing the illumination component of direct light on the backlit surface; and adding the illumination component to the first map data of the backlit surface to generate the second map data.

[0014] According to another embodiment of the present invention, a rendering device for human skin is provided, comprising: an acquisition module for acquiring first map data of a facial map of a virtual character on a pre-integrated skin model, and material information of the virtual character, wherein the material information is used to characterize the subsurface scattering state of the virtual character; a first generation module for generating second map data based on the material information and the first map data; and a rendering module for rendering the facial map on the subsurface scattering skin model using the second map data.

[0015] Optionally, the generation module includes: a first acquisition unit, used to acquire a texture lookup LUT map in the material information; and a modification unit, used to modify the diffuse reflection intensity of direct light of the NdotL item in the first map data according to the LUT map to generate the second map data.

[0016] Optionally, the generation module includes: a second acquisition unit, used to acquire the NdotH parameter in the material information; and a first adjustment unit, used to adjust the front scattering parameter and the front subsurface diffuse reflection parameter in the first map data according to the NdotH parameter to generate the second map data.

[0017] Optionally, the generation module includes: a third acquisition unit, used to acquire curvature parameters in the material information; a clipping unit, used to clip the auricle area in the facial map according to the curvature parameters; a second adjustment unit, used to adjust the scattering parameters of the auricle area in the first map data to generate the second map data, wherein the scattering parameters include: half3 TransLightDir, half TransDot, half WrapNoL, half backSSSMask, half3 backSSSDiffuse.

[0018] Optionally, the generation module includes: a calculation unit, used to calculate the roughness of the fat layer in the facial map according to the material information; and a first mixing unit, used to mix a second GGX highlight of the roughness in a first microsurface distribution function GGX highlight of the first map data according to a predetermined proportion to generate the second map data.

[0019] Optionally, the generation module includes: a fourth acquisition unit, used to acquire curvature parameters in the material information; a second generation module, used to generate a facial mask based on the curvature parameters; and a second mixing unit, used to mix the detail normal and roughness of the facial mask in the normal channel and roughness channel of the first map data respectively to generate the second map data.

[0020] Optionally, the generation module includes: a fifth acquisition unit, used to obtain the roughness of the facial map according to the GGX bidirectional reflectance distribution function BRDF model of material information; a third adjustment unit, used to adjust the highlight parameters in the first map data according to the roughness to generate the second map data, wherein the highlight parameters include: half3 crystalMaskMap, half3 crystalMap09, half3 crystalMap02, half3crystalMap03, half3 crystalMask, half3 crystalSpecularColor.

[0021] Optionally, the device also includes: a capture module, used to capture the backlight surface of the facial map after the acquisition module acquires the first map data of the facial map of the virtual character on the pre-integrated skin model; a supplement module, used to supplement the illumination component of direct light on the backlight surface; and a processing module, used to add the illumination component to the first map data of the backlight surface to generate the second map data.

[0022] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0023] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0024] Through the present invention, first map data of a virtual character's facial map on a pre-integrated skin model and material information of the virtual character are obtained, and then second map data are generated according to the material information and the first map data. Finally, the second map data is used to render the facial map on a subsurface scattering skin model. By adding or enhancing the scattering effect of light in the original facial map, the layering of the facial skin is enhanced, and the technical problem of stiff and rigid facial features of virtual characters in related technologies is solved, making the face of the virtual character more vivid, natural, smart and realistic. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0026] Figure 1 It is a hardware structure block diagram of a computer for rendering human skin according to an embodiment of the present invention;

[0027] Figure 2 is a flow chart of a method for rendering human skin according to an embodiment of the present invention;

[0028] Figure 3 is a schematic diagram of light scattering according to an embodiment of the present invention;

[0029] Figure 4 is a schematic diagram of a GGX curve in an embodiment of the present invention;

[0030] Figure 5 is a rendering schematic diagram of the texture data before and after modification according to an embodiment of the present invention;

[0031] Figure 6 The present invention is a structural block diagram of a device for rendering human skin according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0034] Example 1

[0035] The method embodiment provided in the first embodiment of the present application can be executed in a mobile phone, tablet, computer or similar electronic terminal. Taking running on a computer as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a computer for rendering human skin according to an embodiment of the present invention. Figure 1 As shown, the computer 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0036] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for rendering a character skin in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. In this embodiment, the processor 104 is used to respond to human-computer interaction instructions and game strategies, and control the target virtual character to perform specified operations to complete the game task. The memory 104 is used to store program scripts, configuration information, attribute information of virtual characters, etc. of electronic games.

[0037] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0038] Optionally, the input-output device 108 also includes a human-computer interaction screen for obtaining human-computer interaction instructions through a human-computer interaction interface, and for presenting game screens in game tasks;

[0039] In this embodiment, a method for rendering human skin is provided. Figure 2is a flowchart of a method for rendering human skin according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0040] Step S202, obtaining first texture data of a facial texture of a virtual character on a pre-integrated skin model, and material information of the virtual character, wherein the material information is used to characterize a subsurface scattering state of the virtual character;

[0041] Sub-Surface-Scattering (SSS) in this embodiment is used to describe the lighting phenomenon of scattering when light passes through a transparent / translucent surface. It refers to the light transmission process in which light enters an object from the surface, is scattered internally, and then is emitted through other vertices on the surface of the object. Since character models generally exist under lighting conditions, including direct light and indirect light, the sub-surface scattering of their faces when illuminated will change the color brightness of some facial areas, making the scattered areas more transparent.

[0042] The facial skin is a material with complex properties and its physical structure consists of multiple layers. The surface oil layer mainly contributes to the reflection part of the skin light, while the epidermis and dermis below the oil layer mainly contribute to the subsurface scattering part.

[0043] In some examples of this embodiment, a decompilation tool is used to obtain the first texture data of the virtual character's facial texture on the pre-integrated skin model, analyze the rendering process, extract the texture, use Ninja Ripper to extract the model with UV, and then use Max to flip the normal once and export it into an FBX file.

[0044] Step S204, generating second texture data according to the material information and the first texture data;

[0045] Optionally, the second texture data may be generated by adjusting or increasing the first texture number and assigning a value in an RGB channel or an RGBA channel.

[0046] Step S206: Rendering a facial texture on the subsurface scattering skin model using the second texture data.

[0047] Compared with the pre-integrated skin model, the subsurface scattering skin model of this embodiment adds rendering parameters of subsurface scattering.

[0048] Through the above steps, the first map data of the facial map of the virtual character on the pre-integrated skin model and the material information of the virtual character are obtained, and then the second map data are generated according to the material information and the first map data. Finally, the facial map is rendered on the subsurface scattering skin model using the second map data. By adding or enhancing the scattering effect of light in the original facial map, the layering of the facial skin is enhanced, and the technical problem of the stiff and rigid face of the virtual character in the related technology is solved, making the face of the virtual character more vivid, natural, smart and realistic.

[0049] Figure 3 It is a schematic diagram of light scattering of an embodiment of the present invention. When light is emitted from one medium (air) to another medium (skin), two phenomena will occur. Part of the light is reflected at the junction of the medium and does not enter the other medium. The other part of the light enters the other medium and will be refracted (transmitted). The two phenomena of light are collectively called light scattering. The ratio of the radiance (radiance) of the reflected part of the light to the irradiance (irradiance) of the incident light is a function of the incident angle and the exit angle. This function is called the bidirectional reflection distribution function (BRDF). The function of the radiance and irradiance of the part of the light that passes through the medium is called the bidirectional transmission distribution function (BTDF). The ratio of the sum of the radiance of the two parts of the outgoing light to the irradiance of the incident light is called the bidirectional scattering distribution function (BSDF), that is, BSDF = BRDF + BTDF.

[0050] If we divide the path of light into reflection and transmission, with reflection represented by R and transmission represented by T, then the path of light from one point to another can be represented by R and T. For example, the path described by BRDF is R, and the path described by BTDF is TT. In addition, there may be lighting paths such as TRT and TRRRT. Therefore, there should be many outgoing light rays near the incident point of the light. In actual rendering, if the position of the light exit point is less than one pixel away from the incident point, we assume that the incident point and the exit point are at the same position, and the lighting of the current pixel is only affected by itself; if the incident point and the exit point are more than one pixel apart, it means that the lighting result of a certain pixel is not only affected by the current pixel, but also by the lighting of other nearby pixels, that is, the subsurface scattering effect.

[0051] In one implementation of the present embodiment, generating the second map data according to the material information and the first map data includes: obtaining a look up texture (LUT) map in the material information; and modifying the diffuse reflection intensity of the direct light of the NdotL (dot product of the light vector and the incident light vector) item in the first map data according to the LUT map to generate the second map data.

[0052] The three colors of light (red, green, and blue) scatter differently on the skin. Generally speaking, red light scatters farther, blue light scatters closer, and green light is somewhere in between. Screen space skin rendering, which is commonly used in deferred rendering, uses different kernel functions to diffuse light from different channels. Therefore, when the outgoing light is concentrated in the red area, the subsurface scattering effect is considered negligible, and when the outgoing light is more evenly distributed in the green area, the subsurface scattering effect needs to be considered separately.

[0053] Due to the limitation of mobile forward rendering, the pre-integrated skin model uses a pre-baked LUT map to modify the NdotL item to change the original skin diffuse performance. Among them, half3 sssnl = tex2D (_LUT, float2 (nl * 0.5 + 0.5, 1.0 - sss intensity)). rgb, where sss intensity is the G channel of the mix map, half3 = (half x, half y, half z), nl = dot (N, L), N: normal direction in world space, L: light direction in world space.

[0054] In one implementation of the present embodiment, generating second map data based on material information and first map data includes: obtaining NdotH parameters in the material information (dot product of light vector and half-angle vector); adjusting front scattering parameters and front subsurface diffuse reflection parameters in the first map data according to the NdotH parameters to generate second map data.

[0055] In this embodiment, the deep scattering of the front side and the transmission of the backlight are added at the same time. Compared with the solution of deep scattering without backlight transmission, the layering of the face is enhanced. The subsurface shading model of the UE4 tool is used, and NdotH is added to enhance the layering effect. The adjustment algorithm of the front scattering parameter (frontScatter) and the front subsurface diffuse reflection parameter (frontSSSDiffuse) is as follows:

[0056] half3 frontScatter=nh*saturate(nl+0.5)*light.color;

[0057] half3 frontSSSDiffuse=lerp(1.0,frontScatter,0.8)*curvature*SSColor.rgb;

[0058] Among them, SSSColor: scattering color, Curvature: model curvature, can be baked into a map from the high poly model.

[0059] Among them, nh = dot(N,H), N: normal direction of world space, V: viewing direction of world space, H = normalize(L,V), by using blinn-phong lighting distribution, the subsurface scattering SSS performance on the front of the skin is enhanced, and the eye shadow effect can be increased on the face.

[0060] Since the effect of subsurface scattering mainly occurs in locations with large curvature (or locations where the lighting conditions change steeply), and is not easy to show the effect of subsurface scattering in relatively flat locations (for example, the subsurface scattering at the bridge of the nose is stronger than that at the forehead), subsurface scattering is also prone to occur in areas with concave and convex details. Large curvatures are caused by geometric shapes, and concave and convex details are generally supplemented by normal maps.

[0061] In one implementation of the present embodiment, generating the second map data according to the material information and the first map data includes: obtaining the curvature parameters in the material information; intercepting the auricle area in the facial map according to the curvature parameters; adjusting the scattering parameters of the auricle area in the first map data to generate the second map data, wherein the scattering parameters include: half3TransLightDir, half TransDot, half WrapNoL, half backSSSMask, half3backSSSDiffuse.

[0062] In this implementation, the brightest part is intercepted by curvature (curvature parameter) as a mask, which can be an independent image for easy control. The adjustment algorithm is as follows:

[0063] half3 TransLightDir=light.dir+normal*0.5;

[0064] half TransDot=saturate(dot(-TransLightDir,viewDir));

[0065] half WrapNoL=saturate(-nl*0.5+0.5);

[0066] half backSSSMask=saturate((curvature+_SSSBackRange-1.0) / max(0.01,_SSSBackRange));

[0067] half3 backSSSDiffuse=pow(TransDot,_SSSPower)*WrapNoL*backSSSMask*light.color*SSSColor.rgb;

[0068] Among them, SSSBackRange: SSS backlight range, SSSColor: SSS color, backSSSMask: backlight transmission mask, SSSPower: controls the softness of the SSS light spot.

[0069] Backlighting calculations require simulating the scattering of light inside the material. Each ray can be split into multiple beams and reflected hundreds or even thousands of times inside the material. By simplification, in opaque materials, the contribution of light comes directly from the light source. Vertices that are tilted more than 90 degrees relative to the direction of the light do not receive light. Semi-transparent materials can actually pass some light through the material and make it to the other side due to the effect of scattering. So, assuming there is a light source on the back side in the opposite direction of the current lighting, the effect of backlighting can be simulated.

[0070] In one implementation of the present embodiment, generating second map data based on material information and first map data includes: obtaining curvature parameters in the material information; generating a facial mask based on the curvature parameters; and mixing detail normals and roughness of the facial mask in the normal channel and roughness channel of the first map data, respectively, to generate second map data.

[0071] The main function of detail normal is to express the pores of the skin. Curvature is used as a mask to mix the normals (b channel and a (Alpha) channel) and roughness (r channel) of the detail normal map. With the solution of this embodiment, the weight of detail normal is lower in areas with large curvature changes such as the nose tip and the corner of the eye, and higher in areas with small curvature changes such as the cheeks where the skin is smoother, so the feeling of pores will be more prominent.

[0072] Since the effect of subsurface scattering mainly occurs in locations with large curvature (or locations where the lighting conditions change steeply), and is not easy to show the effect of subsurface scattering in relatively flat locations (for example, the subsurface scattering at the bridge of the nose is stronger than that at the forehead), subsurface scattering is also prone to occur in areas with concave and convex details. Large curvatures are caused by geometric shapes, and concave and convex details are generally supplemented by normal maps.

[0073] In one implementation of the present embodiment, generating second map data based on material information and first map data includes: calculating the roughness of the fat layer in the facial map based on the material information; mixing a second GGX highlight of the roughness in a first microsurface distribution function GGX highlight of the first map data according to a predetermined proportion to generate the second map data.

[0074] Because the skin surface has oil, it will produce sharper and more concentrated highlight reflections, so the two-layer highlight model of Two Lobes Rendering is used, that is, two GGX highlights of different roughness are calculated and then interpolated. The highlights produced in this way can be sharper and more concentrated, and the concentration of the highlights can be modified separately without affecting the overall highlight distribution, which enhances the highlight effect of the face and makes the task more vivid. Figure 4 : is a schematic diagram of the GGX curve in an embodiment of the present invention, the upper part is the GGX highlight when the roughness is 0.7 (the horizontal axis is the angle between N and H), and the lower part is a GGX highlight with a roughness of 0.5 mixed on this basis (the ratio is 0.75 and 0.25).

[0075] Figure 5 It is a rendering schematic diagram of the texture data before and after modification according to an embodiment of the present invention. The light-dark transition area of ​​the right face tends to be red, which significantly enhances the highlight effect of the face.

[0076] In one implementation of the present embodiment, generating second map data according to material information and first map data includes: obtaining the roughness of the facial map from the GGX bidirectional reflectance distribution function BRDF model according to the material information; adjusting the highlight parameters in the first map data according to the roughness to generate the second map data, wherein the highlight parameters include: half3crystalMaskMap, half3 crystalMap01, half3 crystalMap02, half3 crystalMap03, half3crystalMask, half3crystalSpecularColor.

[0077] Since BRDF parameters include roughness, which will change the light distribution, the calculation of highlights uses the GGX BRDF model. Add a roughness variable in the shader panel to control the overall roughness of the makeup. Makeup does not calculate diffuse, only specular, and the color of the crystal map is used as the specular color. The adjustment algorithm is as follows:

[0078] half3 crystalMaskMap=tex2D(_CrystalMask,i.uv0).rgb;

[0079] half3 crystalMap01=tex2D(_CrystalMap01,i.uv0*_CrystalUVTile01*5.0).rgb;

[0080] half3 crystalMap02=tex2D(_CrystalMap02,i.uv0*_CrystalUVTile02*5.0).rgb;

[0081] half3 crystalMap03=tex2D(_CrystalMap03,i.uv0*_CrystalUVTile03*5.0).rgb;

[0082] half3 crystalMask=crystalMaskMap.x*crystalMap01*_CrystalColor01.rgb+crystalMaskMap.y*crystalMap02*_CrystalColor02.rgb+crystalMaskMap.z*crystalMap03*_CrystalColor03.rgb;

[0083] half3 crystalSpecularColor=saturate(crystalMask*10.0);

[0084] Among them, i.uv0 is the texture coordinate of the model. By adjusting it, the effect of lip gloss can be added to the facial makeup.

[0085] In one implementation of this embodiment, the method further includes: intercepting the backlit surface of the facial map; supplementing the illumination component of the direct light on the backlit surface; and adding the illumination component to the first map data of the backlit surface to generate second map data.

[0086] Since spherical harmonics are used to calculate indirect lighting for movable objects, the lighting results are often flat and lack a sense of volume. This implementation adds a directional light as fill light to the backlit surface of the object, and can also assign the fill light to the shader, thereby reducing the amount of calculation for the lighting component.

[0087] In games, light sources are simplified into direct light sources and indirect light sources / ambient light. The backlit side of the character is only affected by indirect light, so the effect is relatively flat and lacks three-dimensionality. Fill light is used to supplement the lighting effect of the backlit side.

[0088] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0089] Example 2

[0090] In this embodiment, a rendering device for human skin is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0091] Figure 6 is a structural block diagram of a device for rendering human skin according to an embodiment of the present invention. Figure 6 As shown, the device includes: an acquisition module 60, a first generation module 62, and a rendering module 64, wherein:

[0092] An acquisition module 60, configured to acquire first texture data of a facial texture of a virtual character on a pre-integrated skin model, and material information of the virtual character;

[0093] A first generating module 62, configured to generate second texture data according to the material information and the first texture data;

[0094] The rendering module 64 is configured to render the facial texture on the subsurface scattering skin model using the second texture data.

[0095] Optionally, the generation module includes: a first acquisition unit, used to acquire a texture lookup LUT map in the material information; and a modification unit, used to modify the diffuse reflection intensity of direct light of the NdotL item in the first map data according to the LUT map to generate the second map data.

[0096] Optionally, the generation module includes: a second acquisition unit, used to acquire the NdotH parameter in the material information; and a first adjustment unit, used to adjust the front scattering parameter and the front subsurface diffuse reflection parameter in the first map data according to the NdotH parameter to generate the second map data.

[0097] Optionally, the generation module includes: a third acquisition unit, used to acquire curvature parameters in the material information; a clipping unit, used to clip the auricle area in the facial map according to the curvature parameters; a second adjustment unit, used to adjust the scattering parameters of the auricle area in the first map data to generate the second map data, wherein the scattering parameters include: half3 TransLightDir, half TransDot, half WrapNoL, half backSSSMask, half3 backSSSDiffuse.

[0098] Optionally, the generation module includes: a calculation unit, used to calculate the roughness of the fat layer in the facial map according to the material information; and a first mixing unit, used to mix a second GGX highlight of the roughness in a first microsurface distribution function GGX highlight of the first map data according to a predetermined proportion to generate the second map data.

[0099] Optionally, the generation module includes: a fourth acquisition unit, used to acquire curvature parameters in the material information; a second generation module, used to generate a facial mask based on the curvature parameters; and a second mixing unit, used to mix the detail normal and roughness of the facial mask in the normal channel and roughness channel of the first map data respectively to generate the second map data.

[0100] Optionally, the generation module includes: a fifth acquisition unit, used to obtain the roughness of the facial map according to the GGX bidirectional reflectance distribution function BRDF model of material information; a third adjustment unit, used to adjust the highlight parameters in the first map data according to the roughness to generate the second map data, wherein the highlight parameters include: half3 crystalMaskMap, half3 crystalMap09, half3 crystalMap02, half3crystalMap03, half3 crystalMask, half3crystalSpecularColor.

[0101] Optionally, the device also includes: a capture module, used to capture the backlight surface of the facial map after the acquisition module acquires the first map data of the facial map of the virtual character on the pre-integrated skin model; a supplement module, used to supplement the illumination component of direct light on the backlight surface; and a processing module, used to add the illumination component to the first map data of the backlight surface to generate the second map data.

[0102] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0103] Example 3

[0104] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0105] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0106] S1, obtaining first texture data of a facial texture of a virtual character on a pre-integrated skin model, and material information of the virtual character;

[0107] S2, generating second texture data according to the material information and the first texture data;

[0108] S3: Render the facial map on a subsurface scattering skin model using the second map data.

[0109] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0110] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0111] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0112] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0113] S1, obtaining first texture data of a facial texture of a virtual character on a pre-integrated skin model, and material information of the virtual character;

[0114] S2, generating second texture data according to the material information and the first texture data;

[0115] S3: Render the facial map on a subsurface scattering skin model using the second map data.

[0116] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0117] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0118] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0119] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0120] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0121] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0122] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0123] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for rendering human skin, characterized in that: include: Acquire first texture data of a facial texture of a virtual character on a pre-integrated skin model, and material information of the virtual character, wherein the material information is used to characterize a subsurface scattering state of the virtual character, and the subsurface scattering is used to describe a lighting phenomenon in which light is scattered when passing through a transparent / semi-transparent surface; Generating the second texture data according to the material information and the first texture data is specifically achieved by any of the following methods: Acquire a texture lookup LUT map in the material information; modify the diffuse reflection intensity of direct light of the NdotL item in the first map data according to the LUT map to generate the second map data; Acquire an NdotH parameter in the material information; adjust a front scattering parameter and a front subsurface diffuse reflection parameter in the first map data according to the NdotH parameter to generate the second map data; Acquire the curvature parameters in the material information; intercept the auricle area in the facial map according to the curvature parameters; adjust the scattering parameters of the auricle area in the first map data to generate the second map data, wherein the scattering parameters include: half3 TransLightDir, half TransDot, half WrapNoL, half backSSSMask, half3 backSSSDiffuse; Calculate the roughness of the fat layer in the facial map according to the material information; mix the second GGX highlight of the roughness in the first microsurface distribution function GGX highlight of the first map data according to a predetermined ratio to generate the second map data; Acquire the curvature parameter in the material information; generate a facial mask according to the curvature parameter; respectively mix the detail normal and roughness of the facial mask in the normal channel and the roughness channel of the first texture data to generate the second texture data; Obtaining the roughness of the facial map from a GGX bidirectional reflectance distribution function BRDF model of material information; adjusting highlight parameters in the first map data according to the roughness to generate the second map data, wherein the highlight parameters include: half3 crystalMaskMap, half3 crystalMap01, half3 crystalMap02, half3crystalMap03, half3 crystalMask, and half3 crystalSpecularColor; The facial map is rendered on a subsurface scattering skin model using the second map data. The subsurface scattering skin model has increased rendering parameters of subsurface scattering compared to the pre-integrated skin model.

2. The method according to claim 1, characterized in that The method further comprises: intercepting the backlit surface of the facial map; Supplementing the illumination component of direct light on the backlight surface; The illumination component is added to the first mapping data of the backlight surface to generate the second mapping data.

3. A device for rendering human skin, characterized in that: include: An acquisition module, used to acquire first texture data of a facial texture of a virtual character on a pre-integrated skin model, and material information of the virtual character, wherein the material information is used to characterize a subsurface scattering state of the virtual character, and the subsurface scattering is used to describe an illumination phenomenon in which light is scattered when passing through a transparent / semi-transparent surface; A first generating module, used for generating second texture data according to the material information and the first texture data; A rendering module, configured to render the facial map on a subsurface scattering skin model using the second map data, wherein the subsurface scattering skin model has a subsurface scattering rendering parameter added compared to the pre-integrated skin model; The first generation module is implemented in any of the following ways: Acquire a texture lookup LUT map in the material information; modify the diffuse reflection intensity of direct light of the NdotL item in the first map data according to the LUT map to generate the second map data; Acquire an NdotH parameter in the material information; adjust a front scattering parameter and a front subsurface diffuse reflection parameter in the first map data according to the NdotH parameter to generate the second map data; Acquire the curvature parameters in the material information; intercept the auricle area in the facial map according to the curvature parameters; adjust the scattering parameters of the auricle area in the first map data to generate the second map data, wherein the scattering parameters include: half3 TransLightDir, half TransDot, half WrapNoL, half backSSSMask, half3 backSSSDiffuse; Calculate the roughness of the fat layer in the facial map according to the material information; mix the second GGX highlight of the roughness in the first microsurface distribution function GGX highlight of the first map data according to a predetermined ratio to generate the second map data; Acquire the curvature parameter in the material information; generate a facial mask according to the curvature parameter; respectively mix the detail normal and roughness of the facial mask in the normal channel and the roughness channel of the first texture data to generate the second texture data; The roughness of the facial map is obtained from the GGX bidirectional reflectance distribution function BRDF model of the material information; the highlight parameters in the first map data are adjusted according to the roughness to generate the second map data, wherein the highlight parameters include: half3 crystalMaskMap, half3 crystalMap01, half3 crystalMap02, half3crystalMap03, half3 crystalMask, and half3 crystalSpecularColor.

4. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 2 when executed.

5. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Object rendering method and device, storage medium and electronic device

    CN111009026A