Rendering method, device, computer device and storage medium
By grouping and modeling hairs and using hair maps to perform multi-layer layer overlay, the problem of insufficient computing power for hyperrealistic hair rendering on mobile devices is solved, and efficient and realistic hair rendering effects are achieved.
Patent Information
- Application Number
- CN202210663485.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-06-13
AI Technical Summary
When rendering hyperrealistic digital human hair in real time on mobile devices, the existing technology has the problem of insufficient computing power, resulting in low rendering efficiency and unrealistic effect.
Using a modeling method of multiple hairs as a group, hair maps are used for rendering, including color and transparency channels, and layered overlays are combined with multi-layer models and maps to optimize the rendering process of hair, reduce the number of models and enhance the real effect.
While reducing computing power demand, high-quality hyperrealistic hair rendering effect is achieved, suitable for real-time rendering of mobile devices.
Smart Images

Figure CN115082615B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technologies, and in particular, to a rendering method, apparatus, computer device, and storage medium. Background Art
[0002] Currently, in life, we often see media assets such as movies, animations, and advertisements of hyper-realistic style character figures (hereinafter referred to as digital humans); however, in mobile real-time rendering applications or games, it is very difficult to see the appearance of digital humans. The main reasons are that the production cost of hyper-realistic style digital humans is extremely high; at the same time, hyper-realistic style digital humans require a lot of computing power for rendering, but the computing power of many embedded devices has priority, resulting in the fact that the art assets produced by the traditional digital human production process are difficult to be smoothly rendered on these devices. Especially, the performance of digital human hair occupies almost half of the rendering pressure in digital human rendering. Therefore, a method for rendering hyper-realistic hair with low computing power has become an urgent problem to be solved currently. Summary of the Invention
[0003] The embodiments of the present disclosure provide at least a rendering method, apparatus, and system.
[0004] In a first aspect, the embodiments of the present disclosure provide a rendering method, which is characterized by including:
[0005] Obtain a hair model and a hair texture map corresponding to the hair model; the hair model includes: a plurality of first models located at different positions on the head; each of the first models is generated by modeling a hair patch formed by multiple hairs at the corresponding position; the hair texture map includes: a color texture map generated for each of the first models and used to represent the colors of multiple hairs at the corresponding position; the color texture map includes: a plurality of color channels and a transparency channel; the value of each pixel point in the transparency channel of the color texture map is used to represent the transparency information of the pixel point;
[0006] Render the hair model by using the hair texture map to generate a rendering image corresponding to the hair model.
[0007] In this way, by modeling the hair patches formed by multiple hairs, first models located at different positions on the head are obtained, so that it is not necessary to construct models for each hair separately, reducing the number of models to be rendered during the rendering process; at the same time, by using the hair texture map with transparency information to render the first models, the occlusion relationship between the first models will not affect the hairs that should be "seen" from being rendered into the rendering image, thereby ensuring the hyper-realistic characteristics during the hair rendering process on the basis of reducing the computing power requirements.
[0008] In an alternative implementation, rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model includes:
[0009] For each of the multiple first models, rendering the first model using the hair texture map corresponding to the first model to generate a first layer corresponding to the first model and transparency information corresponding to each pixel point in the first layer;
[0010] Based on the depth information of the multiple first models relative to the virtual camera respectively and the transparency information corresponding to each pixel point in the first layer, superimposing the first layers corresponding to the multiple first models respectively to obtain the rendered image.
[0011] In this way, using the hair texture map corresponding to each first model, rendering a group of hair strands corresponding to each first model as a layer, and superimposing the layers based on the positional relationship between the models and the transparency information corresponding to each pixel point in each first layer, so that in the obtained rendered image, the hair corresponding to multiple first models can be shown in multiple layers, achieving the purpose of enhancing the realistic effect.
[0012] In an alternative implementation, the hair model further includes: a second model for representing the hair roots;
[0013] Rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model includes:
[0014] Rendering the first model using the color texture map to obtain a first layer, and rendering the second model to obtain a second layer;
[0015] Based on the depth information of the first model and the second model relative to the virtual camera respectively, determining the superimposing order between the first layer and the second layer;
[0016] Superimposing the first layer and the second layer according to the superimposing order to generate the rendered image.
[0017] In this way, using two types of models, namely hair pieces and hair roots, to make hair, and superimposing and displaying multiple hair piece layers and hair root layers, avoiding the problem that the scalp can be rendered due to the transparency information of the hair texture map, and enhancing the authenticity of hair rendering.
[0018] In an alternative implementation, at positions of the first model far from the hair roots, a plurality of tips with angles less than a preset angle are formed;
[0019] Rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model, including:
[0020] Performing color rendering on the first model using the color texture map, and performing shadow rendering on the first model based on the light direction information and the position information of the first model to obtain a rendered image corresponding to the hair model.
[0021] In this way, the shadow projected by the rendering engine can be made to converge more and more at the tips and finally become a pointed hair projection effect, making the hair projection display more natural.
[0022] In an optional implementation, the hair model further includes a third model located at the hair tip and a color texture map corresponding to the third model; at positions of the third model far from the hair root, a plurality of tips with angles less than a preset angle are formed;
[0023] Rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model, including:
[0024] Rendering the first model using the color texture map corresponding to the first model to obtain a first layer corresponding to the first model; and
[0025] Performing color rendering on the third model using the color texture map corresponding to the third model, and performing shadow rendering on the third model based on the light direction information and the position information of the third model to obtain a third layer corresponding to the third model;
[0026] Based on the depth information of the first model and the third model relative to the virtual camera respectively, superimposing the first layer and the third graphic to obtain the rendered image.
[0027] In this way, a digital human hair model closer to real hair and a more realistic hair shadow effect can be achieved by making a hair model with three types of models: hair tips, hair strands, and hair roots.
[0028] In an optional implementation, rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model, including:
[0029] Determining target specular effect information corresponding to the hair model based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model; the target specular effect information is used to characterize the specular degree corresponding to each vertex in the hair model;
[0030] Based on the target highlight effect information, determine the light intensity information corresponding to each vertex in the hair model;
[0031] Based on the light intensity information and the color map, render the hair model to generate a rendered image corresponding to the hair model.
[0032] In this way, the renderer will calculate the position of the highlight on the model according to the angle between the light and the model normal, and cooperate with the hand-drawn color map in the present disclosure to render the hair model, and render a more realistic digital human hair in real time.
[0033] In an optional implementation manner, the hair map further includes: a first map for determining the lighting effect of the hair model;
[0034] The determining the light intensity information corresponding to each vertex in the hair model based on the target highlight effect information includes:
[0035] Perform a fusion process on the target highlight effect information and the first map to obtain the light intensity information corresponding to each vertex in the hair model.
[0036] In a real-time rendering engine, the renderer will calculate the position of the highlight on the model according to the angle between the light and the model normal. However, in this application, because the inner, middle, and outer layer model making logics are used, the inner layer model is blocked by the outer layer. Theoretically, it should not produce strong highlights, and the range that can produce highlights should also be significantly weaker than the outer layer model. Otherwise, visually, the inner layer reflection highlight will be seen from the outer layer, resulting in an incorrect rendering result. Therefore, use the first map for adjusting the highlight effect to perform a fusion process with the highlight information to achieve a better highlight effect.
[0037] In an optional implementation manner, the first map includes: a highlight range map and / or an ambient occlusion map;
[0038] Wherein, the pixel information of the pixel points in the highlight range map is used to indicate the difficulty of generating highlights at the corresponding positions on the hair model; among them, the highlight range maps corresponding to different first models are used to characterize that the difficulty of generating highlights of the first model located in the inner layer of the hair is higher than that of the first model located in the outer layer of the hair; the ambient occlusion map is used to characterize the light intensity occlusion characteristics corresponding to different depth positions of the hair model.
[0039] In this way, the highlight areas of each first model can be manually masked using the above-mentioned highlight range map to achieve a better highlight effect.
[0040] In addition, an ambient occlusion map can also be used to make the hair pieces (first model), hair roots (second model), and hair tips (third model) at different positions show different lighting effects under the illumination of light. The illumination intensity of the outer layer is greater than that of the middle layer, and the illumination intensity of the middle layer is greater than that of the inner layer, making the rendering effect of the hair more realistic.
[0041] In an alternative embodiment, the first map includes a specular range map and an ambient occlusion map;
[0042] The process of fusing the target specular effect information and the first map to obtain the illumination intensity information corresponding to each vertex in the hair model includes:
[0043] Perform bilinear interpolation on the specular range map and the ambient occlusion map to obtain an interpolated image;
[0044] Use the interpolated image to perform interpolation processing on the first specular effect information to obtain the illumination intensity information corresponding to each vertex in the hair model.
[0045] In this way, through the ambient occlusion map and the basic specular effect, the hair pieces (first model), hair roots (second model), and hair tips (third model) at different positions show different lighting and specular effects under the illumination of light. The illumination intensity of the outer layer is greater than that of the middle layer, and the illumination intensity of the middle layer is greater than that of the inner layer, making the rendering effect of the hair more realistic.
[0046] In an alternative embodiment, the hair map further includes: a normal map and a tangent perturbation map; wherein, the normal map is used to represent the surface concavo-convex features of the hair model; the tangent perturbation map is used to represent the uneven features of the specular area of the hair model in the hair extension direction;
[0047] The process of determining the target specular effect information corresponding to the hair model based on the illumination direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model includes:
[0048] Add the illumination direction and the virtual camera direction to obtain a specular range angle;
[0049] Perform a dot product operation on the specular range angle and the normal direction information of the model vertices included in the hair model to obtain the first specular effect information corresponding to the hair model;
[0050] Determine the second specular effect information corresponding to the hair model based on the specular range angle information, the normal map, and the tangent perturbation map;
[0051] Determine the target highlight effect information based on the first highlight effect information and the second highlight effect information.
[0052] Under normal circumstances, highlights will present a smooth and complete area effect, which will make the highlights of the hair form a ring. However, the highlights of real hair will have a scattered height difference along the extension direction of the hair strands. Therefore, the present disclosure uses a tangent perturbation map to perform normal perturbation on the normal map, and determines the highlight effect using the normal map after normal perturbation, so as to achieve the effect that the hair strand highlights have a height difference along the extension direction of the hair strands, making the highlight effect more natural.
[0053] In an optional implementation manner, the determining the second highlight effect information corresponding to the hair model based on the highlight range angle information, the normal map, and the tangent perturbation map includes:
[0054] Use the tangent perturbation map to adjust the pixel information of the target channel in the normal map to generate an adjusted target channel and an adjusted normal map including the adjusted target channel; wherein, the target channel is the channel in the normal map that controls the light extension angle of the hair.
[0055] Perform a dot product operation on the normal map and the highlight range angle to obtain the second highlight effect information corresponding to the hair model.
[0056] In this way, the final required light intensity information of each pixel can be determined through the highlight information and light information corresponding to each pixel point, achieving a more realistic rendering effect.
[0057] In a second aspect, an embodiment of the present disclosure further provides a rendering device, including:
[0058] An acquisition module, configured to acquire a hair model and a hair texture map corresponding to the hair model; the hair model includes: a plurality of first models located at different positions on the head; each of the first models is generated by modeling a hair piece formed by multiple hairs at the corresponding position; the hair texture map includes: a color texture map generated for each of the first models and used to represent the colors of multiple hairs at the corresponding position; the color texture map includes: a plurality of color channels and an alpha channel; the value of each pixel point in the alpha channel of the color texture map is used to represent the transparency information of the pixel point.
[0059] A generation module, configured to render the hair model using the hair texture map to generate a rendered image corresponding to the hair model.
[0060] In an alternative embodiment, when the generating module renders the hair model using the hair texture map to generate a rendered image corresponding to the hair model, it is configured to:
[0061] For each of the multiple first models, render the first model using the hair texture map corresponding to the first model to generate a first layer corresponding to the first model and transparency information corresponding to each pixel point in the first layer;
[0062] Based on the depth information of the multiple first models relative to the virtual camera respectively and the transparency information corresponding to each pixel point in the first layer, stack the first layers corresponding to the multiple first models respectively to obtain the rendered image.
[0063] In an alternative embodiment, the hair model further includes: a second model for characterizing the hair roots;
[0064] When the generating module renders the hair model using the hair texture map to generate a rendered image corresponding to the hair model, it is configured to:
[0065] Render the first model using the color texture map to obtain a first layer, and render the second model to obtain a second layer;
[0066] Based on the depth information of the first model and the second model relative to the virtual camera respectively, determine the stacking order between the first layer and the second layer;
[0067] Stack the first layer and the second layer according to the stacking order to generate the rendered image.
[0068] In an alternative embodiment, at positions in the first model far from the hair roots, a plurality of tips with angles less than a preset angle are formed;
[0069] When the generating module renders the hair model using the hair texture map to generate a rendered image corresponding to the hair model, it is configured to:
[0070] Perform color rendering on the first model using the color texture map, and perform shadow rendering on the first model based on the light direction information and the position information of the first model to obtain the rendered image corresponding to the hair model.
[0071] In an alternative embodiment, the hair model further includes a third model located at the hair tips and a color texture map corresponding to the third model; at positions in the third model far from the hair roots, a plurality of tips with angles less than a preset angle are formed;
[0072] When using the hair texture map to render the hair model and generate a rendered image corresponding to the hair model, the generating module is configured to:
[0073] Render the first model using the color texture map corresponding to the first model to obtain a first layer corresponding to the first model; and
[0074] Render the third model using the color texture map corresponding to the third model, and perform shadow rendering on the third model based on the light direction information and the position information of the third model to obtain a third layer corresponding to the third model;
[0075] Overlay the first layer and the third layer based on the depth information of the first model and the third model relative to the virtual camera respectively to obtain the rendered image.
[0076] In an alternative embodiment, when using the hair texture map to render the hair model and generate a rendered image corresponding to the hair model, the generating module is configured to:
[0077] Determine target specular effect information corresponding to the hair model based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model; the target specular effect information is used to characterize the specular degree corresponding to each vertex in the hair model;
[0078] Determine light intensity information corresponding to each vertex in the hair model based on the target specular effect information;
[0079] Render the hair model based on the light intensity information and the color texture map to generate a rendered image corresponding to the hair model.
[0080] In an alternative embodiment, the hair texture map further includes: a first texture map for determining the lighting effect of the hair model;
[0081] When determining the light intensity information corresponding to each vertex in the hair model based on the target specular effect information, the generating module is configured to:
[0082] Perform a fusion process on the target specular effect information and the first texture map to obtain the light intensity information corresponding to each vertex in the hair model.
[0083] In an alternative embodiment, the first texture map includes: a specular range texture map and / or an ambient occlusion texture map;
[0084] Among them, the pixel information of the pixel points in the highlight range map is used to indicate the difficulty of generating highlights at the corresponding position on the hair model; wherein the highlight range maps corresponding to different first models are used to characterize the difficulty of the first model located in the inner layer of the hair to generate highlights, which is higher than the difficulty of the first model located in the outer layer of the hair to generate highlights; the ambient light occlusion map is used to characterize the light intensity occlusion characteristics of the hair model corresponding to different depth positions.
[0085] In an optional implementation, the first map includes a highlight range map and an ambient occlusion map;
[0086] The generating module, when fusing the target highlight effect information and the first map to obtain the illumination intensity information corresponding to each vertex in the hair model, is used to:
[0087] Performing bilinear interpolation on the highlight range map and the ambient occlusion map to obtain an interpolated image;
[0088] The first highlight effect information is interpolated using the interpolation image to obtain illumination intensity information corresponding to each vertex in the hair model.
[0089] In an optional embodiment, the hair map further includes: a normal map and a tangent disturbance map; wherein the normal map is used to characterize the surface concave-convex features of the hair model; and the tangent disturbance map is used to characterize the uneven features of the highlight area of the hair model in the extension direction of the hair;
[0090] The generating module, when determining the target highlight effect information corresponding to the hair model based on the illumination direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model, is used to:
[0091] Add the illumination direction and the virtual camera direction to obtain a highlight range angle;
[0092] Performing dot product processing on the highlight range angle and normal direction information of the model vertices included in the hair model to obtain first highlight effect information corresponding to the hair model;
[0093] Determining second highlight effect information corresponding to the hair model based on the highlight range angle information, the normal map, and the tangent disturbance map;
[0094] The target highlight effect information is determined based on the first highlight effect information and the second highlight effect information.
[0095] In an alternative embodiment, when determining the second specular effect information corresponding to the hair model based on the specular range angle information, the normal map, and the tangent perturbation map, the generating module is configured to:
[0096] Use the tangent perturbation map to adjust the pixel information of the target channel in the normal map, and generate an adjusted target channel and an adjusted normal map including the adjusted target channel; wherein the target channel is the channel in the normal map that controls the extension angle of light on the hair;
[0097] Perform a dot product operation on the normal map and the specular range angle to obtain the second specular effect information corresponding to the hair model.
[0098] In a third aspect, an alternative implementation of the present disclosure further provides a computer device, including a processor and a memory. The memory stores machine-readable instructions executable by the processor. The processor is configured to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the machine-readable instructions execute the steps in the first aspect or any possible implementation manner in the first aspect.
[0099] In a fourth aspect, an alternative implementation of the present disclosure further provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is run, it executes the steps in the first aspect or any possible implementation manner in the first aspect.
[0100] For the effect description of the above rendering device, computer device, and computer-readable storage medium, refer to the description of the above rendering method, which will not be elaborated here.
[0101] To make the above objects, features, and advantages of the present disclosure more obvious and understandable, the following specific embodiments are given, and in conjunction with the accompanying drawings, the detailed description is as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0102] To more clearly illustrate the technical solutions of the embodiments of the present disclosure, the accompanying drawings required for the embodiments will be briefly introduced below. The accompanying drawings are incorporated into the specification and constitute a part of the specification. These drawings show embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only show some embodiments of the present disclosure and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0103] Figure 1Shows a flowchart of a rendering method provided by an embodiment of the present disclosure;
[0104] Figure 2 Shows a specific example of a hair model composed of multiple first models provided by an embodiment of the present disclosure;
[0105] Figure 3 Shows a specific example of the rendering relationship between a color map and a first model provided by an embodiment of the present disclosure;
[0106] Figure 4 Shows a specific example of the target rendering result of a hair model provided by an embodiment of the present disclosure;
[0107] Figure 5 Shows a specific example of the shadow shape of a hair model provided by an embodiment of the present disclosure;
[0108] Figure 6 Shows a specific example of the corresponding shadow shape after rendering a hair model with a tip provided by an embodiment of the present disclosure;
[0109] Figure 7 Shows a specific example of the rendering effect when only the first model exists provided by an embodiment of the present disclosure;
[0110] Figure 8 Shows a specific example of a second model provided by an embodiment of the present disclosure;
[0111] Figure 9 Shows a specific example of the relative relationship between a first model and a second model represented by the superposition of a first layer and a second layer provided by an embodiment of the present disclosure;
[0112] Figure 10 Shows a schematic diagram of the light propagation direction provided by an embodiment of the present disclosure;
[0113] Figure 11 Shows a specific example of a specular range map provided by an embodiment of the present disclosure;
[0114] Figure 12 Shows a specific example of an ambient occlusion map provided by an embodiment of the present disclosure;
[0115] Figure 13 Shows a specific example of a specular rendering effect provided by an embodiment of the present disclosure;
[0116] Figure 14 Shows a specific example of the staggered feature of the specular region in the vertical direction in a hair model provided by an embodiment of the present disclosure;
[0117] Figure 15The figure shows a schematic diagram of a rendering device provided by an embodiment of the present disclosure;
[0118] Figure 16 The figure shows a schematic diagram of a computer device provided by an embodiment of the present disclosure. Detailed implementation manners
[0119] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part rather than all of the embodiments of the present disclosure. Components of the embodiments of the present disclosure described and illustrated herein generally may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the claimed present disclosure, but merely represents selected embodiments of the present disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without creative efforts shall fall within the scope of protection of the present disclosure.
[0120] Through research, it is found that the production cost of hyper-realistic style character figures (hereinafter referred to as digital humans) is extremely high, and it is very difficult to smoothly render the art assets produced by the traditional digital human production process on mobile platforms. In the production of digital humans, the performance of digital human hair accounts for nearly half of the overall rendering pressure of digital humans. In order to handle the hair of digital humans well, usually each hair is modeled; and the model is usually formed by vertices and patches connecting the vertices to each other; the more models there are, the more patches are formed; this makes the hair model use a very high number of model faces; such a hair model requires a large amount of computing resources to render the hair model during the rendering process. Even when rendering the hair model on a personal computer (PC) side, it is difficult to ensure the rendering efficiency and effect; and it is even more unbearable for mobile devices with limited computing power.
[0121] In addition, in the currently emerging live broadcast industry, digital human anchors have become an increasingly popular display image for anchors during live broadcasts. It is a common situation for an anchor to interact with the audience during a live broadcast. However, the traditional digital human production method relies on expensive rendering equipment to spend a long time for offline rendering, which is impossible to achieve during the live broadcast process on mobile devices. Digital humans during the live broadcast process on mobile devices rely more on the real-time rendering of the mobile device processor. In order to achieve real-time rendering on mobile devices, usually the rendering effect is greatly sacrificed to ensure the real-time rendering frame rate and interactive fluency, which results in the digital human not being close to the appearance of real humans at all, and greatly reducing the live broadcast effect of the digital human.
[0122] Based on the above research, the present disclosure provides a rendering method. By understanding the structure of hair as a grouped concept, instead of creating a model for each individual hair, the model is hierarchically created in groups of dozens of hairs, and then combined with more hand-drawn functional hair texture maps to optimize the rendering effect of the digital human hair. With this method, it replaces the hair model rendering method of rendering all hairs one by one, reduces the computing power required during hair rendering, lowers the computing power requirements for the device, and enables real-time rendering of digital humans on mobile devices with high-quality rendering effects.
[0123] In addition, when using the hair model rendering method of rendering all hairs one by one, the number of faces of a hair model is at least close to the order of 100,000, while using the present disclosure to create a digital human hair model, the number of faces can be freely controlled according to requirements. In the present disclosure, using about 12,000 faces can achieve a good sense of hairstyle volume.
[0124] Regarding the defects existing in the above solutions, they are all the results obtained by the inventors after practice and careful research. Therefore, the process of discovering the above problems and the solutions proposed by the present disclosure for the above problems in the following text should be the contributions made by the inventors to the present disclosure during the process of the present disclosure.
[0125] It should be noted that: similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0126] To facilitate the understanding of this embodiment, first, a rendering method disclosed in the embodiments of the present disclosure will be introduced in detail. The execution subject of the rendering method provided in the embodiments of the present disclosure is generally a computer device with certain computing capabilities. Such a computer device includes, for example: a terminal device or a server or other processing devices. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementation manners, the rendering method can be implemented by a processor invoking computer-readable instructions stored in a memory.
[0127] In addition, the present disclosure aims to provide a rendering method, so the rendering software used in the specific execution process is not limited in the present disclosure. The method described in the present disclosure can also be applied to different scenarios, for example: offline rendering of digital human hair, and real-time rendering of digital human hair on mobile devices.
[0128] The rendering method provided in the embodiments of the present disclosure will be described below.
[0129] See Figure 1 As shown, it is a flowchart of the rendering method provided by an embodiment of the present disclosure. The method includes steps S101 to S102, where:
[0130] S101: Obtain a hair model and a hair texture map corresponding to the hair model.
[0131] The hair model includes: a plurality of first models located at different positions on the head; each of the first models is generated by modeling a hair piece formed by multiple hairs at the corresponding position; the hair texture map includes: a color texture map generated for each of the first models and used to represent the colors of multiple hairs at the corresponding position; the color texture map includes: a plurality of color channels and an alpha channel; the value of each pixel point in the alpha channel of the color texture map is used to represent the transparency information of the pixel point.
[0132] In a specific implementation, multiple hairs can be divided into a group, and each group of hairs can form a hair piece. Modeling is performed for each hair piece to obtain a first model corresponding to each hair piece. The first model includes a plurality of vertices; the plurality of vertices are connected to each other to form a patch, thereby forming the surface of the first model. As Figure 2 shown, a specific example of a hair model is provided. In this example, a plurality of first models are shown, and the plurality of first models are located at different positions on the head, so as to be able to represent the hairstyle of the entire hair.
[0133] The hair texture map includes a color texture map drawn for the first model and capable of representing the colors of hair strands.
[0134] Exemplarily, the three color channels of the color texture map respectively include: Red (R), Green (G), and Blue (B) color channels (hereinafter referred to as R, G, and B). Additionally, in its alpha channel, if the corresponding pixel point is a pixel point on the hair, the transparency value corresponding to the pixel point is used to represent that the transparency of the pixel point is relatively low or completely opaque; if the corresponding pixel point does not belong to the pixel points corresponding to the hair, the transparency value corresponding to the pixel point is used to represent that the transparency of the pixel point is relatively high or completely transparent. As Figure 3 shown, a specific example of a hair texture map is provided; in this example, the corresponding relationship between the hair texture map and the corresponding first model is also shown. The position representing the hair in the hair texture map does not cover the entire surface of the first model, but only covers a part of it;
[0135] The hair model and the hair texture map can be pre-made and stored in a preset storage space; when a rendering task for the hair model needs to be executed, the hair model and the corresponding hair texture map are read from the preset storage space.
[0136] In another alternative embodiment of the present disclosure, the hair model may include: a first model made based on hair pieces, and a second model made based on hair roots, and the first model may be used to represent the hair piece part. Since the hair may be composed of multiple groups of hair pieces, there may be multiple first models.
[0137] In another alternative embodiment of the present disclosure, the hair model may be divided into two layers: a first model made based on hair pieces, and a third model made based on hair tips.
[0138] In another alternative embodiment of the present disclosure, the hair model may also be three layers, including: a first model made based on hair pieces, a second model made based on hair roots, and a third model made based on hair tips.
[0139] The color map includes: multiple color channels, and a transparency channel; the value of each pixel point in the transparency channel of the color map is used to represent the transparency information of the pixel point.
[0140] Continuing from the above S101, the rendering method provided by the embodiments of the present disclosure further includes:
[0141] S102: Render the hair model using the hair map to generate a rendered image corresponding to the hair model.
[0142] A1: For the case where the hair model includes: the first model.
[0143] In an alternative embodiment, for each of the multiple first models, use the hair map corresponding to the first model to render the first model to generate a first layer corresponding to the first model, and transparency information corresponding to each pixel point in the first layer;
[0144] Based on the depth information of the multiple first models relative to the virtual camera respectively, and the transparency information corresponding to each pixel point in the first layer respectively, stack the first layers corresponding to the multiple first models respectively to obtain the rendered image.
[0145] In a specific implementation, each layer is composed of many pixel points. When multiple layers are stacked, the layer with a smaller depth is located at the front end of the stack, and the layer with a larger depth is located at the back end of the stack; the mutual stacking between the layers constitutes the rendered image. Here, the front end and the back end refer to the positions of the layers indicated by the depth relative to the virtual camera; the closer to the virtual camera, it is called the front end; the farther from the virtual camera, it is called the back end.
[0146] Among them, the virtual camera presents a three-dimensional virtual world by controlling one or more lenses. The lens system for electronic games aims to show actions from the best angles; generally speaking, these lenses are used in three-dimensional virtual worlds that require a third-person perspective. After finding a suitable lens, the orientation and rotation angle of the lens of the virtual camera can be obtained, and the relevant data can be provided to the graphic engine renderer to generate a view.
[0147] In a specific implementation, as Figure 4 shown, the final rendering effect to be achieved is very close to real human hair. And as Figure 3 shown, the actual model is not generated one by one through traditional hair generation methods, but in groups of hair. Thus, a hair piece formed by a group of hair is modeled to form a first model. In the composition of the hair model, the first model as its component part can be multiple groups. In order to make the rendered hair more realistic and natural, the hair texture maps corresponding to the first models in different positions can be different. After multiple first models are rendered based on their corresponding hair texture maps to generate corresponding first layers, the first layers include the hair drawn in the texture maps, and the positional relationship between multiple first layers can be determined by the depth information of multiple first models relative to the virtual camera.
[0148] In addition, when making a hair model through multiple first models, to make the hair model formed by multiple first models close to real hair, since the hair itself has different lengths and shapes, the multiple first models used need to show different shapes. Additionally, since the hair drawn in the hair texture map corresponding to each first model should not completely block the hair located in the inner layer visually, that is, the hair corresponding to the first model located in the inner layer will be rendered through the first model located in the outer layer visually.
[0149] To achieve the above effects, during the process of rendering the first model using the hair texture map, there is a corresponding relationship between the vertices of the first model and the pixel points of the hair texture map; according to this corresponding relationship, in addition to determining corresponding color, texture and other information for the vertices of each first model, the transparency values corresponding to the vertices of each first model are also determined using the values of each pixel point in the transparency channel of the hair texture map. Then the first layer is generated using the rendered first model; the pixel values of each pixel point in this first layer have, in addition to the color value, a transparency value, which is used to represent whether the position corresponding to this pixel point is transparent.
[0150] Then, by using the transparency information corresponding to each pixel point in the first layer, the first layers corresponding to each first model are superimposed, so that the hair strands in the first layer corresponding to the first model located inside the hair can be rendered through the first model located outside the hair, thereby achieving a realistic rendering effect.
[0151] Exemplarily, as Figure 2 shown, the entire hair model can be composed of multiple first models superimposed at the same position on the head. When the picture presented by the virtual camera is Figure 2 the picture shown, the depth information corresponding to the first model located on the side and the first model located behind the head in the hair model can be obtained. Based on this depth information, the first layers corresponding to different first models can be superimposed together. In the case where no transparency information is set, the hair corresponding to the first model located inside will be blocked by the first model located outside and cannot be displayed; after setting the transparency channel for the color map corresponding to each first model, during the rendering process, the positions in the first model located outside that do not include hair strands can be made transparent, thereby obtaining the first layer with transparency information; the hair strands in the first layer located at the back end can be rendered through the positions with less transparency in the first layer located at the front end, thereby presenting the rendering effect as shown in Figure 4.
[0152] The above rendering process, that is, the rendering of the hair strands corresponding to the first model located inside is realized through the way of semi-transparent rendering; semi-transparent rendering means that according to the intensity of the transparent information expressed on the color map, transparent processing is performed, and the final rendering transparency degree can be determined according to the intensity of the map drawing. In the present disclosure, it is used to make parts such as hair roots, hair tips, and stray hairs. For example, if you want to achieve an effect similar to real human hair, some pixel points need to be made transparent to achieve the above rendering effect.
[0153] In an optional implementation manner, when performing the overlay of the hairpiece layers, since the hair strands themselves are not a whole texture arranged one by one, as described above, the hair strands are arranged in groups. In order to be closer to the effect of real human hair, the UV overlapping method can be used to overlap several groups of hair strands, and then the positions of the repeated UV models are shuffled, so that no repeated hair strands will appear visually. Inevitably, there will be a situation where the internal scalp of the model can be seen due to the overlap of the transparent areas, which will make the hair look "thin" and "less hair volume" as a whole. The present disclosure uses an additional second model to solve the above problems, which will be specifically described below.
[0154] Among them, "UV" in 3D modeling can be understood as the "skin" of a 3D model. The "skin" is unfolded and then drawn on a 2D plane and assigned to an object. "UV" here refers to the abbreviation of u, v texture mapping coordinates (which is similar to the X, Y, Z axes of the spatial model). It defines the information of the position of each point on the picture. These points are related to the 3D model to determine the position of the surface texture mapping. UV is to accurately correspond each point on the image to the surface of the model object. The software performs image smoothing interpolation processing at the gap positions between points. This is the so-called UV mapping. The so-called UV overlapping means overlapping the above-mentioned UV mapping.
[0155] Exemplarily, in the production of hair strands, it is necessary to draw hair strand details on each patch. The method adopted in the present disclosure is to overlap the uvs of a part of the patches together and draw hair strands in this area, which is equivalent to drawing hair strands on each patch of this part at the same time. However, because if the repetition degree is too high, each group of hair strands will appear the same, so it is necessary to overlap several more groups and draw different hair strands in each group. When performing these grouped overlaps, if multiple groups in the same part are overlapped, there will still be a sense of repetition of hair strands. Therefore, it is necessary to disrupt these overlapping UVs and try not to overlap too many UVs in one group near the same part.
[0156] In an optional implementation manner, when performing model rendering, it is necessary to render the light and shadow effects. And the shadow projected by the model is an important part of the light and shadow effect rendering. In the hair rendering method provided by the embodiments of the present disclosure, a texture map with transparency information is used to achieve the rendering effect of hair strands. Essentially, the first model is a three-dimensional structure with a relatively large volume. And when the engine calculates the model shadow, it projects according to the shape of the model. This will cause the problem of the shadow shape as shown in Figure 5 Since essentially the surfaces of the model will be connected into a sheet, the projection is actually a complete sheet-like projection effect, rather than the effect of the hair strand projections drawn in the texture map, which further leads to a decrease in the authenticity of the rendering effect. The solution of the present disclosure is to form a plurality of tips at positions far from the hair roots in the first model, and the angles of the tips are less than a preset angle.
[0157] When rendering the first model, shadow rendering will also be performed based on the first model to obtain the rendering image corresponding to the hair model.
[0158] Among them, the shadow rendering is to simulate the light and dark degree generated by the light source irradiating the model, and output it in grayscale or color tones to obtain tones that vary approximately continuously with the light intensity, achieve the sensitivity contrast of different positions of the model, make the model have a certain three-dimensional sense, and intuitively express the changes of different positions of the model.
[0159] In this way, when the tip of the first model is shaded, the resulting projection will be like the projection of real hair strands, presenting a shadow effect with dispersed hair strands, thereby enhancing the realism during the hair rendering process.
[0160] Exemplarily, as Figure 6 shown, at the ends of the hair patches, the vertex distribution of each patch can be processed to make the hair tips as "sharp" as possible. At this time, the shadow projected by the engine is that the ends gradually converge and finally become a sharp shape. The irregular area drawn in the figure is the model area. After processing the fixed-point distribution of the patches, a natural shadow effect can be presented. For the surrounding area, the transparency information of the pixel points in the color map mentioned above can be used to make the area without hair transparent.
[0161] A2: For the case where the hair model includes: a first model and a second model.
[0162] During the rendering process, since the rendering process of the first model is achieved by using the transparency information in the color map; this rendering process will cause the rendered image to directly see the scalp background color through the hair when the number of the first models is insufficient; this will lead to a visual "airy feeling" or a visual effect of less hair volume in the rendering result of the hair, thereby causing the problem of reduced realism in hair rendering, as Figure 7 shown, which shows a specific example of the visual "airy feeling" when only the first model is rendered without including the second model.
[0163] To solve this problem, in the embodiments of the present disclosure, the hair roots will also be modeled to obtain a second model. The second model is located on the side of the first model close to the scalp. In this way, during the rendering process, for the part where the scalp background color can be directly seen through the hair, it will be blocked by the second model corresponding to the hair roots, thereby eliminating the visual "airy feeling" or the effect of less hair volume.
[0164] In a specific implementation, when making the second model, it can be to uniformly model the hair roots of the entire scalp to generate a model corresponding to the hair roots of the entire scalp. During the rendering process, the second model will be rendered to obtain a second layer representing the hair roots; among them, when the second model is a whole modeling of all hair roots, there is one second layer; then, based on the depth information of the first model and the second model relative to the virtual camera respectively, determine the stacking order between the first layer and the second layer; according to the stacking order, stack the first layer and the second layer to generate the rendered image.
[0165] As Figure 8As shown, a specific example of the second model is provided; after superimposing the first layer corresponding to the first model and the second layer corresponding to the second model, the resulting effect is as Figure 9 shown.
[0166] In addition, the method of using hair roots plus hair extensions to make hair models will achieve a more three-dimensional and natural effect compared to making them solely with hair extensions. These two methods are also applicable to the real-time rendering of mobile digital human hair and can be selected according to requirements during specific use.
[0167] A3: For the case where the hair model includes: a first model, a second model, and a third model.
[0168] In an optional implementation, the hair can be divided into three layers by level: hair tips, hair extensions, and hair roots; for the above-mentioned hair tips, a third model is constructed, for the hair extensions, a first model is constructed, and for the hair roots, a second model is constructed.
[0169] In a specific implementation, after multiple second models are rendered based on their corresponding hair texture maps to generate corresponding second layers, the second layers are layers representing hair roots. After multiple first models are rendered based on their corresponding hair texture maps to generate corresponding first layers, the first layers are hair extension layers, and the positional relationship between multiple hair extension layers can be determined by the depth information of multiple first models relative to the virtual camera. The hair model further includes a third model located at the hair tips; the hair texture map further includes: a color map corresponding to the third model; at positions of the third model far from the hair roots, multiple tips with angles less than a preset angle are formed; after multiple hair tip models are rendered based on their respective corresponding hair texture maps to generate corresponding third layers; the positional relationship between multiple third layers can be determined by the depth information of multiple third models relative to the virtual camera.
[0170] The color map corresponding to the third model can be used to perform color rendering on the third model, and based on the light direction information and the position information of the third model, shadow rendering is performed on the third model to obtain a third layer corresponding to the third model.
[0171] Among them, the rendering method of the third layer is similar to that of the first layer and will not be elaborated here.
[0172] After obtaining multiple first layers and multiple third layers, the positional relationship between different layers can be determined based on their respective corresponding depth information, and based on this positional relationship, different layers are superimposed to obtain the rendered image.
[0173] Among them, the shadow rendering of the third layer can perform the same process as the shadow rendering of the first layer above, which will not be elaborated here.
[0174] Exemplarily, in the case where the hair model is divided into hair slices, hair roots, and hair tips to make corresponding models respectively, with the head as a reference, the positional relationship among the three types of models can be such that the third model corresponding to the hair tip is in the outermost layer, the first model is in the middle layer, and the second model is in the innermost layer. The position information of each model during rendering can be determined by a virtual camera. The virtual camera can determine the corresponding depth information for each model based on its different position, and based on this depth information, the overlay of the corresponding layers after model rendering can be performed.
[0175] A4: For the case where the hair model includes the first model and the third model, the rendering of the third model to obtain the rendering of the third layer is similar to A3 above and will not be elaborated here.
[0176] At this time, the first layer and the third layer can be overlaid according to the depth information to obtain a rendered image. The specific overlay method is similar to the overlay method of the first layer and the second layer above and will not be elaborated here.
[0177] Through the above A3 or A4, it is also possible to achieve a shadow effect with a relatively high degree of authenticity when rendering the hair.
[0178] When using a hair texture map to render a hair model to generate a rendered image corresponding to the hair model, for example, the following method can be adopted:
[0179] Based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model, determine the target highlight effect information corresponding to the hair model; the target highlight effect information is used to represent the highlight degree corresponding to each vertex in the hair model;
[0180] Based on the target highlight effect information, determine the light intensity information corresponding to each vertex in the hair model;
[0181] Based on the light intensity information and the color texture map, render the hair model to generate a rendered image corresponding to the hair model.
[0182] In a specific implementation, when determining the target highlight effect information corresponding to the hair model based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model, for example, any one of the following B1 or B2 can be adopted but is not limited to:
[0183] B1: Add the light direction and the virtual camera direction to obtain a highlight range angle; perform a dot product operation on the highlight range angle and the normal direction information of the model vertices included in the hair model to obtain the target highlight effect information corresponding to the hair model.
[0184] Among them, the light direction refers to the direction in which light is applied within the model space where the hair model is located; the virtual camera direction refers to the "observation" direction of the hair model within the model space. The shooting field of view of the virtual camera, that is, the "observation" field of view of the hair model.
[0185] For the light direction, in the embodiments of the present disclosure, a specific method for determining the light direction is also provided. Specifically, the light source position information of the target light source in the model coordinate system corresponding to the hair can be determined, and then based on the light source position information, the light direction corresponding to the hair model can be determined.
[0186] Exemplarily, as Figure 10 shown, where L points to the incident light ray, N is the normal vector, and R is the reflected light. When viewed from the observation direction V, as the angle α increases, the light intensity caused by this light will decrease rapidly. Based on this method, the first highlight effect information can be determined.
[0187] Among them, the target light source may include a virtual light source. When determining the light direction of the target light source, since the light direction specifically affects the lighting effect of the hair, the relative position relationship between the target light source and the hair model is involved. Thus, in order to more accurately determine the light direction, a corresponding model coordinate system can be established based on the hair model, and the light source position information of the target light source can be determined under this model coordinate system. In this way, for the target light source and the hair model in the same model coordinate system, the relative position relationship between the target light source and the hair model can be accurately determined, so that the light direction corresponding to the hair can be determined.
[0188] In the case of determining the light direction, for each vertex among multiple vertices, the dot product operation can be performed using the normal direction corresponding to each vertex and the light direction to obtain the highlight effect information corresponding to each vertex. In this way, by determining the highlight effect information corresponding to multiple vertices respectively, the lighting model can be obtained. Here, the highlight effect information corresponding to each vertex reflected by the lighting model can specifically reflect whether there is a highlight after rendering and displaying for each vertex, and if there is a vertex in the highlight area after rendering and displaying, whether the corresponding highlight color is darker or lighter.
[0189] B2: The hair texture map further includes: a normal map and a tangent perturbation map; among them, the normal map is used to characterize the surface concavo-convex features of the hair model; the tangent perturbation map is used to characterize the uneven features of the highlight area of the hair model in the hair extension direction;
[0190] Determining the target specular effect information corresponding to the hair model based on the illumination direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model includes:
[0191] Adding the illumination direction and the virtual camera direction to obtain a specular range angle;
[0192] Performing a dot product operation on the specular range angle and the normal direction information of the model vertices included in the hair model to obtain the first specular effect information corresponding to the hair model;
[0193] Determining the second specular effect information corresponding to the hair model based on the specular range angle information, the normal map, and the tangent perturbation map;
[0194] Determining the target specular effect information based on the first specular effect information and the second specular effect information.
[0195] Among them, the determination method of the first specular effect information is the same as the determination method of the target specular effect information in B1 above (that is, in the corresponding embodiment of B1, the first specular effect information in B2 is used as the target specular effect information in B1), which will not be elaborated here.
[0196] In a specific implementation, as Figure 13 shown, by default, the specular highlights will present a smooth and complete area effect, making the specular highlights of the hair form a ring. For real human hair, although the general shape of the specular highlights is ring-shaped, in detail, there should still be uneven height differences according to the direction of the hair strands. Therefore, when fusing the first specular effect information and the specular range map to obtain the illumination intensity information corresponding to each vertex in the hair model, the second specular effect information can also be added to obtain a more realistic hair model effect.
[0197] In determining the second specular effect information corresponding to the hair model based on the specular range angle information, the normal map, and the tangent perturbation map, for example, the following method can be adopted:
[0198] Using the tangent perturbation map to adjust the pixel information of the target channel in the normal map to generate an adjusted target channel and an adjusted normal map including the adjusted target channel; where the target channel is the channel in the normal map that controls the angle of light extension in the hair; performing a dot product operation on the normal map and the specular range angle to obtain the second specular effect information corresponding to the hair model.
[0199] In a specific implementation, as Figure 14As shown, it is necessary to perform a certain perturbation on this high - light area to achieve a jagged and realistic high - light effect. This disclosure uses the effect of tangent - space perturbation to perturb the normal of the high - light range. The specific approach is as follows: The normal in tangent space usually stores most of the bump information in terms of the value on the X - axis and the value on the Y - axis, while the value on the Z - axis is basically a protrusion towards the outside. The high - light effect required by this disclosure is an up - and - down offset effect in the vertex coordinate system with the Y - axis as the direction. Then, a tangent - perturbation texture map can be used, that is, the high - light range of real hair is used as an offset value to blend the G (corresponding to the Y - axis) channel in the RGB channels of the normal map in the world coordinate system. The adjusted G channel is the channel in the normal map that controls the up - and - down angle of the light to achieve the effect of perturbing the Y - value coordinate in the normal space, and finally presents the uneven characteristics of the high - light area in the vertical direction in the hair model as shown in Figure 14 the hair model shown.
[0200] Exemplarily, the color of a texture map can be represented by the RGB three channels, and the three channels in the tangent - perturbation texture map can be regarded as the XYZ values of the tangent - space normal, that is, the normal information is represented by the XYZ three channels. Each individual channel is a grayscale map from 0 to 1. Based on this, we can use a grayscale map as the G channel and convert it into the coordinate value of the normal, that is, the coordinate value of the Y - axis. After mixing this coordinate value with the original value of the Y - axis, the value of the Y - axis is uneven, thereby achieving the perturbation effect.
[0201] After determining the first high - light effect information and the second high - light effect information based on the above - mentioned method, for example, the first high - light effect information and the second high - light effect information can be superimposed to obtain the target high - light effect information.
[0202] As can be seen from the above, the first high - light effect information represents the basic high - light information in the hair model, and the second high - light effect information is used to adjust the high - light effect to make the final high - light effect more realistic. After the two are superimposed, the target high - light effect information can be obtained, that is, the high - light effect information corresponding to each pixel point in multiple layers. The high - light range texture map is used to represent the vertex illumination intensity corresponding to each pixel point. By performing a fusion process on the target high - light effect information and the high - end range texture map, the illumination intensity information corresponding to each vertex in the final hair model is obtained.
[0203] Exemplarily, the hair model in the present disclosure is made in three layers. After generating and superimposing the layers by the layer generation method described above, it is necessary to adjust the lighting effect and specular effect of each layer. Among them, different specular range maps can represent the lighting intensity of different regions in the hair model. For example, the lighting intensity of the outermost layer is greater than that of the middle layer, and the lighting intensity of the middle layer is greater than that of the inner layer. Based on different specular range maps, the tip layer, strand layer, and root layer of different layers are illuminated. In the implementation of specular highlights, the specular effects corresponding to different layers are also different. The specular effect will change according to the lighting direction in the virtual scene and the virtual camera direction. After determining the area where specular rendering is required, the coordinate of the normal can be adjusted by the tangent perturbation method described above to achieve a staggered specular effect.
[0204] In another embodiment of the present disclosure, in order to make the lighting condition of the hair closer to reality, the hair texture provided in the embodiment of the present disclosure further includes: a first texture for determining the lighting effect of the hair model;
[0205] Determining the lighting intensity information corresponding to each vertex in the hair model based on the target specular effect information includes:
[0206] Performing a fusion process on the target specular effect information and the first texture to obtain the lighting intensity information corresponding to each vertex in the hair model.
[0207] Wherein, the first texture includes: a specular range map and / or an ambient occlusion map;
[0208] Wherein, the pixel information of the pixel points in the specular range map is used to indicate the difficulty of generating specular highlights at the corresponding position on the hair model; among them, the specular range maps corresponding to different first models are used to represent that the difficulty of generating specular highlights of the first model located in the inner layer of the hair is higher than that of the first model located in the outer layer of the hair; the ambient occlusion map is used to represent the lighting intensity occlusion characteristics corresponding to different depth positions of the hair model.
[0209] C1: For the case where the first texture includes: a specular range map:
[0210] In a specific implementation, in a real-time rendering engine, the renderer calculates the position of the specular highlight on the first model according to the angle between the light and the normal of the first model. However, in the embodiments of the present disclosure, due to the use of the model-making logic of the inner, middle, and outer layers, the first model located in the inner layer of the hair is blocked by the first model located in the outer layer of the hair, and strong specular highlights should not be generated; moreover, the range where specular highlights can be generated should also be significantly weaker than that of the outer layer, otherwise, specular highlights reflected from the inner layer will be seen from the outer layer, resulting in an incorrect rendering result. Therefore, in the embodiments of the present disclosure, a specular highlight range map is added to manually mask the specular highlight areas of each first model. And this specular highlight range map can also achieve a better specular highlight effect than the default rendering effect by artificially drawing some specular highlight features. For example, in a complete hair strand, strong specular highlights equivalent to those in the middle of the hair strand should not appear at the root and tip of the hair strand. The specular highlight range can be manually intervened through this specular highlight range map to achieve a better specular highlight effect.
[0211] In a specific implementation, the pixel information of the pixel points in the specular highlight range map is used to indicate the difficulty of generating specular highlights at the corresponding positions on the hair model.
[0212] In a specific implementation, there can be multiple first models in the hair model, and the multiple first models are in different positions. When the light in the virtual scene shines, different first models will produce different specular highlight effects; different specular highlight range maps can be used to characterize both the difficulty of generating specular highlights for the first models in the inner layer of the hair and the difficulty of generating specular highlights for the first models above the outer layer of the hair.
[0213] The specular highlight effect information of the hair model generated by the specular highlight range map is determined based on the light direction in the virtual scene, the virtual camera direction, and the normal direction information of the model vertices included in the hair model; the specular highlight effect information can be used to characterize the specular highlight degree corresponding to each vertex in the hair model.
[0214] In the case where the hair texture map includes a specular highlight range map, the following method can be used to render the hair model with the hair texture map to generate a rendered image corresponding to the hair model:
[0215] Based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model, determine the target specular highlight effect information corresponding to the hair model; the specular highlight effect information is used to characterize the specular highlight degree corresponding to each vertex in the hair model;
[0216] Perform a fusion process on the target specular highlight effect information and the specular highlight range map to obtain the light intensity information corresponding to each vertex in the hair model;
[0217] Render the hair model based on the light intensity information and the color map to generate a rendered image corresponding to the hair model.
[0218] In specific implementation, the determination method of the target specular effect information can be referred to as shown in B1 - B2 above, and will not be elaborated here.
[0219] When fusing the first specular effect information and the specular range map, for example, the following method can be adopted:
[0220] Perform interpolation processing on the first specular effect information and the specular range map to obtain the light intensity information corresponding to each vertex in the hair model.
[0221] As Figure 11 shown, a specific example of the specular range map is provided. In this example, it includes specular range information corresponding to multiple groups of hair. Among them, for Figure 11 a shown in, its corresponding first model is located on the outermost layer of the hair, so its specular range is relatively large; for Figure 11 b in, its corresponding first model is located in the inner layer of the hair, so its specular range is relatively small.
[0222] C2: When the first map includes: an ambient occlusion map:
[0223] Since the hair model in the embodiments of the present disclosure uses the basic production logic of three layers: inner, middle, and outer, if directly rendered, it will be found that due to the fact that the first model in the inner layer of the hair is completely transparent, the rendering engine cannot correctly recognize the effect that the light is weaker after the first model in the inner layer of the hair is blocked by the first model in the outer layer of the hair. In other words, the brightness is similar between the hair strand structures corresponding to different first models in the inner layer and the outer layer of the hair. This will result in the specular effect during hair rendering not conforming to the actual situation and affecting the final rendering effect. In order to correctly convey the light and shadow relationship between the first model structures at different levels to the engine, the hair map provided in the embodiments of the present disclosure also includes an ambient occlusion map. In the ambient occlusion map, the brightness information corresponding to the first models at different levels of the hair is manually drawn, that is, the light of the first model in the inner layer of the hair is darker than the light of the first model in the middle layer of the hair; the light of the first model in the middle layer of the hair is darker than the light of the first model in the outer layer of the hair.
[0224] Among them, the ambient occlusion map is used to characterize the light intensity occlusion characteristics corresponding to different depth positions of the hair model.
[0225] As Figure 12 shown, a specific example of the ambient occlusion map is provided. For Figure 12The ambient occlusion map shown in c, where the corresponding first model is located at the outermost layer of the hair, so the effect of using the ambient occlusion map for ambient occlusion is the weakest, that is, the light intensity is the highest; for Figure 12 The ambient occlusion map shown in d, where the corresponding first model is located in the middle layer of the hair, so the effect of using the ambient occlusion map for ambient occlusion is in the middle, that is, the light intensity is also in the middle; for Figure 12 The ambient occlusion map shown in e, where the corresponding first model is located in the innermost layer of the hair, so the effect of using the ambient occlusion map for ambient occlusion is the strongest.
[0226] When the hair texture includes an ambient occlusion map, when rendering the first model using the hair texture, for example, the following method can be adopted:
[0227] Based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model, determine the target specular effect information corresponding to the hair model; the specular effect information is used to characterize the specular degree corresponding to each vertex in the hair model;
[0228] Perform a fusion process on the target specular effect information and the ambient occlusion map to obtain the light intensity information corresponding to each vertex in the hair model;
[0229] Based on the light intensity information and the color texture, render the hair model to generate a rendered image corresponding to the hair model.
[0230] C3: When the first texture includes: a specular range texture and an ambient occlusion map:
[0231] When performing a fusion process on the target specular effect information and the first texture to obtain the light intensity information corresponding to each vertex in the hair model, for example, the following method can be adopted:
[0232] Perform bilinear interpolation on the specular range texture and the ambient occlusion map to obtain an interpolated image;
[0233] Use the interpolated image to perform interpolation processing on the first specular effect information to obtain the light intensity information corresponding to each vertex in the hair model.
[0234] In a specific implementation, mathematically, the bilinear interpolation is a linear interpolation extension of an interpolation function with two variables, and its core idea is to perform a linear interpolation in two directions respectively.
[0235] In a specific implementation, after obtaining the three layers through the method described above, each pixel in each layer has its corresponding lighting information. Among them, each pixel in the specular range map is used to represent the lighting intensity of the model vertex corresponding to that pixel, and the ambient occlusion map is used to represent the ambient occlusion situation corresponding to different regions in the hair model. Among them, in the inner layer of the hair model, the lower the lighting brightness, the stronger the corresponding ambient occlusion situation. The influence of the above two maps on each pixel in the layer can be regarded as the influence in two directions. Based on this, the method of bilinear interpolation can be used to obtain the interpolated image.
[0236] Exemplarily, if the lighting intensity value of each pixel in the finally obtained interpolated image is represented by the f(z) function, then the corresponding y value of each pixel can be obtained by using the function f(y) corresponding to the ambient occlusion map in the y direction, and the corresponding x value of each pixel can be obtained by using the function f(x) corresponding to the specular range map in the x direction. After determining the x value and y value corresponding to each pixel, linear calculation can be used to perform image interpolation to obtain an interpolated image composed of z values representing the lighting intensity information of each pixel.
[0237] In this way, when rendering and displaying the hair model, the rendering effect is closer to the real situation.
[0238] In the example of the present disclosure, by modeling a hair piece formed by multiple hairs, a first model located at different positions on the head is obtained, so that it is not necessary to build a model for each hair separately, reducing the number of models to be rendered during the rendering process; at the same time, using a hair texture map with transparency information to render the first model, so that the occlusion relationship between the first models does not affect the hair that should be "seen" from being rendered into the rendered image, thereby ensuring the hyper-realistic characteristics during the hair rendering process while reducing the computing power requirements.
[0239] Those skilled in the art can understand that in the above method of the specific implementation manner, the writing order of each step does not mean a strict execution order and does not constitute any limitation to the implementation process. The specific execution order of each step should be determined according to its function and possible internal logic.
[0240] Based on the same inventive concept, a rendering device corresponding to the rendering method is also provided in the embodiments of the present disclosure. Since the principle of solving problems by the device in the embodiments of the present disclosure is similar to the above rendering method of the embodiments of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0241] Refer to Figure 15 As shown, it is a schematic diagram of a rendering device provided by an embodiment of the present disclosure. The device includes: an acquisition module 151 and a generation module 152; wherein,
[0242] An acquisition module 151, configured to acquire a hair model and a hair texture map corresponding to the hair model; the hair model includes: a plurality of first models located at different positions on the head; each of the first models is generated by modeling a hair piece formed by multiple hairs at the corresponding position; the hair texture map includes: a color texture map generated for each of the first models and used to characterize the colors of multiple hairs at the corresponding position; the color texture map includes: a plurality of color channels and an alpha channel; the value of each pixel point in the alpha channel of the color texture map is used to characterize the transparency information of the pixel point.
[0243] A generation module 152, configured to render the hair model by using the hair texture map to generate a rendered image corresponding to the hair model.
[0244] In an optional implementation manner, when the generation module 152 renders the hair model by using the hair texture map to generate a rendered image corresponding to the hair model, it is configured to:
[0245] For each of the plurality of first models, render the first model by using the hair texture map corresponding to the first model to generate a first layer corresponding to the first model and transparency information corresponding to each pixel point in the first layer.
[0246] Based on the depth information of the plurality of first models relative to the virtual camera respectively and the transparency information corresponding to each pixel point in the first layer respectively, superimpose the first layers corresponding to the plurality of first models to obtain the rendered image.
[0247] In an optional implementation manner, the hair model further includes: a second model for characterizing the hair roots.
[0248] When the generation module 152 renders the hair model by using the hair texture map to generate a rendered image corresponding to the hair model, it is configured to:
[0249] Render the first model by using the color texture map to obtain a first layer, and render the second model to obtain a second layer.
[0250] Based on the depth information of the first model and the second model relative to the virtual camera respectively, determine the superimposition order between the first layer and the second layer.
[0251] Superimpose the first layer and the second layer according to the superimposition order to generate the rendered image.
[0252] In an alternative embodiment, at positions in the first model far from the hair roots, a plurality of tips with angles less than a preset angle are formed.
[0253] When the generating module 152 uses the hair texture map to render the hair model and generate a rendered image corresponding to the hair model, it is used for:
[0254] Performing color rendering on the first model using the color texture map, and performing shadow rendering on the first model based on the light direction information and the position information of the first model, to obtain the rendered image corresponding to the hair model.
[0255] In an alternative embodiment, the hair model further includes a third model located at the hair tips and a color texture map corresponding to the third model; at positions in the third model far from the hair roots, a plurality of tips with angles less than a preset angle are formed.
[0256] When the generating module 152 uses the hair texture map to render the hair model and generate a rendered image corresponding to the hair model, it is used for:
[0257] Rendering the first model using the color texture map corresponding to the first model to obtain a first layer corresponding to the first model; and
[0258] Performing color rendering on the third model using the color texture map corresponding to the third model, and performing shadow rendering on the third model based on the light direction information and the position information of the third model, to obtain a third layer corresponding to the third model;
[0259] Based on the depth information of the first model and the third model relative to the virtual camera respectively, superimposing the first layer and the third graphic to obtain the rendered image.
[0260] In an alternative embodiment, when the generating module 152 uses the hair texture map to render the hair model and generate a rendered image corresponding to the hair model, it is used for:
[0261] Based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model, determining the target specular effect information corresponding to the hair model; the target specular effect information is used to characterize the specular degree corresponding to each vertex in the hair model;
[0262] Based on the target specular effect information, determining the light intensity information corresponding to each vertex in the hair model;
[0263] Render the hair model based on the light intensity information and the color map to generate a rendered image corresponding to the hair model.
[0264] In an optional implementation, the hair map further includes: a first map for determining the lighting effect of the hair model;
[0265] When determining the light intensity information corresponding to each vertex in the hair model based on the target specular effect information, the generation module 152 is configured to:
[0266] Fuse the target specular effect information and the first map to obtain the light intensity information corresponding to each vertex in the hair model.
[0267] In an optional implementation, the first map includes: a specular range map and / or an ambient occlusion map;
[0268] Among them, the pixel information of the pixels in the specular range map is used to indicate the difficulty of generating specular highlights at the corresponding positions on the hair model; among them, the specular range maps corresponding to different first models are used to characterize that the difficulty of generating specular highlights for the first model located in the inner layer of the hair is higher than that of the first model located in the outer layer of the hair; the ambient occlusion map is used to characterize the light intensity occlusion characteristics corresponding to different depth positions of the hair model.
[0269] In an optional implementation, the first map includes a specular range map and an ambient occlusion map;
[0270] When the generation module 152 fuses the target specular effect information and the first map to obtain the light intensity information corresponding to each vertex in the hair model, it is configured to:
[0271] Perform bilinear interpolation on the specular range map and the ambient occlusion map to obtain an interpolated image;
[0272] Use the interpolated image to perform interpolation processing on the first specular effect information to obtain the light intensity information corresponding to each vertex in the hair model.
[0273] In an optional implementation, the hair map further includes: a normal map and a tangent perturbation map; wherein, the normal map is used to characterize the surface concavo-convex characteristics of the hair model; the tangent perturbation map is used to characterize the uneven characteristics of the specular highlight area of the hair model in the hair extension direction;
[0274] When determining the target specular effect information corresponding to the hair model based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model, the generating module 152 is configured to:
[0275] Add the light direction and the virtual camera direction to obtain a specular range angle;
[0276] Perform a dot product operation on the specular range angle and the normal direction information of the model vertices included in the hair model to obtain first specular effect information corresponding to the hair model;
[0277] Determine second specular effect information corresponding to the hair model based on the specular range angle information, the normal map, and the tangent perturbation map;
[0278] Determine the target specular effect information based on the first specular effect information and the second specular effect information.
[0279] In an optional implementation manner, when determining the second specular effect information corresponding to the hair model based on the specular range angle information, the normal map, and the tangent perturbation map, the generating module 152 is configured to:
[0280] Use the tangent perturbation map to adjust the pixel information of the target channel in the normal map, and generate an adjusted target channel and an adjusted normal map including the adjusted target channel; wherein the target channel is the channel in the normal map that controls the extension angle of light on the hair;
[0281] Perform a dot product operation on the normal map and the specular range angle to obtain second specular effect information corresponding to the hair model.
[0282] For the processing flow of each module in the device and the interaction flow between modules, reference may be made to the relevant descriptions in the above method embodiments, which will not be elaborated here.
[0283] This embodiment of the present disclosure further provides a computer device, as Figure 16 shown, which is a schematic structural diagram of the computer device provided by this embodiment of the present disclosure, including:
[0284] A processor 161 and a memory 162; the memory 162 stores machine-readable instructions executable by the processor 161, and the processor 161 is configured to execute the machine-readable instructions stored in the memory 162. When the machine-readable instructions are executed by the processor 161, the processor 161 executes the following steps:
[0285] Obtain a hair model and a hair texture map corresponding to the hair model; the hair model includes: a plurality of first models located at different positions on the head; each of the first models is generated by modeling a hair piece formed by multiple hairs at the corresponding position; the hair texture map includes: a color texture map generated for each of the first models and used to represent the colors of multiple hairs at the corresponding position; the color texture map includes: a plurality of color channels and an alpha channel; the value of each pixel point in the alpha channel of the color texture map is used to represent the transparency information of the pixel point.
[0286] Render the hair model using the hair texture map to generate a rendered image corresponding to the hair model.
[0287] The above-mentioned memory 162 includes an internal memory 1621 and an external memory 1622; the internal memory 1621 here is also called the main memory, which is used to temporarily store the operation data in the processor 161 and the data exchanged with the external memory 1622 such as the hard disk, and the processor 161 exchanges data with the external memory 1622 through the internal memory 1621.
[0288] The specific execution process of the above instructions can refer to the steps of the rendering method described in the embodiments of the present disclosure, and will not be elaborated here.
[0289] The embodiments of the present disclosure further provide a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the rendering method described in the above method embodiments. Wherein, the storage medium can be a volatile or non-volatile computer-readable storage medium.
[0290] The embodiments of the present disclosure further provide a computer program product, which carries program code. The instructions included in the program code can be used to execute the steps of the rendering method described in the above method embodiments. For details, refer to the above method embodiments and will not be elaborated here.
[0291] Among them, the above computer program product can be specifically implemented in a manner of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is specifically embodied as a computer storage medium. In another alternative embodiment, the computer program product is specifically embodied as a software product, such as a Software Development Kit (SDK), etc.
[0292] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein. In several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For another 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 couplings, direct couplings, or communication connections shown or discussed with each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.
[0293] 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 can be located in one place, or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0294] In addition, in each embodiment of the present disclosure, the functional units can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0295] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such an understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present disclosure. The foregoing storage medium includes: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.
[0296] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present disclosure, used to illustrate the technical solutions of the present disclosure, rather than limiting them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that any person skilled in the art within the technical scope disclosed by the present disclosure can still modify the technical solutions described in the foregoing embodiments or easily conceive of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims
1. A rendering method, characterized in that, Including: Obtaining a hair model and a hair texture map corresponding to the hair model; The hair model includes: a plurality of first models located at different positions on the head; each of the first models is generated by modeling a hair piece formed by multiple hairs at the corresponding position; the hair texture map includes: a color texture map generated for each of the first models and used to characterize the colors of multiple hairs at the corresponding position, and a first texture map used to determine the lighting effect of the hair model; the color texture map includes: a plurality of color channels and an alpha channel; the value of each pixel point in the alpha channel of the color texture map is used to characterize the transparency information of the pixel point; Rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model; Wherein, the rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model includes: Determining target specular effect information corresponding to the hair model based on the lighting direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model; the target specular effect information is used to characterize the specular degree corresponding to each vertex in the hair model; Performing a fusion process on the target specular effect information and the first texture map to obtain lighting intensity information corresponding to each vertex in the hair model; Rendering the hair model based on the lighting intensity information and the color texture map to generate a rendered image corresponding to the hair model.
2. The rendering method according to claim 1, wherein The rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model includes: For each of the plurality of first models, rendering the first model using the hair texture map corresponding to the first model to generate a first layer corresponding to the first model and transparency information corresponding to each pixel point in the first layer; Based on the depth information of the plurality of first models relative to the virtual camera respectively and the transparency information corresponding to each pixel point in the first layer, superimposing the first layers corresponding to the plurality of first models to obtain the rendered image.
3. The rendering method according to claim 1, wherein The hair model further includes: a second model used to characterize the hair roots; The rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model includes: Rendering the first model using the color texture map to obtain a first layer, and rendering the second model to obtain a second layer; Determining the superimposition order between the first layer and the second layer based on the depth information of the first model and the second model relative to the virtual camera respectively; Superimposing the first layer and the second layer according to the superimposition order to generate the rendered image.
4. The rendering method according to claim 1, characterized in that At positions of the first model far from the hair roots, a plurality of tips with angles less than a preset angle are formed; The rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model includes: Performing color rendering on the first model using the color map, and performing shadow rendering on the first model based on the light direction information and the position information of the first model to obtain a rendered image corresponding to the hair model.
5. The rendering method according to any one of claims 1-3, characterized in that, The hair model further includes a third model located at the hair tip and a color map corresponding to the third model; at positions of the third model far from the hair root, a plurality of tips with angles less than a preset angle are formed. Performing rendering on the hair model using the hair map to generate a rendered image corresponding to the hair model includes: Performing rendering on the first model using the color map corresponding to the first model to obtain a first layer corresponding to the first model; and Performing color rendering on the third model using the color map corresponding to the third model, and performing shadow rendering on the third model based on the light direction information and the position information of the third model to obtain a third layer corresponding to the third model. Based on the depth information of the first model and the third model relative to the virtual camera respectively, superimposing the first layer and the third graphic to obtain the rendered image.
6. The rendering method according to claim 1, wherein The first map includes: a specular range map and / or an ambient occlusion map. Wherein, the pixel information of the pixel points in the specular range map is used to indicate the difficulty of generating specular highlights at corresponding positions on the hair model; among them, the specular range maps corresponding to different first models are used to represent that the difficulty of generating specular highlights of the first model located in the inner layer of the hair is higher than that of the first model located in the outer layer of the hair; the ambient occlusion map is used to represent the light intensity occlusion characteristics corresponding to different depth positions of the hair model.
7. The rendering method according to claim 6, characterized in that, The first map includes a specular range map and an ambient occlusion map. Performing a fusion process on the target specular effect information and the first map to obtain the light intensity information corresponding to each vertex in the hair model includes: Performing bilinear interpolation on the specular range map and the ambient occlusion map to obtain an interpolated image. Adding the light direction and the virtual camera direction to obtain a specular range angle. Performing a dot product process on the specular range angle and the normal direction information of the model vertices included in the hair model to obtain the first specular effect information corresponding to the hair model. Performing an interpolation process on the first specular effect information using the interpolated image to obtain the light intensity information corresponding to each vertex in the hair model.
8. The rendering method according to claim 7, characterized in that The hair map further includes: a normal map and a tangent perturbation map; wherein, the normal map is used to represent the surface concavo-convex characteristics of the hair model; the tangent perturbation map is used to represent the uneven characteristics of the specular highlight area of the hair model in the hair extension direction. Determining the target specular effect information corresponding to the hair model based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model includes: Determine the second specular effect information corresponding to the hair model based on the specular range angle information, the normal map, and the tangent perturbation map; Determine the target specular effect information based on the first specular effect information and the second specular effect information.
9. The rendering method according to claim 8, wherein The determining the second specular effect information corresponding to the hair model based on the specular range angle information, the normal map, and the tangent perturbation map includes: Use the tangent perturbation map to adjust the pixel information of the target channel in the normal map to generate an adjusted target channel and an adjusted normal map including the adjusted target channel; wherein the target channel is the channel in the normal map that controls the extension angle of light on the hair; Perform a dot product operation on the normal map and the specular range angle to obtain the second specular effect information corresponding to the hair model.
10. A rendering device, characterized in that, Includes: An acquisition module for acquiring a hair model and a hair texture map corresponding to the hair model; The hair model includes: a plurality of first models located at different positions on the head; each of the first models is generated by modeling a hair piece formed by multiple hairs at the corresponding position; the hair texture map includes: a color texture map generated for each of the first models and used to represent the colors of multiple hairs at the corresponding position; the color texture map includes: a plurality of color channels and an alpha channel; the value of each pixel point in the alpha channel of the color texture map is used to represent the transparency information of the pixel point; A generation module for rendering the hair model using the hair texture map to generate a rendered image corresponding to the hair model; Wherein, the generation module is specifically used for: Determine the target specular effect information corresponding to the hair model based on the light direction, the virtual camera direction, and the normal direction information of the model vertices included in the hair model; the target specular effect information is used to represent the specular degree corresponding to each vertex in the hair model; Perform a fusion process on the target specular effect information and a first texture map to obtain the light intensity information corresponding to each vertex in the hair model; Render the hair model based on the light intensity information and the color texture map to generate a rendered image corresponding to the hair model.
11. A computer device, characterized in that, Includes: A processor and a memory, the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the steps of the rendering method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium. When the computer program is run by a computer device, the computer device executes the steps of the rendering method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device for generating hair image
CN107204036A
Model rendering method and device, electronic equipment and computer readable medium
CN111508053A
Model generation method and device, storage medium and computer equipment
CN112465945A
Virtual hair treatment method and device, terminal equipment and readable storage medium
CN114359448A