Model Rendering Method, Device, Electronic Device and Storage Medium
By obtaining and adjusting the map data of the hair model and generating target lighting and highlight information, the problem of low efficiency of hair model rendering on mobile platforms is solved, and efficient and realistic rendering effects are achieved, suitable for real-time rendering of mobile platforms.
Patent Information
- Application Number
- CN202210662720.9
- 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
In the prior art, rendering of hair models is inefficient and flexible on mobile platforms, and the offline renderer is costly and cannot meet the real-time rendering needs.
By obtaining the map data of the hair model, including lighting intensity occlusion features and highlight range features, the target lighting information and target highlight information are generated, and the rendering effect and efficiency are improved.
It realizes efficient and realistic hair model rendering on mobile platforms, improves rendering effect and flexibility, reduces the amount of calculation, and is suitable for real-time rendering on mobile platforms.
Smart Images

Figure CN115063522B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of three-dimensional modeling technologies, and in particular, to a model rendering method, apparatus, electronic device, and storage medium. Background Art
[0002] With the development of technologies, the rendering of hair models is increasingly widely used in media scenarios such as movies, animations, and advertisements. Due to the high rendering requirements for hyper-realistic character hairstyles, it is usually completed by an offline renderer. However, the rendering cost of the offline renderer is relatively high, and it is less applied to real-time rendering scenarios on mobile platforms, resulting in low flexibility and efficiency in the hair model rendering process. Summary of the Invention
[0003] In view of this, the present disclosure provides at least a model rendering method, apparatus, electronic device, and storage medium.
[0004] In a first aspect, the present disclosure provides a model rendering method, including:
[0005] Obtaining texture data corresponding to a hair model; wherein, the texture data includes: first texture data representing the light intensity occlusion characteristics corresponding to the hair model at different depth positions, and / or, second texture data representing the highlight range characteristics corresponding to the hair model;
[0006] Obtaining initial light information and initial highlight information corresponding to the hair model, and generating target light information and target highlight information corresponding to the hair model based on the texture data, the initial light information, and the initial highlight information;
[0007] Rendering the hair model by using the target light information and the target highlight information to generate a rendered hair model.
[0008] In the above method, by obtaining the texture data corresponding to the hair model, after obtaining the initial light information and the initial highlight information corresponding to the hair model, target light information and target highlight information corresponding to the hair model are generated based on the texture data, the initial light information, and the initial highlight information. Since the first texture data represents the light intensity occlusion characteristics corresponding to the hair model at different depth positions, when the texture data includes the first texture data, the first texture data can be used to occlude the initial light information, so that the target light information has the characteristic of corresponding to different light intensities at different levels. Furthermore, the second texture data represents characteristics such as the highlight range and highlight intensity corresponding to the hair model. When the texture data includes the second texture data, the second texture data can be used to adjust the initial highlight information, so that the obtained target highlight information is more appropriate for the hair highlight area.
[0009] Furthermore, by using the target illumination information and the target specular highlight information, the hair model is rendered to obtain the rendered hair model, making the rendering effect of the hair model closer to the real effect, with a better rendering effect and a more realistic rendered hair model. At the same time, the texture data can be pre-generated data. By obtaining the texture data, the problem of large computational load caused by generating texture data during model rendering is alleviated, and the efficiency and accuracy of model rendering are improved. While ensuring the rendering effect, the model rendering method can be effectively and preferably applied to mobile platforms.
[0010] In a possible implementation manner, generating the target illumination information and the target specular highlight information corresponding to the hair model based on the texture data, the initial illumination information, and the initial specular highlight information includes:
[0011] When the texture data includes the first texture data, based on the first texture data, the initial illumination information is adjusted to generate the target illumination information corresponding to the hair model;
[0012] When the texture data includes the second texture data, based on the second texture data, the initial specular highlight information is adjusted to generate the target specular highlight information corresponding to the hair model.
[0013] In a possible implementation manner, adjusting the initial illumination information based on the first texture data to generate the target illumination information corresponding to the hair model includes:
[0014] Performing a multiplication operation on the pixel information corresponding to each pixel point in the first texture data and the illumination intensity at the corresponding position in the initial illumination information to generate the adjusted illumination intensity;
[0015] Based on each of the adjusted illumination intensities, the target illumination information corresponding to the hair model is generated.
[0016] In the above method, the initial illumination information is masked using the first texture data to obtain the target illumination information. The first texture data contains the light intensity masking degree information corresponding to different depth positions, making the generated target illumination information closer to the illumination effect shown by real hair. Therefore, when the target illumination information is subsequently used to render the hair model, the rendering effect is better.
[0017] In a possible implementation manner, the second texture data includes a specular highlight range texture, and the pixel information of the pixel points in the specular highlight range texture is used to indicate the difficulty of generating specular highlights at the corresponding positions on the hair model. Adjusting the initial specular highlight information based on the second texture data to generate the target specular highlight information corresponding to the hair model includes:
[0018] Multiply the pixel information of each pixel in the high - light range map with the high - light information at the corresponding position in the initial high - light information to generate the target high - light information.
[0019] In the above method, since the high - light range map can represent the high - light range characteristics corresponding to the hair model, adjusting the initial high - light information using the high - light range map can accurately obtain the target high - light information corresponding to the hair model, thereby generating a more realistic high - light effect.
[0020] In a possible implementation, the second map data includes a tangent perturbation map, and the tangent perturbation map is used to represent the uneven characteristics of the high - light area of the hair model in the vertical direction; the adjusting the initial high - light information based on the second map data to generate the target high - light information corresponding to the hair model includes:
[0021] 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 up - and - down angle of light.
[0022] Use the adjusted normal map, light direction information, and view - direction information of any view to generate intermediate high - light information.
[0023] Fuse the intermediate high - light information and the initial high - light information to generate the target high - light information corresponding to the hair model.
[0024] In the above method, using the tangent perturbation map to perturb the normal map of the model can disrupt the smooth - gradient high - light area corresponding to the hair model, which not only simplifies the calculation amount of the original true anisotropy but also achieves an uneven and realistic high - light effect, making the shape of the target high - light area closer to the shape of the high - light area of real hair. Subsequently, using the target high - light information can accurately render the hair model, improving the rendering effect of the hair model.
[0025] In a possible implementation, the rendering the hair model using the target lighting information and the target high - light information to generate a rendered hair model includes:
[0026] When the map data further includes a color map for representing the color of the hair model, fuse the color information indicated by the color map with the target lighting information and the target high - light information to generate fused color information; or,
[0027] In the case where the texture data does not include the color texture, obtain color information, and perform a fusion process on the color information, the target lighting information, and the target specular information to generate fused color information;
[0028] Use the fused color information to render the hair model to generate a rendered hair model.
[0029] Under the above-described embodiment, there are different ways to obtain color information, enabling the shader used in the rendering process to switch the dyeing method at any time, achieving different dyeing effects, alleviating the problem that the shader cannot dynamically switch the dyeing method, and improving the flexibility and diversity of the hair model dyeing method.
[0030] In a possible embodiment, the rendering the hair model using the target lighting information and the target specular information to generate a rendered hair model includes:
[0031] Obtain multiple color information; and
[0032] Determine an initial reference value corresponding to each coordinate data of the hair model in the vertical direction; wherein, the initial reference value matches the coordinate data;
[0033] Adjust the initial reference value corresponding to each coordinate data to obtain an adjusted reference value;
[0034] Fuse the multiple color information according to the adjusted reference value corresponding to each coordinate data to generate target color information corresponding to each coordinate data of the hair model in the vertical direction;
[0035] Use the target color information, the target lighting information, and the target specular information to render the hair model to generate a rendered hair model.
[0036] Under the above-described embodiment, based on the adjusted reference value, multiple colors are fused to achieve the function of multi-color hair rendering and improve the rendering effect of the hair model rendering.
[0037] In a possible embodiment, the adjusting the initial reference value corresponding to each coordinate data to obtain an adjusted reference value includes:
[0038] Perform a power operation on the initial reference value corresponding to each coordinate data based on a determined target number of times to obtain an adjusted reference value; wherein, the target number of times is negatively correlated with the color gradient range after fusing multiple colors.
[0039] Under the above-described embodiments, based on the determined target number of times, perform a power operation on the initial reference values corresponding to the respective coordinate data to obtain adjusted reference values. Since the target number of times is negatively correlated with the color gradient range after the fusion of multiple colors, that is, as the target number of times increases, the color gradient range after the fusion of multiple colors decreases, the range of the gradient area after multi-color fusion can be adjusted according to actual needs, making the color fusion effect more flexible and diverse, and improving the rendering effect of multiple colors.
[0040] In a possible implementation manner, the adjusting the initial reference values corresponding to the respective coordinate data to obtain adjusted reference values includes:
[0041] Remap the initial reference values corresponding to the respective coordinate data to a target range to obtain the remapped reference values corresponding to the respective coordinate data;
[0042] Perform a superposition process on the remapped reference values corresponding to the respective coordinate data and a preset target value to obtain the adjusted reference values, where the preset target value is used to adjust the position of the boundary line between different colors.
[0043] Under the above-described embodiments, by remapping the initial reference values corresponding to the respective coordinate data to a target range and performing a superposition process on the obtained remapped reference values and a preset target value, adjusted reference values are obtained. By controlling the preset target value, the position of the boundary line between multiple colors in the vertical direction can be controlled, thereby obtaining a dyeing effect that meets actual needs.
[0044] For the effect descriptions of the following devices, electronic devices, etc., refer to the descriptions of the above methods and will not be elaborated here.
[0045] In a second aspect, the present disclosure provides a model rendering device, including:
[0046] An acquisition module, configured to acquire texture data corresponding to a hair model; wherein, the texture data includes: first texture data representing the light intensity occlusion characteristics corresponding to the hair model at different depth positions, and / or, second texture data representing the highlight range characteristics corresponding to the hair model;
[0047] A generation module, configured to obtain the initial lighting information and initial highlight information corresponding to the hair model, and generate the target lighting information and target highlight information corresponding to the hair model based on the texture data, the initial lighting information, and the initial highlight information;
[0048] A rendering module, configured to render the hair model by using the target lighting information and the target highlight information to generate a rendered hair model.
[0049] In a third aspect, the present disclosure provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device runs, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the model rendering method described in the first aspect or any of the embodiments above are performed.
[0050] In a fourth aspect, the present disclosure provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, the steps of the model rendering method described in the first aspect or any of the embodiments above are performed.
[0051] To make the above objects, features, and advantages of the present disclosure more obvious and understandable, the following specific preferred embodiments are given, and in conjunction with the accompanying drawings, the detailed description is as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] To more clearly illustrate the technical solutions of the embodiments of the present disclosure, the accompanying drawings required for use in the embodiments will be briefly introduced below. The accompanying drawings herein are incorporated into the specification and form a part of this 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.
[0053] Figure 1 It shows a schematic flowchart of a model rendering method provided by an embodiment of the present disclosure;
[0054] Figure 2 It shows a schematic architecture diagram of a model rendering device provided by an embodiment of the present disclosure;
[0055] Figure 3 It shows a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0056] 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. Apparently, 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 in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the present disclosure claimed, 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 fall within the scope of protection of the present disclosure.
[0057] With the development of technology, the rendering of hair models has been increasingly widely used in media scenarios such as movies, animations, and advertisements. Due to the high requirements for rendering hyper-realistic character hairstyles, it is usually completed by an offline renderer. However, the rendering cost of the offline renderer is relatively high, and it is less applied to real-time rendering scenarios on mobile platforms, resulting in low flexibility and efficiency in the hair model rendering process.
[0058] Generally, for the rendering of hyper-realistic character hairstyles, more delicate picture effects are often required, so it is usually completed by an offline renderer. In the traditional offline rendering method, the criteria for evaluating the hair rendering quality mainly include the anisotropic effect and the specular reflection effect. To obtain a high rendering quality, the offline renderer needs to process the model based on a high number of model faces and a long rendering time, thus unable to provide a rendering method with high rendering quality that can perform real-time rendering and be applied to mobile platforms.
[0059] To alleviate the above problems, the embodiments of the present disclosure provide a model rendering method, apparatus, electronic device, and storage medium.
[0060] It should be noted that similar reference numerals and letters denote 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.
[0061] To facilitate the understanding of the embodiments of the present disclosure, a model rendering method disclosed in the embodiments of the present disclosure will be introduced in detail first. The execution subject of the model 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 other processing devices. The terminal device can be a smart phone, a tablet, a laptop computer, a Mobile Internet Device (MID), etc. In some possible implementation manners, the model rendering method can be implemented by a processor invoking computer-readable instructions stored in a memory.
[0062] See Figure 1 As shown, it is a schematic flowchart of a model rendering method provided by an embodiment of the present disclosure. This method includes S101 - S103, where:
[0063] S101, obtain texture data corresponding to the hair model; where the texture data includes: first texture data representing the light intensity occlusion characteristics corresponding to the hair model at different depth positions, and / or second texture data representing the highlight range characteristics corresponding to the hair model.
[0064] S102, obtain the initial lighting information and initial highlight information corresponding to the hair model, and generate the target lighting information and target highlight information corresponding to the hair model based on the texture data, initial lighting information, and initial highlight information.
[0065] S103, use the determined at least one color information, target lighting information, and target highlight information to render the hair model, and generate the rendered hair model.
[0066] In the above method, by obtaining the texture data corresponding to the hair model, after obtaining the initial lighting information and initial highlight information corresponding to the hair model, based on the texture data, initial lighting information, and initial highlight information, the target lighting information and target highlight information corresponding to the hair model are generated. Since the first texture data represents the light intensity occlusion characteristics corresponding to the hair model at different depth positions, when the texture data includes the first texture data, the first texture data can be used to occlude the initial lighting information, so that the target lighting information has the characteristic of corresponding to different light intensities at different levels. Moreover, the second texture data represents characteristics such as the highlight range and highlight intensity corresponding to the hair model. When the texture data includes the second texture data, the second texture data can be used to adjust the initial highlight information, so that the obtained target highlight information fits well with the hair highlight area.
[0067] Furthermore, using the target lighting information and target highlight information to render the hair model, the rendered hair model is obtained, making the rendering effect of the hair model more fitting to the real effect, with a better rendering effect and a more realistic rendered hair model. At the same time, the texture data can be pre-generated data. By obtaining the texture data, the problem of large computational volume caused by generating texture data during the model rendering process is alleviated, and the efficiency and accuracy of model rendering are improved. While ensuring the rendering effect, this model rendering method can be effectively and preferably applied to mobile platforms.
[0068] The following specifically describes S101 - S103.
[0069] Regarding S101:
[0070] Here, the production of the hair model follows the production logic of multiple levels. Specifically, the hair model is divided into three layers: inner, middle, and outer. The inner layer is the scalp layer, the middle layer is the basic hairstyle contour layer, and the outer layer is the unruly broken hairs of the hair or the hair tips around the face, to achieve the production of the hair model. Among them, the hair model can be a model of any hairstyle made in advance, and the hair model can be a three-dimensional model composed of multiple triangular patches, and each triangular patch corresponds to multiple model vertices.
[0071] After generating the hair model, the texture data corresponding to the hair model can be constructed so that the execution entity can obtain the texture data matching the hair model.
[0072] The texture data includes: the first texture data representing the light intensity occlusion characteristics corresponding to different depth positions of the hair model, and / or, the second texture data of the specular range characteristics corresponding to the hair model. Among them, the pixel information of each pixel point in the first texture data represents the occlusion degree of the light intensity at different depth positions, that is, the occlusion degree of the inner layer light intensity of the hair model is greater than that of the middle layer light intensity, and the occlusion degree of the middle layer light intensity is greater than that of the outer layer light intensity. By prefabricating the first texture data according to the structure of different hair models, without generating the first texture data during the rendering process, the calculation amount of the rendering process is greatly reduced, so as to ensure that the texture data can function properly on the mobile platform.
[0073] The second texture data can include a specular range texture, a tangent perturbation texture, etc. Among them, the pixel information of each pixel point in the specular range texture represents the difficulty of generating specular highlights at the position on the hair model that matches the pixel point; the pixel information of each pixel point in the tangent perturbation texture can represent the uneven characteristics of the specular highlight area of the hair model in the vertical direction.
[0074] Regarding S102:
[0075] Here, the light can be the light of the total light source received by the mobile device. The total light source can include: global illumination (GI), main directional light, etc. Based on the light direction information and the normal direction information of the model vertices included in the hair model, the initial illumination information corresponding to the hair model is obtained. The initial illumination information can include: illumination range information, illumination intensity information, etc. The initial illumination information can be determined by the following formula:
[0076] D = dot(L.dir, N.dir)
[0077] Among them, L.dir is the light direction information, N.dir is the normal direction information of the model vertices of the hair model, dot is the dot product operation, and D is the diffuse range, and the diffuse range includes a standard illumination range and a standard illumination intensity.
[0078] And based on the normal direction information of the model vertices and the viewing direction information of the viewing angle, the tangent angle information can be determined, and then the dot product operation is performed on the tangent angle information and the direction information of the light to obtain the initial specular information corresponding to the hair model. The initial specular information includes the position information of the anisotropic specular region, the specular intensity information, etc.
[0079] In specific implementation, after obtaining the initial lighting information and the initial specular information, in response to the triggered lighting adjustment operation, the initial lighting information can be adjusted to obtain the adjusted initial lighting information; and / or, in response to the triggered specular adjustment operation, the initial specular information can be adjusted to obtain the adjusted initial specular information. So as to subsequently use the texture data to process the adjusted initial lighting information and / or the adjusted initial specular information to obtain the target lighting information and the target specular information.
[0080] Since the initial lighting information and the initial specular information are the simplified lighting information and the simplified specular information corresponding to the hair model, the rendering effect presented by the hair model rendered using the initial lighting information and the initial specular information is less realistic and cannot meet the requirements of hyper-realistic style hair. In order to improve the rendering effect, the present disclosure uses texture data to adjust and process the initial lighting information and / or the initial specular information to generate the target lighting information and the target specular information corresponding to the hair model.
[0081] In the implementation manner of the present disclosure, based on the texture data, the initial lighting information and the initial specular information, the target lighting information and the target specular information corresponding to the hair model are generated, which specifically includes:
[0082] S1021, when the texture data includes the first texture data, based on the first texture data, the initial lighting information is adjusted to generate the target lighting information corresponding to the hair model.
[0083] S1022, when the texture data includes the second texture data, based on the second texture data, the initial specular information is adjusted to generate the target specular information corresponding to the hair model.
[0084] In S1021, the first texture data can be used to adjust the initial lighting information. For example, the dot product operation can be performed on the first texture data and the initial lighting information to obtain the target lighting information corresponding to the hair model, so as to obtain the lighting information corresponding to different depth positions on the hair model.
[0085] In an alternative implementation manner, based on the first texture data, the initial lighting information is adjusted to generate the target lighting information corresponding to the hair model, which specifically includes:
[0086] Step A1, perform a multiplication operation on the pixel information corresponding to each pixel point in the first texture data and the light intensity at the corresponding position in the initial light information to generate an adjusted light intensity.
[0087] Step A2, generate the target light information corresponding to the hair model based on each adjusted light intensity.
[0088] Perform a multiplication operation on the pixel information corresponding to each pixel point in the first texture data and the light intensity at the corresponding position in the initial light information to generate an adjusted light intensity. Specifically, in implementation, the first texture data can be an ambient occlusion texture, and this ambient occlusion texture contains the light intensity occlusion characteristics corresponding to the hair model at different depth positions.
[0089] For example, different depth positions can include: a first depth position, a second depth position, and a third depth position. The first depth position can be the outermost layer position of the hair, the second depth position can be the middle layer position of the hair, and the third depth position can be the innermost layer position of the hair. The occlusion degree of the ambient occlusion texture for the light intensity at the third depth position is greater than that for the light intensity at the second depth position, and the occlusion degree of the ambient occlusion texture for the light intensity at the second depth position is greater than that for the light intensity at the first depth position. That is, the greater the depth position on the hair model, the stronger the occlusion degree, and the smaller the corresponding light intensity.
[0090] Then, generate the target light information corresponding to the hair model based on each adjusted light intensity. When the first texture data is not included in the texture data, the initial light information can be determined as the target light information corresponding to the hair model.
[0091] In the above implementation manner, the initial light information is occluded by using the first texture data to obtain the target light information. This first texture data contains the light intensity occlusion degree information corresponding to different depth positions, so that the generated target light information is closer to the light effect shown by real hair. Furthermore, when the target light information is subsequently used to render the hair model, the rendering effect is better.
[0092] In S1022, the second texture data can be used to adjust the initial specular information to obtain the target specular information corresponding to the hair model, so that the specular effect of the rendered hair model is close to the specular effect of real hair.
[0093] Exemplarily, the second texture data can be dot-product operated with the initial specular information to obtain the target specular information corresponding to the hair model. When the second texture data is not included in the texture data, the initial specular information can be determined as the target specular information.
[0094] In specific implementation, at least one of the following multiple implementation manners can be used to generate the target illumination information and the target specular information corresponding to the hair model.
[0095] In one implementation manner, the second texture data includes a specular range texture, and the pixel information of the pixel points in the specular range texture is used to indicate the difficulty degree of generating specular highlights at the corresponding positions on the hair model. Based on the second texture data, the initial specular information is adjusted to generate the target specular information corresponding to the hair model. Specifically, it includes: multiplying the pixel information of each pixel point in the specular range texture by the specular information at the corresponding position in the initial specular information to generate the target specular information.
[0096] Here, multiplying the pixel information of each pixel point in the specular range texture by the specular information at the corresponding position in the initial specular information to generate the target specular information realizes masking the initial specular information by using the specular range texture. Among them, the pixel information of the pixel points in the specular range texture is used to indicate the difficulty degree of generating specular highlights at the corresponding positions on the hair model. Suppose that when the angle between the light direction and the normal direction of the vertex of the hair model reaches 45°, specular highlights start to be generated at position 1, and when the angle between the light direction and the normal direction of the vertex of the hair model reaches 90°, specular highlights start to be generated at position 2. It can be known that position 1 is more likely to generate specular highlights than position 2, that is, in the specular range texture, the pixel information of the pixel point corresponding to position 1 is greater than the pixel information of the pixel point corresponding to position 2.
[0097] In the above implementation manner, since the specular range texture can characterize the specular range characteristics corresponding to the hair model, adjusting the initial specular information by using the specular range texture can more accurately obtain the target specular information corresponding to the hair model, so that a more realistic specular highlight effect can be generated.
[0098] In another implementation manner, the second texture data includes a tangent perturbation texture, and the tangent perturbation texture is used to characterize the uneven characteristics of the specular highlight area of the hair model in the vertical direction; based on the second texture data, the initial specular information is adjusted to generate the target specular information corresponding to the hair model, including the following steps:
[0099] Step B1, using the tangent perturbation texture to adjust the pixel information of the target channel in the normal map to generate the adjusted target channel and the adjusted normal map including the adjusted target channel; where the target channel is the channel in the normal map that controls the up and down angles of the light.
[0100] Step B2, using the adjusted normal map, the light direction information, and the view direction information of any view angle to generate the intermediate specular information.
[0101] Step B3: Fuse the intermediate specular information and the initial specular information to generate the target specular information corresponding to the hair model.
[0102] Here, use the tangent perturbation map to adjust the pixel information of the target channel in the normal map, generating the adjusted target channel and the adjusted normal map including the adjusted target channel, where the target channel is the channel in the normal map that controls the up and down angles of the light.
[0103] Specifically, the normals in tangent space usually use the X-axis and Y-axis to store most of the bump information, and the Z-axis is basically a bulge facing outward. Therefore, the normal map can be three-channel image data, that is, including the R channel matching the X-axis, the G channel matching the Y-axis, and the B channel matching the Z-axis. Since the adjustment effect required by the hair model is an up and down offset effect in the vertex coordinate system of the hair model in the direction of the Y-axis, the G channel can be determined as the target channel.
[0104] During implementation, first obtain the tangent perturbation map according to the specular range characteristics of a real hair, and then add the pixel values of each pixel point in the tangent perturbation map to the pixel values of the corresponding positions in the target channel of the normal map to obtain the adjusted target channel and the adjusted normal map including the adjusted target channel, achieving the effect of perturbing the Y-value coordinate in the normal space.
[0105] The intermediate specular information can be generated using the adjusted normal direction information, light direction information, and viewing direction information of the front view angle included in the adjusted normal map. Then, fuse the intermediate specular information and the initial specular information to generate the target specular information corresponding to the hair model. For example, the pixel values of the intermediate specular information can be multiplied by the pixel values of the initial specular information at the corresponding positions to generate the target specular information corresponding to the hair model.
[0106] In the above implementation process, using the tangent perturbation map to perturb the normal map of the model can disrupt the smooth and gradual specular area corresponding to the hair model, not only simplifying the calculation amount of the original true anisotropy but also achieving a jagged and realistic specular effect, making the shape of the target specular area closer to the shape of the specular area of real hair. Subsequently, using the target specular information can accurately render the hair model, improving the rendering effect of the hair model.
[0107] In another implementation manner, in order to obtain more richly hierarchical specular information, the initial specular information can be adjusted using the specular range map and the tangent perturbation map to generate the target specular information corresponding to the hair model, specifically including the following steps:
[0108] Step C1: Multiply the pixel information of each pixel in the high - light range texture map with the high - light information at the corresponding position in the initial high - light information to generate the first intermediate high - light information.
[0109] Step C2: Use the tangent perturbation texture map to adjust the pixel information of the target channel in the normal map to generate the adjusted target channel and the adjusted normal map including the adjusted target channel. Here, the target channel is the channel in the normal map that controls the up - and - down angle of light. Then, use the adjusted normal map, the light - direction information, and the view - direction information of any view to generate the second intermediate high - light information. The specific implementation process can refer to the description of steps B1 - B3 above.
[0110] Step C3: Fuse the first intermediate high - light information and the second intermediate high - light information to generate the target high - light information corresponding to the hair model.
[0111] For example, the first intermediate high - light information and the second intermediate high - light information can be multiplied element - by - element at the same position to generate the target high - light information corresponding to the hair model.
[0112] Regarding S103:
[0113] Specifically, after obtaining the target lighting information and the target high - light information, the hair model can be rendered using the target lighting information and the target high - light information to generate the rendered hair model. Or, in response to a triggered lighting adjustment operation, the target lighting information can be adjusted to obtain the adjusted target lighting information, and / or in response to a triggered high - light adjustment operation, the target high - light information can be adjusted to obtain the adjusted target high - light information. Then, the adjusted target lighting information and the adjusted target high - light information can be used to render the hair model to generate the rendered hair model.
[0114] Alternatively, at least one color information can be obtained, and the hair model can be rendered using the target lighting information, the target high - light information, and at least one color information to generate the rendered hair model. Here, the color information can come from a pre - fabricated color texture map, such as a base - color texture map. Or, the obtained external color values can be determined as the color information, such as external color value 1, external color value 2,..., external color value N.
[0115] In a possible implementation, rendering the hair model using the determined at least one color information, the target lighting information, and the target high - light information to generate the rendered hair model includes:
[0116] S1031. When the texture data further includes a color texture for characterizing the color of the hair model, fuse the color information indicated by the color texture with the target lighting information and the target specular information to generate fused color information. Alternatively, when the texture data does not include a color texture, obtain color information and fuse the color information with the target lighting information and the target specular information to generate fused color information.
[0117] S1032. Render the hair model using the fused color information to generate a rendered hair model.
[0118] Specifically, when the texture data further includes a color texture for characterizing the color of the hair model, fuse the color information indicated by the color texture with the target lighting information and the target specular information to generate fused color information. For example, the target lighting information and the target specular information can be fused first to obtain a fused result, and then the fused result is fused with the color information indicated by the color texture to generate fused color information. Alternatively, the color information indicated by the color texture and the target lighting information can be fused first to obtain a fused result, and then the fused result is fused with the target specular information to generate fused color information. Then, render the hair model using the fused color information to generate a rendered hair model.
[0119] When the texture data does not include a color texture, obtain color information 1 and fuse the color information 1 with the target lighting information and the target specular information to generate fused color information. Then, render the hair model using the fused color information to generate a rendered hair model.
[0120] In the above embodiments, the color information can be obtained through different channels, enabling the shader used in the rendering process to switch the coloring method at any time, achieving different coloring effects, alleviating the problem that the shader cannot dynamically switch the coloring method, and improving the flexibility and diversity of the hair model coloring method.
[0121] In one embodiment, rendering the hair model using the target lighting information and the target specular information to generate a rendered hair model includes the following steps:
[0122] Step 1. Obtain multiple color information.
[0123] Step 2. Determine the initial reference value corresponding to each coordinate data of the hair model in the vertical direction; wherein, the initial reference value matches the coordinate data. And adjust the initial reference value corresponding to each coordinate data to obtain an adjusted reference value.
[0124] Step 3: According to the adjusted reference values corresponding to each coordinate data, fuse multiple color information to generate the target color information corresponding to each coordinate data of the hair model in the vertical direction.
[0125] Step 4: Use the target color information, target illumination information, and target specular information to render the hair model to generate the rendered hair model.
[0126] Here, the number of multiple colors and the color information can be determined as needed. Determine the initial reference value corresponding to each coordinate data of the hair model in the vertical direction; among them, the initial reference value matches the coordinate data. For example, the coordinate data of the hair model in the vertical direction can include: 0, 0.1, 0.2, …, 1, and the initial reference values matching this coordinate data can include: 0, 0.1, 0.2, …, 1, that is, when the coordinate data is 0, the corresponding initial reference value is 0.
[0127] Adjust the initial reference values corresponding to each coordinate data to obtain the adjusted reference values. Then, according to the adjusted reference values, fuse multiple color information to generate the target color information corresponding to each coordinate data of the hair model in the vertical direction. For example, when there are two multiple colors, linear interpolation processing can be performed on the two color information according to the adjusted reference values to obtain the target color information corresponding to each coordinate data of the hair model in the vertical direction.
[0128] Exemplarily, when there are more than two multiple colors, linear interpolation processing can be performed on the two color information among the multiple colors according to the first part of the reference values in the adjusted reference values to obtain the target color information of the partial coordinate data corresponding to the first part of the reference values of the hair model in the vertical direction; then, according to the second part of the reference values in the adjusted reference values, linear interpolation processing is performed on the other two color information among the multiple colors to obtain the target color information of the partial coordinate data corresponding to the second part of the reference values of the hair model in the vertical direction, so as to subsequently use each target color information to render the hair model.
[0129] Furthermore, the target color information, target illumination information, and target specular information can be used to render the hair model to generate the rendered hair model. For example, the target color information and the target illumination information can be first fused to obtain the fused information; then, the fused information and the target specular information are fused, and the hair model is rendered using the fused information to generate the rendered hair model.
[0130] In the above embodiments, based on the adjusted reference values, multiple colors are fused, realizing the function of multi-color hair rendering and improving the rendering effect of the hair model rendering.
[0131] In specific implementation, at least one of the following multiple adjustment schemes can be used to adjust the initial reference value corresponding to each coordinate data to obtain an adjusted reference value.
[0132] Adjustment Scheme 1: Adjust the initial reference value corresponding to each coordinate data to obtain an adjusted reference value, including: performing a power operation on the initial reference value corresponding to each coordinate data based on the determined target number of times to obtain the adjusted reference value; wherein, the target number of times is negatively correlated with the color gradient range after the fusion of multiple colors.
[0133] Here, performing a power operation on the initial reference value corresponding to each coordinate data based on the determined target number of times to obtain the adjusted reference value, wherein the target number of times is negatively correlated with the color gradient range after the fusion of multiple colors. For example, when performing a power calculation with a target number of times N on the initial reference value x at the x position of the coordinate data, where 0 < x < 1 and N > 1, the adjusted reference value obtained is x 2 , x 2 < x. It can be seen that at the same coordinate position, when the target number of times increases, the adjusted reference value will become smaller and closer to the reference value 0. Therefore, the values of the gradient region composed of each reference value will decrease as a whole and approach the 0 value. It can be seen that by changing the target number of times, the color gradient range after the fusion of multiple colors can be controlled.
[0134] In the above implementation manner, performing a power operation on the initial reference value corresponding to each coordinate data based on the determined target number of times to obtain the adjusted reference value. Since the target number of times is negatively correlated with the color gradient range after the fusion of multiple colors, that is, when the target number of times increases, the color gradient range after the fusion of multiple colors decreases, so the range of the gradient region after multi-color fusion can be adjusted according to actual needs, making the color fusion effect more flexible and diverse, and improving the rendering effect of multiple colors.
[0135] Adjustment Scheme 2: Adjust the initial reference value corresponding to each coordinate data to obtain an adjusted reference value, including the following steps:
[0136] Step A: Remap the initial reference value corresponding to each coordinate data to the target range to obtain the mapped reference value corresponding to each coordinate data.
[0137] Step B: Perform an overlay process on the mapped reference value corresponding to each coordinate data and a preset target value to obtain the adjusted reference value, wherein the preset target value is used to adjust the position of the boundary line between different colors.
[0138] Here, the initial reference values corresponding to each coordinate data are remapped to the target range to obtain the remapped reference values corresponding to each coordinate data. For example, the initial reference values corresponding to each coordinate data (for example, the initial reference value range can be (0, 1)) can be remapped proportionally to the range of (-1, 1) to obtain the remapped reference values corresponding to each coordinate data.
[0139] Then, the remapped reference values corresponding to each coordinate data are superimposed with the preset target value to obtain the adjusted reference value. Among them, the preset target value is used to adjust the position of the boundary line between different colors. For example, if the remapped reference value is 0.1 and the preset target value is 0.2, after superimposing the remapped reference value and the preset target value, the adjusted reference value obtained is 0.3.
[0140] In the above embodiment, by remapping the initial reference values corresponding to each coordinate data to the target range and superimposing the obtained remapped reference values with the preset target value, the adjusted reference value is obtained. By controlling the preset target value, the position of the boundary line between multiple colors in the vertical direction can be controlled, thereby obtaining a dyeing effect that meets the actual requirements.
[0141] Adjustment Scheme Three: Adjust the initial reference values corresponding to each coordinate data to obtain the adjusted reference value, including the following steps:
[0142] Step D1, perform a power operation on the initial reference values corresponding to each coordinate data based on the determined target number of times to obtain the first reference value; wherein, the target number of times is negatively correlated with the color gradient range after the fusion of multiple colors.
[0143] Step D2, remap the first reference value to the target range to obtain the second reference value corresponding to each coordinate data.
[0144] Step D3, superimpose the second reference values corresponding to each coordinate data with the preset target value to obtain the adjusted reference value. Among them, the preset target value is used to adjust the position of the boundary line between different colors.
[0145] Among them, the specific implementation process of Step D1 can refer to the description of Adjustment Scheme One above, and the specific implementation processes of Step D2 and Step D3 can refer to the descriptions of Steps A - B in Adjustment Scheme Two above, and will not be elaborated here.
[0146] 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 on the implementation process. The specific execution order of each step should be determined according to its function and possible internal logic.
[0147] Based on the same concept, an embodiment of the present disclosure further provides a model rendering device. Refer to Figure 2 As shown in Figure 2 , it is a schematic architecture diagram of the model rendering device provided by the embodiment of the present disclosure, including an acquisition module 201, a generation module 202, and a rendering module 203. Specifically:
[0148] The acquisition module 201 is configured to acquire texture data corresponding to the hair model; wherein, the texture data includes: first texture data representing the light intensity occlusion characteristics corresponding to different depth positions of the hair model, and / or, second texture data representing the specular range characteristics corresponding to the hair model;
[0149] The generation module 202 is configured to obtain initial lighting information and initial specular information corresponding to the hair model, and generate target lighting information and target specular information corresponding to the hair model based on the texture data, the initial lighting information, and the initial specular information;
[0150] The rendering module 203 is configured to use the target lighting information and the target specular information to render the hair model, and generate a rendered hair model.
[0151] In a possible implementation manner, when generating the target lighting information and the target specular information corresponding to the hair model based on the texture data, the initial lighting information, and the initial specular information, the generation module 202 is configured to:
[0152] When the texture data includes the first texture data, adjust the initial lighting information based on the first texture data to generate the target lighting information corresponding to the hair model;
[0153] When the texture data includes the second texture data, adjust the initial specular information based on the second texture data to generate the target specular information corresponding to the hair model.
[0154] In a possible implementation manner, when adjusting the initial lighting information based on the first texture data to generate the target lighting information corresponding to the hair model, the generation module 202 is configured to:
[0155] Perform a multiplication operation on the pixel information corresponding to each pixel point in the first texture data and the lighting intensity at the corresponding position in the initial lighting information to generate an adjusted lighting intensity;
[0156] Generate the target lighting information corresponding to the hair model based on each of the adjusted lighting intensities.
[0157] In a possible implementation, the generating module 202, when the second texture mapping data includes a specular range texture map, and the pixel information of the pixel points in the specular range texture map is used to indicate the difficulty of generating specular highlights at corresponding positions on the hair model, when adjusting the initial specular information based on the second texture mapping data to generate the target specular information corresponding to the hair model, is used for:
[0158] Performing a multiplication operation on the pixel information of each pixel point in the specular range texture map and the specular information at the corresponding position in the initial specular information to generate the target specular information.
[0159] In a possible implementation, the generating module 202, when the second texture mapping data includes a tangent perturbation texture map, and the tangent perturbation texture map is used to characterize the uneven characteristics of the specular highlight area of the hair model in the vertical direction; when adjusting the initial specular information based on the second texture mapping data to generate the target specular information corresponding to the hair model, is used for:
[0160] Using the tangent perturbation texture 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 up and down angles of light;
[0161] Using the adjusted normal map, light direction information, and viewing direction information of any viewing angle to generate intermediate specular information;
[0162] Fusing the intermediate specular information and the initial specular information to generate the target specular information corresponding to the hair model.
[0163] In a possible implementation, the rendering module 203, when rendering the hair model using the target lighting information and the target specular information to generate a rendered hair model, is used for:
[0164] In the case where the texture mapping data further includes a color texture map for characterizing the color of the hair model, fusing the color information indicated by the color texture map with the target lighting information and the target specular information to generate fused color information; or,
[0165] In the case where the texture mapping data does not include the color texture map, obtaining color information and fusing the color information with the target lighting information and the target specular information to generate fused color information;
[0166] Using the fused color information to render the hair model to generate a rendered hair model.
[0167] In a possible implementation manner, when the rendering module 203 renders the hair model by using the target lighting information and the target specular highlight information to generate a rendered hair model, it is configured to:
[0168] Obtain a variety of color information; and
[0169] Determine an initial reference value corresponding to each coordinate data of the hair model in the vertical direction; wherein, the initial reference value matches the coordinate data;
[0170] Adjust the initial reference value corresponding to each coordinate data to obtain an adjusted reference value;
[0171] Fuse a variety of color information according to the adjusted reference value corresponding to each coordinate data to generate target color information corresponding to each coordinate data of the hair model in the vertical direction;
[0172] Render the hair model by using the target color information, the target lighting information and the target specular highlight information to generate a rendered hair model.
[0173] In a possible implementation manner, when the rendering module 203 adjusts the initial reference value corresponding to each coordinate data to obtain an adjusted reference value, it is configured to:
[0174] Perform a power operation on the initial reference value corresponding to each coordinate data based on a determined target number of times to obtain an adjusted reference value; wherein, the target number of times is negatively correlated with the color gradient range after fusing a variety of colors.
[0175] In a possible implementation manner, when the rendering module 203 adjusts the initial reference value corresponding to each coordinate data to obtain an adjusted reference value, it is configured to:
[0176] Remap the initial reference value corresponding to each coordinate data to a target range to obtain a remapped reference value corresponding to each coordinate data;
[0177] Superimpose the remapped reference value corresponding to each coordinate data with a preset target value to obtain an adjusted reference value, wherein the preset target value is used to adjust the position of the boundary line between different colors.
[0178] In some embodiments, the functions or templates included in the device provided by the embodiments of the present disclosure can be used to execute the methods described in the method embodiments above. The specific implementation can refer to the description of the method embodiments above. For the sake of brevity, it will not be repeated here.
[0179] Based on the same inventive concept, embodiments of the present disclosure also provide an electronic device. Referring to Figure 3 as shown, it is a schematic structural diagram of the electronic device provided by the embodiments of the present disclosure, including a processor 301, a memory 302, and a bus 303. Among them, the memory 302 is used to store execution instructions, including an internal memory 3021 and an external memory 3022; the internal memory 3021 here is also called the main memory, which is used to temporarily store the operation data in the processor 301 and the data exchanged with the external memory 3022 such as a hard disk. The processor 301 exchanges data with the external memory 3022 through the internal memory 3021. When the electronic device 300 runs, the processor 301 communicates with the memory 302 through the bus 303, so that the processor 301 executes the following instructions:
[0180] Obtain the texture data corresponding to the hair model; wherein, the texture data includes: first texture data representing the light intensity occlusion characteristics corresponding to different depth positions of the hair model, and / or, second texture data of the specular range characteristics corresponding to the hair model;
[0181] Obtain the initial lighting information and initial specular information corresponding to the hair model, and generate the target lighting information and target specular information corresponding to the hair model based on the texture data, the initial lighting information, and the initial specular information;
[0182] Use the target lighting information and the target specular information to render the hair model to generate a rendered hair model.
[0183] Among them, the specific processing flow of the processor 301 can refer to the description of the above method embodiments and will not be elaborated here.
[0184] In addition, embodiments of the present disclosure also 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 model rendering method described in the above method embodiments. Among them, the storage medium can be a volatile or non-volatile computer-readable storage medium.
[0185] Embodiments of the present disclosure also 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 model rendering method described in the above method embodiments. Specifically, refer to the above method embodiments and will not be elaborated here.
[0186] Among them, the above computer program product can be specifically implemented in the form 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), and so on.
[0187] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described system and device can refer to the corresponding processes in the foregoing method embodiments, which will not be elaborated herein. In several embodiments provided by the present disclosure, it should be understood that the disclosed system, device, and method 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 may 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 displayed or discussed mutual coupling or direct coupling or communication connection can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be in an electrical, mechanical, or other form.
[0188] The units described as separate components may or may not be physically separated, and the components displayed 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.
[0189] In addition, in each embodiment of the present disclosure, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.
[0190] When the above-mentioned function is implemented in the form of a software functional unit and sold or used as an independent product, it 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 the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs.
[0191] The above is only the specific implementation manner of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present disclosure can easily think of changes or substitutions, which should all be covered by the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.
Claims
1. A model rendering method, characterized in that, Including: Obtain texture data corresponding to the hair model; wherein, the texture data includes: first texture data representing the light intensity occlusion characteristics corresponding to different depth positions of the hair model, and / or second texture data of the highlight range characteristics corresponding to the hair model; Obtain the initial lighting information and initial highlight information corresponding to the hair model, and generate the target lighting information and target highlight information corresponding to the hair model based on the texture data, the initial lighting information, and the initial highlight information; wherein the texture data includes first texture data and second texture data, and the target lighting information is generated by multiplying the pixel information corresponding to each pixel point in the first texture data by the lighting intensity at the corresponding position in the initial lighting information to generate an adjusted lighting intensity, and generating based on each of the adjusted lighting intensities; the target highlight information is generated by multiplying the pixel information of each pixel point in the highlight range texture included in the second texture data by the highlight information at the corresponding position in the initial highlight information; Use the target lighting information and the target highlight information to render the hair model to generate a rendered hair model; The using the target lighting information and the target highlight information to render the hair model to generate a rendered hair model includes: Obtain a variety of color information; and determine an initial reference value corresponding to each coordinate data in the vertical direction of the hair model; wherein, the initial reference value matches the coordinate data; Adjust the initial reference value corresponding to each coordinate data to obtain an adjusted reference value; Fuse the variety of color information according to the adjusted reference value corresponding to each coordinate data to generate target color information corresponding to each coordinate data in the vertical direction of the hair model; Use the target color information, the target lighting information, and the target highlight information to render the hair model to generate a rendered hair model; The adjusting the initial reference value corresponding to each coordinate data to obtain an adjusted reference value includes: performing a power operation on the initial reference value corresponding to each coordinate data based on a determined target number of times to obtain an adjusted reference value; wherein, the target number of times is negatively correlated with the color gradient range after fusing a variety of colors.
2. The method according to claim 1, wherein The generating the target lighting information and target highlight information corresponding to the hair model based on the texture data, the initial lighting information, and the initial highlight information includes: When the texture data includes the first texture data, adjust the initial lighting information based on the first texture data to generate the target lighting information corresponding to the hair model; When the texture data includes the second texture data, adjust the initial highlight information based on the second texture data to generate the target highlight information corresponding to the hair model.
3. The method according to claim 2, characterized in that, Adjusting the initial light information based on the first texture data to generate the target light information corresponding to the hair model, including: Performing a multiplication operation on the pixel information corresponding to each pixel point in the first texture data and the light intensity at the corresponding position in the initial light information to generate an adjusted light intensity; Generating the target light information corresponding to the hair model based on each of the adjusted light intensities.
4. The method according to claim 2 or 3, characterized in that, The second texture data includes a specular range texture, and the pixel information of the pixel points in the specular range texture is used to indicate the difficulty of generating specular highlights at the corresponding positions on the hair model. Adjusting the initial specular information based on the second texture data to generate the target specular information corresponding to the hair model, including: Performing a multiplication operation on the pixel information corresponding to each pixel point in the specular range texture and the specular information at the corresponding position in the initial specular information to generate the target specular information.
5. The method according to any one of claims 2-4, characterized in that, The second texture data includes a tangent perturbation texture, and the tangent perturbation texture is used to characterize the uneven characteristics of the specular highlight area of the hair model in the vertical direction; Adjusting the initial specular information based on the second texture data to generate the target specular information corresponding to the hair model, including: Using the tangent perturbation texture 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 vertical angle of the light; Generating intermediate specular information using the adjusted normal map, the light direction information, and the viewing direction information of any viewing angle; Fusing the intermediate specular information and the initial specular information to generate the target specular information corresponding to the hair model.
6. The method according to any one of claims 1-5, characterized in that, Rendering the hair model using the target light information and the target specular information to generate a rendered hair model, including: In the case where the texture data further includes a color texture for characterizing the color of the hair model, fusing the color information indicated by the color texture with the target light information and the target specular information to generate fused color information; or, In the case where the texture data does not include the color texture, obtaining color information and fusing the color information with the target light information and the target specular information to generate fused color information; Rendering the hair model using the fused color information to generate a rendered hair model.
7. The method according to claim 1, wherein Adjusting the initial reference values corresponding to the respective coordinate data to obtain adjusted reference values, including: Remapping the initial reference values corresponding to the respective coordinate data to a target range to obtain mapped reference values corresponding to the respective coordinate data; Performing a superimposition process on the mapped reference values corresponding to the respective coordinate data and a preset target value to obtain the adjusted reference values, where the preset target value is used to adjust the position of the boundary between different colors.
8. A model rendering device, characterized in that, Including: An acquisition module for acquiring texture data corresponding to a hair model; wherein the texture data includes: first texture data representing the light intensity occlusion characteristics corresponding to different depth positions of the hair model, and / or second texture data representing the specular range characteristics corresponding to the hair model; A generation module for obtaining initial lighting information and initial specular information corresponding to the hair model, and generating target lighting information and target specular information corresponding to the hair model based on the texture data, the initial lighting information, and the initial specular information; wherein the texture data includes first texture data and second texture data, and the target lighting information is generated by multiplying the pixel information corresponding to each pixel point in the first texture data by the lighting intensity at the corresponding position in the initial lighting information to generate an adjusted lighting intensity, and generating based on each of the adjusted lighting intensities; the target specular information is generated by multiplying the pixel information of each pixel point in the specular range texture included in the second texture data by the specular information at the corresponding position in the initial specular information; A rendering module for rendering the hair model using the target lighting information and the target specular information to generate a rendered hair model; When the rendering module renders the hair model using the target lighting information and the target specular information to generate a rendered hair model, it is configured to: Acquire a variety of color information; and determine an initial reference value corresponding to each coordinate data of the hair model in the vertical direction; wherein the initial reference value matches the coordinate data; Adjust the initial reference value corresponding to each coordinate data to obtain an adjusted reference value; Fuse the variety of color information according to the adjusted reference value corresponding to each coordinate data to generate target color information corresponding to each coordinate data of the hair model in the vertical direction; Render the hair model using the target color information, the target lighting information, and the target specular information to generate a rendered hair model; When the rendering module adjusts the initial reference value corresponding to each coordinate data to obtain an adjusted reference value, it is configured to: perform a power operation on the initial reference value corresponding to each coordinate data based on a determined target number of times to obtain an adjusted reference value; wherein the target number of times is negatively correlated with the color gradient range after fusing a variety of colors.
9. An electronic device, characterized in that, Comprising: A processor, a memory, and a bus, the memory stores machine-readable instructions executable by the processor, when the electronic device runs, the processor communicates with the memory through the bus, and when the machine-readable instructions are executed by the processor, the steps of the model rendering method according to any one of claims 1 to 7 are executed.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is run by the processor, the steps of the model rendering method according to any one of claims 1 to 7 are executed.
Citation Information
Patent Citations
Hair highlight rendering method, device and equipment and storage medium
CN113763527A