Hair rendering method, device, electronic device and storage medium

By projecting hair into lattice voxels and performing smoothing and ray tracing, the shadow flickering problem in hair rendering is solved, achieving more natural hair rendering effects and computing efficiency.

CN114693852BActive Publication Date: 2025-08-19BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210313387.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-28
Publication Date
2025-08-19
Estimated Expiration
2042-03-28

AI Technical Summary

Technical Problem

The hair rendering method in the prior art tends to cause shadow flickering effects, especially when there are slight displacements between hairs, the shadow effect is unnatural.

Method used

The hair to be rendered is projected into voxels in multiple lattices of equal size, and the total number of vertices in each lattice is smoothed. The shadow effect of each vertex is obtained through ray tracing, and finally rendered according to the shadow effect of the voxel.

Benefits of technology

It effectively avoids shadow flickering effects, improves the authenticity of hair rendering, and reduces the computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114693852B_ABST
    Figure CN114693852B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a hair rendering method, apparatus, electronic device, and storage medium. The method comprises: projecting the hair to be rendered into multiple voxels in equal-sized lattices based on the geometric data of the hair to be rendered; obtaining the total number of vertices contained in each lattice based on the number of voxels in each lattice; smoothing the total number of vertices in each lattice to obtain multiple remaining vertices contained in each lattice after processing; ray tracing each remaining vertex to obtain a shadow effect of each remaining vertex; obtaining a shadow effect of each voxel based on the shadow effect of each remaining vertex; and rendering the hair to be rendered based on the shadow effect of each voxel. In the present disclosure, the total number of vertices in each lattice transitions smoothly, so there will be no significant difference in the shadow effects presented by the multiple voxels contained in adjacent lattices, thereby avoiding the shadow flickering effect when rendering the hair to be rendered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer graphics, and in particular to a hair rendering method, device, electronic device, and storage medium. Background Art

[0002] In the field of computer graphics, hair is a huge quantity and casts different shadows under different lighting conditions. Therefore, rendering realistic hair effects is a challenging task. The hair rendering methods used in related technologies often cause the rendered hair to have abnormal flickering shadows.

[0003] For example, there's a noticeable brightness difference between hair A and its neighbor, hair B. If there's a slight displacement between the two hairs, causing hair A to move to the position of hair B, this will cause a flickering shadow to appear at the location of hair B. Preventing this flickering shadow effect in rendered hair is a pressing technical issue. Summary of the Invention

[0004] To overcome the problems existing in the related art, the present disclosure provides a hair rendering method, device, electronic device and storage medium. The technical solution of the present disclosure is as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, a hair rendering method is provided, comprising:

[0006] Projecting the hair to be rendered into a plurality of voxels in a lattice of equal size according to geometric data of the hair to be rendered;

[0007] According to the number of voxels in each of the lattices, obtaining the total number of vertices contained in each of the lattices;

[0008] Performing smoothing processing on the total number of vertices in each of the lattices to obtain a plurality of remaining vertices contained in each of the lattices after processing;

[0009] Performing ray tracing on each of the remaining vertices to obtain a shadow effect of each of the remaining vertices;

[0010] Obtaining a shadow effect of each voxel according to the shadow effect of each remaining vertex;

[0011] The hair to be rendered is rendered according to the shadow effect of each voxel.

[0012] Optionally, the smoothing process is performed on the total number of vertices in each of the lattices to obtain a plurality of remaining vertices contained in each of the lattices after the processing, including:

[0013] According to the total number of vertices contained in each lattice and the adjacent lattices, some vertices are eliminated so that the difference between the total number of vertices contained in each lattice and the total number of vertices contained in the adjacent lattices does not exceed the difference threshold, thereby obtaining multiple remaining vertices contained in each lattice after processing.

[0014] Optionally, performing ray tracing on each of the remaining vertices to obtain a shadow effect of each of the remaining vertices includes:

[0015] Obtaining the initial incident light direction and the normal direction of each of the remaining vertices;

[0016] Obtaining, according to the direction of the initial incident light and the normal direction of each of the remaining vertices, a plurality of reflected light rays pointing into the hemispherical space from each of the remaining vertices;

[0017] Obtaining the illuminance received by each of the remaining vertices at each sampling step according to the multiple reflected rays of each of the remaining vertices pointing into the hemispherical space;

[0018] A shadow effect of each of the remaining vertices is obtained according to the illumination received by each of the remaining vertices in each sampling step.

[0019] Optionally, rendering the hair to be rendered according to the shadow effect of each voxel includes:

[0020] Obtaining the light intensity of each hair in the hair to be rendered;

[0021] Obtaining a layered effect formed by illumination of the hair to be rendered based on the illumination intensity of each hair in the hair to be rendered and the shadow effects of the plurality of voxels on each hair;

[0022] The hair to be rendered is rendered based on a layered effect formed by the hair to be rendered being illuminated by light.

[0023] Optionally, the rendering of the hair to be rendered based on the layered effect formed by the hair to be rendered being illuminated includes:

[0024] Calculating a transmission effect and / or a transmission-reflection effect of the hair to be rendered based on a layered effect formed by illumination of the hair to be rendered;

[0025] The hair to be rendered is rendered according to the transmission effect and / or transmission-reflection effect of the hair to be rendered.

[0026] Optionally, the rendering of the hair to be rendered based on the layered effect formed by the hair to be rendered being illuminated includes:

[0027] Calculating the layered effect formed by the hair to be rendered in a backlight state based on the layered effect formed by the hair to be rendered under illumination;

[0028] Calculating a transmission-reflection-transmission effect of the hair to be rendered in the backlight state according to a layered effect formed by the hair to be rendered in the backlight state;

[0029] The hair to be rendered is rendered according to a transmission-reflection-transmission effect of the hair to be rendered in a backlight state.

[0030] According to a second aspect of an embodiment of the present disclosure, there is provided a hair rendering device, comprising:

[0031] A hair projection module is configured to project the hair to be rendered into voxels in a plurality of equally sized lattices according to geometric data of the hair to be rendered;

[0032] A vertex total number acquisition module is configured to acquire the total number of vertices contained in each of the lattices according to the number of voxels in each of the lattices;

[0033] a smoothing processing module configured to perform smoothing on the total number of vertices in each of the lattices to obtain a plurality of remaining vertices contained in each of the lattices after processing;

[0034] a ray tracing module, configured to perform ray tracing on each of the remaining vertices to obtain a shadow effect of each of the remaining vertices;

[0035] a shadow effect determination module, configured to obtain a shadow effect of each voxel according to the shadow effect of each of the remaining vertices;

[0036] The hair rendering module is configured to render the hair to be rendered according to the shadow effect of each voxel.

[0037] Optionally, the smoothing processing module includes:

[0038] The vertex culling unit is configured to cull some vertices according to the total number of vertices contained in each lattice and the adjacent lattices, so that the difference between the total number of vertices contained in each lattice and the total number of vertices contained in the adjacent lattices does not exceed the difference threshold, thereby obtaining multiple remaining vertices contained in each lattice after processing.

[0039] Optionally, the ray tracing module includes:

[0040] a direction acquisition unit, configured to acquire the direction of the initial incident light and the normal direction of each of the remaining vertices;

[0041] a reflected light acquisition unit configured to obtain a plurality of reflected light rays pointing into the hemispherical space for each of the remaining vertices according to the direction of the initial incident light and the normal direction of each of the remaining vertices;

[0042] an illumination acquisition unit configured to obtain the illumination received by each of the remaining vertices at each sampling step based on a plurality of reflected rays directed into the hemispherical space of each of the remaining vertices;

[0043] The shadow determination unit is configured to obtain the shadow effect of each of the remaining vertices according to the illumination received by each of the remaining vertices in each sampling step.

[0044] Optionally, the hair rendering module includes:

[0045] a light intensity determining unit, configured to obtain the light intensity of each hair in the hair to be rendered;

[0046] a gradation effect determining unit configured to obtain a gradation effect formed by illumination of the hair to be rendered based on the illumination intensity of each hair in the hair to be rendered and the shadow effect of the plurality of voxels on each hair;

[0047] The rendering unit is configured to render the hair to be rendered based on a layered effect formed by the hair to be rendered being illuminated by light.

[0048] Optionally, the rendering unit includes:

[0049] A first calculation subunit is configured to calculate a transmission effect and / or a transmission-reflection effect of the hair to be rendered based on a layered effect formed by illumination of the hair to be rendered;

[0050] The first rendering subunit is configured to render the hair to be rendered according to the transmission effect and / or transmission-reflection effect of the hair to be rendered.

[0051] Optionally, the rendering unit includes:

[0052] a backlight gradation effect determination subunit, configured to calculate the gradation effect formed by the hair to be rendered in a backlight state based on the gradation effect formed by the hair to be rendered being illuminated;

[0053] A second calculation subunit is configured to calculate a transmission-reflection-transmission effect of the hair to be rendered in the backlight state according to a layered effect formed by the hair to be rendered in the backlight state;

[0054] The second rendering sub-unit is configured to render the hair to be rendered according to the transmission-reflection-transmission effect of the hair to be rendered in a backlight state.

[0055] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the hair rendering method as described in the first aspect.

[0056] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can implement the hair rendering method as described in the first aspect.

[0057] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program, which implements the hair rendering method as described in the first aspect when executed by a processor.

[0058] The technical solutions provided by the embodiments of the present disclosure may have the following beneficial effects:

[0059] In the present disclosure, the hair to be rendered is projected into voxels in multiple equally sized lattices, and the total number of vertices in each lattice is smoothed. This results in a smooth transition between the total number of remaining vertices between adjacent lattices. The shadow effect for each voxel is then derived based on the shadow effect of each remaining vertex. Because the transition between the total number of remaining vertices in adjacent lattices is smooth, the shadow effects presented by the multiple voxels in adjacent lattices do not exhibit noticeable brightness differences. Consequently, when rendering hair based on the voxel shadow effects, even if the hair is displaced, the shadow effects between adjacent lattices do not exhibit noticeable brightness differences, preventing flickering shadows. Furthermore, smoothing the total number of vertices on a lattice-by-lattice basis can reduce computational complexity compared to rasterizing the hair strands and smoothing the total number of vertices in each hair.

[0060] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0062] Figure 1 is a flowchart of a hair rendering method according to an exemplary embodiment;

[0063] Figure 2 is a hierarchical rendering of hair to be rendered in the present disclosure;

[0064] Figure 3 is a schematic diagram of applying the layered effect of hair to be rendered to hair rendering in the present disclosure;

[0065] Figure 4 This is a rendering of the hair in the present disclosure;

[0066] Figure 5 is a block diagram of a hair rendering device according to an exemplary embodiment;

[0067] Figure 6 The figure is a block diagram of a hair rendering device according to an exemplary embodiment. DETAILED DESCRIPTION

[0068] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0069] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.

[0070] Figure 1 FIG. 1 is a flow chart of a hair rendering method according to an exemplary embodiment. Figure 1 As shown, the hair rendering method can be used in electronic devices such as computers, mobile phones, and tablet computers, and includes the following steps.

[0071] In step S11 , the hair to be rendered is projected into a plurality of voxels in a lattice of equal size according to the geometric data of the hair to be rendered.

[0072] In some games, videos, and images, hair rendering may be required. To render hair, the 3D geometric data (e.g., point cloud data) of the hair to be rendered is obtained and projected into voxels. Voxels are similar to the basic unit of pixels in 2D space, and voxels are the basic unit of 3D space. Pixels can be stitched together to form a 2D image, and voxels can be stitched together to construct a corresponding 3D scene model. Each voxel has multiple vertices.

[0073] To save computational effort, you can preset the spatial range that the voxels will occupy after projecting them into voxels based on the 3D geometric data of the hair to be rendered. To account for the flying nature of hair, the preset voxel spatial range can be slightly larger to cover the entire 3D geometric data of the hair to be rendered.

[0074] The preset projection space is evenly divided into multiple, neatly connected, and equally sized grids. After projecting the hair to be rendered into the preset projection space, grids that do not contain voxels are removed. A lattice contains voxels, and therefore, a lattice contains vertices. Alternatively, this can be understood as dividing the projected voxels into multiple, neatly connected, and equally sized grids, with each grid containing at least a portion of the voxel.

[0075] A voxel coordinate system is established within the preset projection space, and the 3D geometric data of the hair to be rendered is axially aligned with the voxel coordinate system. The 3D geometric data of the hair to be rendered is projected into the preset projection space. Projection refers to the process of rounding up or down, and the hair to be rendered is represented by multiple projected voxels.

[0076] In step S12, the total number of vertices contained in each lattice is obtained according to the number of voxels in each lattice.

[0077] The number of vertices contained in each voxel can be obtained. Therefore, based on the number of voxels in each lattice, the total number of vertices contained in each lattice can be obtained.

[0078] In step S13, the total number of vertices in each of the lattices is smoothed to obtain a plurality of remaining vertices contained in each of the lattices after processing.

[0079] The total number of vertices in each lattice can be smoothed by one or more filtering operations, so that the total number of vertices between adjacent lattices after the processing is smoother.

[0080] Optionally, the difference in the total number of vertices contained in each lattice and the lattices adjacent to the lattice is compared. When the difference exceeds a difference threshold, the vertices in the lattice with a larger total number of vertices are randomly partially eliminated so that the difference between the total number of vertices contained in each lattice and the total number of vertices of the adjacent lattices does not exceed the difference threshold, thereby obtaining the remaining vertices contained in each processed lattice.

[0081] For example, if a lattice contains 24 vertices, and its adjacent lattices each contain 10 vertices, and the preset threshold is 5, then the vertices in the lattice are randomly removed so that the difference in the number of vertices between the lattice and the surrounding lattices is less than or equal to 5.

[0082] A lattice is a lattice within a predefined three-dimensional projected space. Therefore, a lattice's neighbors are all the lattices surrounding it in the three-dimensional space. For example, the center block of a 3×3 Rubik's Cube has 26 neighboring blocks surrounding it. Therefore, a lattice that is not at the edge has 26 neighboring blocks.

[0083] Optionally, the transition between the total number of vertices in each lattice can be smoothed by applying a Gaussian filter to the total number of vertices in each lattice.

[0084] In this way, smoothing the total number of vertices in each lattice on a lattice basis can reduce computational complexity compared to rasterizing the hair strands and smoothing the total number of vertices in each hair.

[0085] In step S14, ray tracing is performed on each of the remaining vertices to obtain a shadow effect of each of the remaining vertices.

[0086] After hitting the remaining vertices, the light will be reflected, and the reflected light will also hit the other remaining vertices. Each reflection of the light is considered as a sampling step. Ray tracing (RayMatching) is performed on the light received and reflected by each remaining vertex to obtain the possible illumination received by each remaining vertex at each sampling step (including the light emitted by the light source and the light reflected by other remaining vertices). The illumination received by each remaining vertex at each sampling step is averaged to obtain the average illumination of each remaining vertex. Based on the average illumination of each remaining vertex, the shadow effect of each remaining vertex can be obtained.

[0087] The higher the average illumination of a remaining vertex, the higher the brightness of the remaining vertex. According to the brightness of each remaining vertex, a shadow effect of each remaining vertex can be obtained.

[0088] In step S15 , the shadow effect of each voxel is obtained according to the shadow effect of each remaining vertex.

[0089] Each voxel contains multiple vertices. After some vertices are randomly removed, the shadow effect of each voxel can be obtained by combining the shadow effects of the remaining vertices in each voxel. The higher the average illumination of the multiple remaining vertices in a voxel, the higher the average illumination of the voxel, and the higher the brightness of the voxel. Based on the brightness of each voxel, the shadow effect of each voxel can be obtained.

[0090] In step S16, the hair to be rendered is rendered according to the shadow effect of each voxel.

[0091] After obtaining the shadow effect of each voxel, the hair to be rendered can be rendered according to the desired effect to obtain the rendered hair.

[0092] The hair rendering method provided by this exemplary embodiment projects the hair to be rendered into voxels in multiple equally sized lattices and smoothes the total number of vertices in each lattice. This results in a smooth transition between the total number of remaining vertices between adjacent lattices. The shadow effect for each voxel is then derived based on the shadow effect of each remaining vertex. Because the transition between the total number of remaining vertices in adjacent lattices is smooth, the shadow effects presented by the multiple voxels in adjacent lattices do not exhibit noticeable brightness differences. Consequently, when rendering hair based on voxel shadow effects, even if the hair is displaced, the shadow effects between adjacent lattices do not exhibit noticeable brightness differences, preventing flickering. Furthermore, smoothing the total number of vertices on a lattice-by-lattice basis reduces computational complexity compared to rasterizing the hair strands and smoothing the total number of vertices within each hair.

[0093] On the basis of the above technical solution, ray tracing is performed on each of the remaining vertices to obtain the shadow effect of each of the remaining vertices, including: obtaining the direction of the initial incident light and the normal direction of each of the remaining vertices; obtaining multiple reflected light rays pointing into the hemispherical space for each of the remaining vertices according to the initial incident light direction and the normal direction of each of the remaining vertices; obtaining the illuminance received by each of the remaining vertices in each sampling step according to the multiple reflected light rays pointing into the hemispherical space for each of the remaining vertices; and obtaining the shadow effect of each of the remaining vertices according to the illuminance received by each of the remaining vertices in each sampling step.

[0094] Because the reflection angle of a ray is equal to the incident angle, the incident angle is the angle between the incident ray and the normal, and the reflection angle is the angle between the reflected ray and the normal. Therefore, in order to perform ray tracing, it is necessary to obtain the direction of the initial incident ray emitted by the light source and the normal direction of each remaining vertex.

[0095] When each remaining vertex receives the initial incident light from the light source, multiple reflected rays pointing into the hemispherical space generated by each remaining vertex based on the initial incident light can be obtained according to the initial incident light method and each remaining normal direction. The initial incident light refers to a light with a preset light intensity. In the process of rendering the hair to be rendered, the light emitted by the light source may have a different light intensity from the initial incident light, but the direction of reflection of light of different intensities between vertices is the same. Therefore, in the actual rendering process, the illumination received by each vertex can be adjusted according to the same proportion based on the light intensity of the light emitted by the light source actually received by the hair to be rendered.

[0096] For each remaining vertex, after the reflected light reaches the other remaining vertices, the other remaining vertices will reflect the reflected light again. Therefore, in order to obtain the illumination that each remaining vertex can receive (the more light it receives, the stronger the illumination), each reflection of the light can be used as a sampling step to obtain the illumination received by each remaining vertex at each sampling step. For each remaining vertex, the light received by the remaining vertex in all sampling steps is accumulated and averaged to obtain the illumination of the remaining vertex.

[0097] Based on the illumination of each vertex, the shadow effect of each vertex can be obtained. For example, if the illumination of a vertex is high and the illumination of the surrounding vertices is low, a shadow effect with different brightness and darkness can be formed. However, the granularity of a vertex is too small, so the hair to be rendered can be rendered based on the shadow effect contained in a lattice, wherein the shadow effect contained in a lattice is formed by the shadow effect of each voxel contained in the lattice. The shadow effect of a voxel is formed based on the shadow effect of multiple remaining vertices contained in the voxel. For example, if the illumination of a voxel is high and the illumination of the surrounding voxels is low, a shadow effect with different brightness and darkness can be formed. The higher the total illumination of the multiple remaining vertices contained in a voxel, the lower the probability of the voxel being blocked, and the brighter the hair corresponding to the voxel.

[0098] The hair rendering method provided by this exemplary embodiment performs ray tracing on each remaining vertex to obtain the illumination of each remaining vertex, and then obtain the shadow effect of each remaining vertex, so that each voxel can subsequently obtain its own shadow effect based on the shadow effects of the remaining vertices it contains, and then render the hair to be rendered based on the shadow effect of each voxel itself.

[0099] Based on the above technical solution, after obtaining the illumination of each remaining vertex, the illumination of each remaining vertex can be stored at that vertex, for example, together with the data of that vertex. Subsequently, when rendering the hair to be rendered, the stored illumination of each remaining vertex can be directly obtained, and subsequent processing can be performed based on the obtained illumination of each remaining vertex to achieve rendering of the hair to be rendered.

[0100] Based on the above technical solution, the hair to be rendered is rendered according to the shadow effect of each voxel, including: obtaining the light intensity of each hair in the hair to be rendered; obtaining the layering effect formed by the light illumination of the hair to be rendered based on the light intensity of each hair in the hair to be rendered and the shadow effect of multiple voxels on each hair; and rendering the hair to be rendered based on the layering effect formed by the light illumination of the hair to be rendered.

[0101] When rendering hair, the actual illumination intensity of each hair is obtained. Based on the actual illumination intensity of each hair, the shadow effects of multiple voxels cast by the hair are adjusted in the same proportion.

[0102] Based on the adjusted shadow effects of all voxels, a layered effect can be obtained for the hair to be rendered as a whole after being illuminated. After obtaining the layered effect for the hair to be rendered after being illuminated, the hair to be rendered can be rendered to look like what it would look like in different environments.

[0103] Figure 2 This is a layered rendering of the hair to be rendered in this disclosure. The thicker the layer of hair to be rendered, the greater the density. The denser the hair to be rendered, the more self-occluded it will be. The lower layer of hair covered by the upper layer of hair will receive less illumination. Figure 3 This is a schematic diagram of using the layered effect of the hair to be rendered for hair rendering in the present disclosure. Figure 4 This is the hair rendering effect diagram in this disclosure. From the diagram, we can clearly see the light transmittance of the hair edge, the thick feeling inside and the shadow effect. Therefore, the rendered hair is more realistic.

[0104] The hair rendering method provided by this exemplary embodiment takes into account the actual lighting conditions of the hair to be rendered, and can thereby obtain a layered effect formed by the lighting of the hair to be rendered. Then, based on the layered effect, the hair to be rendered can be directly rendered to obtain the desired rendering effect.

[0105] On the basis of the above technical solution, the hair to be rendered is rendered based on the layered effect formed by the light illumination of the hair to be rendered, including: calculating the transmission effect and / or transmission-reflection effect of the hair to be rendered based on the layered effect formed by the light illumination of the hair to be rendered; and rendering the hair to be rendered according to the transmission effect and / or transmission-reflection effect of the hair to be rendered.

[0106] Hair is a translucent material that not only reflects light but also transmits it. Depending on the layered effect created by the lighting on the hair being rendered, you can render it with a transmissive and / or transmissive-reflective effect. The transmissive effect creates a relatively transparent effect, while the transmissive-reflective effect creates a transparent and high-brightness effect.

[0107] After obtaining different effects of the hair to be rendered, the hair to be rendered can be rendered according to its own characteristics (e.g., color), thereby obtaining a more realistic rendering effect. The method of rendering the hair to be rendered can refer to the hair rendering method in the related art.

[0108] The hair rendering method provided by this exemplary embodiment can calculate the transmission effect and / or transmission-reflection effect of the hair to be rendered based on the layered effect of the hair to be rendered, thereby achieving the rendering of the hair to be rendered based on different effects and obtaining a more realistic rendering effect.

[0109] On the basis of the above technical solution, the hair to be rendered is rendered based on the layered effect formed by the light illumination of the hair to be rendered, including: calculating the layered effect formed by the hair to be rendered in a backlit state based on the layered effect formed by the light illumination of the hair to be rendered; calculating the transmission-reflection-transmission effect of the hair to be rendered in the backlit state based on the layered effect formed by the hair to be rendered in the backlit state; and rendering the hair to be rendered based on the transmission-reflection-transmission effect of the hair to be rendered in the backlit state.

[0110] After determining the depth of the hair under illumination, we can also calculate the depth of the hair under backlighting. In backlighting, the edges of the hair will appear more transparent, while the interior of the hair will appear thicker and denser.

[0111] The transmission-reflection-transmission effect refers to the effect formed by light penetrating the stratum corneum into the cortex, refracting through the inner layer of the stratum corneum and then transmitting into the air.

[0112] After determining that the hair to be rendered has a transmission-reflection-transmission effect, the hair to be rendered can be rendered according to the desired characteristics of the hair to be rendered (for example, color), thereby obtaining a relatively realistic rendering effect of the hair to be rendered under backlight conditions. The method for rendering the hair to be rendered can refer to the hair rendering method in the related art.

[0113] The hair rendering method provided by this exemplary embodiment can calculate the transmission-reflection-transmission effect of the hair to be rendered in the backlight state based on the layered effect formed by the hair to be rendered in the backlight state, thereby realizing the rendering of the hair to be rendered and obtaining a more realistic rendering effect of the hair to be rendered in the backlight state.

[0114] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.

[0115] Figure 5 is a block diagram of a hair rendering device according to an exemplary embodiment, referring to Figure 5 The device includes a hair projection module 51, a vertex total acquisition module 52, a smoothing processing module 53, a ray tracing module 54, a shadow effect determination module 55 and a hair rendering module 56.

[0116] The hair projection module 51 is configured to project the hair to be rendered into a plurality of voxels in a lattice of equal size according to the geometric data of the hair to be rendered;

[0117] The vertex total number acquisition module 52 is configured to acquire the total number of vertices contained in each lattice according to the number of voxels in each lattice;

[0118] The smoothing processing module 53 is configured to perform smoothing on the total number of vertices in each of the lattices to obtain a plurality of remaining vertices contained in each of the lattices after processing;

[0119] The ray tracing module 54 is configured to perform ray tracing on each of the remaining vertices to obtain a shadow effect of each of the remaining vertices;

[0120] The shadow effect determination module 55 is configured to obtain the shadow effect of each voxel according to the shadow effect of each remaining vertex;

[0121] The hair rendering module 56 is configured to render the hair to be rendered according to the shadow effect of each voxel.

[0122] Optionally, the smoothing processing module 53 includes:

[0123] The vertex culling unit is configured to cull some vertices according to the total number of vertices contained in each lattice and the adjacent lattices, so that the difference between the total number of vertices contained in each lattice and the total number of vertices contained in the adjacent lattices does not exceed the difference threshold, thereby obtaining multiple remaining vertices contained in each lattice after processing.

[0124] Optionally, the ray tracing module 54 includes:

[0125] a direction acquisition unit, configured to acquire the direction of the initial incident light and the normal direction of each of the remaining vertices;

[0126] a reflected light acquisition unit configured to obtain a plurality of reflected light rays pointing into the hemispherical space for each of the remaining vertices according to the direction of the initial incident light and the normal direction of each of the remaining vertices;

[0127] an illumination acquisition unit configured to obtain the illumination received by each of the remaining vertices at each sampling step based on a plurality of reflected rays directed into the hemispherical space of each of the remaining vertices;

[0128] The shadow determination unit is configured to obtain the shadow effect of each of the remaining vertices according to the illumination received by each of the remaining vertices in each sampling step.

[0129] Optionally, the hair rendering module 56 includes:

[0130] a light intensity determining unit, configured to obtain the light intensity of each hair in the hair to be rendered;

[0131] a gradation effect determining unit configured to obtain a gradation effect formed by illumination of the hair to be rendered based on the illumination intensity of each hair in the hair to be rendered and the shadow effect of the plurality of voxels on each hair;

[0132] The rendering unit is configured to render the hair to be rendered based on a layered effect formed by the hair to be rendered being illuminated by light.

[0133] Optionally, the rendering unit includes:

[0134] A first calculation subunit is configured to calculate a transmission effect and / or a transmission-reflection effect of the hair to be rendered based on a layered effect formed by illumination of the hair to be rendered;

[0135] The first rendering subunit is configured to render the hair to be rendered according to the transmission effect and / or transmission-reflection effect of the hair to be rendered.

[0136] Optionally, the rendering unit includes:

[0137] a backlight gradation effect determination subunit, configured to calculate the gradation effect formed by the hair to be rendered in a backlight state based on the gradation effect formed by the hair to be rendered being illuminated;

[0138] A second calculation subunit is configured to calculate a transmission-reflection-transmission effect of the hair to be rendered in the backlight state according to a layered effect formed by the hair to be rendered in the backlight state;

[0139] The second rendering sub-unit is configured to render the hair to be rendered according to the transmission-reflection-transmission effect of the hair to be rendered in a backlight state.

[0140] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0141] Figure 6 FIG6 is a block diagram of an apparatus 600 for generating hair rendering according to an exemplary embodiment. For example, the apparatus 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0142] Reference Figure 6, the apparatus 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .

[0143] The processing component 602 generally controls the overall operation of the device 600, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 602 may include one or more modules to facilitate interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.

[0144] The memory 604 is configured to store various types of data to support operations on the device 600. Examples of such data include instructions for any application or method operating on the device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0145] The power supply component 606 provides power to the various components of the device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 600.

[0146] The multimedia component 608 includes a screen that provides an output interface between the device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.

[0147] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), which is configured to receive external audio signals when the device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.

[0148] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.

[0149] The sensor assembly 614 includes one or more sensors for providing various aspects of the status assessment of the device 600. For example, the sensor assembly 614 can detect the open / closed state of the device 600, the relative positioning of components, such as the display and keypad of the device 600. The sensor assembly 614 can also detect changes in the position of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, the orientation or acceleration / deceleration of the device 600, and temperature changes of the device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an accelerometer, a gyroscope, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0150] The communication component 616 is configured to facilitate wired or wireless communication between the device 600 and other devices. The device 600 can access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0151] In an exemplary embodiment, the device 600 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-mentioned hair rendering method.

[0152] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the instructions can be executed by the processor 620 of the apparatus 600 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0153] In an exemplary embodiment, a computer program product is also provided, comprising readable program code, which can be executed by the processor 620 of the apparatus 600 to implement the above-described personnel authority management method. Optionally, the program code can be stored in a storage medium of the apparatus 600, which can be a non-transitory computer-readable storage medium, such as a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, or the like.

[0154] Other embodiments of the present invention will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the invention being indicated by the following claims.

[0155] It should be understood that the present invention is not limited to the exact construction described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A hair rendering method, characterized in that: include: Projecting the hair to be rendered into a plurality of voxels in a lattice of equal size according to geometric data of the hair to be rendered; According to the number of voxels in each of the lattices, obtaining the total number of vertices contained in each of the lattices; Performing smoothing processing on the total number of vertices in each of the lattices to obtain a plurality of remaining vertices contained in each of the lattices after processing; Obtaining the direction of an initial incident light and the normal direction of each of the remaining vertices; obtaining, based on the direction of the initial incident light and the normal direction of each of the remaining vertices, a plurality of reflected light rays pointing into the hemispherical space for each of the remaining vertices; obtaining, based on the plurality of reflected light rays pointing into the hemispherical space for each of the remaining vertices, the illuminance received by each of the remaining vertices at each sampling step; and obtaining, based on the illuminance received by each of the remaining vertices at each sampling step, a shadow effect for each of the remaining vertices; Obtaining a shadow effect of each voxel according to the shadow effect of each remaining vertex; Obtaining the light intensity of each hair in the hair to be rendered; obtaining a layered effect formed by the light illumination of the hair to be rendered based on the light intensity of each hair in the hair to be rendered and the shadow effect of the multiple voxels on each hair; and rendering the hair to be rendered based on the layered effect formed by the light illumination of the hair to be rendered.

2. The method according to claim 1, characterized in that The smoothing process is performed on the total number of vertices in each of the lattices to obtain a plurality of remaining vertices contained in each of the lattices after the processing, including: According to the total number of vertices contained in each lattice and the adjacent lattices, some vertices are eliminated so that the difference between the total number of vertices contained in each lattice and the total number of vertices contained in the adjacent lattices does not exceed the difference threshold, thereby obtaining multiple remaining vertices contained in each lattice after processing.

3. The method according to claim 1, characterized in that The rendering of the hair to be rendered based on the layered effect formed by the light illumination of the hair to be rendered comprises: Calculating a transmission effect and / or a transmission-reflection effect of the hair to be rendered based on a layered effect formed by illumination of the hair to be rendered; The hair to be rendered is rendered according to the transmission effect and / or transmission-reflection effect of the hair to be rendered.

4. The method according to claim 1, wherein The rendering of the hair to be rendered based on the layered effect formed by the light illumination of the hair to be rendered comprises: Calculating the layered effect formed by the hair to be rendered in a backlight state based on the layered effect formed by the hair to be rendered under illumination; Calculating a transmission-reflection-transmission effect of the hair to be rendered in the backlight state according to a layered effect formed by the hair to be rendered in the backlight state; The hair to be rendered is rendered according to a transmission-reflection-transmission effect of the hair to be rendered in a backlight state.

5. A hair rendering device, characterized in that: include: A hair projection module is configured to project the hair to be rendered into voxels in a plurality of equally sized lattices according to geometric data of the hair to be rendered; A vertex total number acquisition module is configured to acquire the total number of vertices contained in each of the lattices according to the number of voxels in each of the lattices; a smoothing processing module configured to perform smoothing on the total number of vertices in each of the lattices to obtain a plurality of remaining vertices contained in each of the lattices after processing; The ray tracing module is configured to obtain an initial incident light direction and a normal direction of each of the remaining vertices; obtain a plurality of reflected light rays pointing into the hemispherical space for each of the remaining vertices based on the initial incident light direction and the normal direction of each of the remaining vertices; obtain an illumination received by each of the remaining vertices at each sampling step based on the plurality of reflected light rays pointing into the hemispherical space; and obtain a shadow effect of each of the remaining vertices based on the illumination received by each of the remaining vertices at each sampling step; a shadow effect determination module, configured to obtain a shadow effect of each voxel according to the shadow effect of each of the remaining vertices; Hair rendering module, including: a light intensity determining unit, configured to obtain the light intensity of each hair in the hair to be rendered; a gradation effect determining unit configured to obtain a gradation effect formed by illumination of the hair to be rendered based on the illumination intensity of each hair in the hair to be rendered and the shadow effect of the plurality of voxels on each hair; The rendering unit is configured to render the hair to be rendered based on a layered effect formed by the hair to be rendered being illuminated by light.

6. The device according to claim 5, characterized in that The smoothing processing module includes: The vertex culling unit is configured to cull some vertices according to the total number of vertices contained in each lattice and the adjacent lattices, so that the difference between the total number of vertices contained in each lattice and the total number of vertices contained in the adjacent lattices does not exceed the difference threshold, thereby obtaining multiple remaining vertices contained in each lattice after processing.

7. The device according to claim 5, characterized in that The rendering unit includes: A first calculation subunit is configured to calculate a transmission effect and / or a transmission-reflection effect of the hair to be rendered based on a layered effect formed by illumination of the hair to be rendered; The first rendering subunit is configured to render the hair to be rendered according to the transmission effect and / or transmission-reflection effect of the hair to be rendered.

8. The device according to claim 5, characterized in that The rendering unit includes: a backlight gradation effect determination subunit, configured to calculate the gradation effect formed by the hair to be rendered in a backlight state based on the gradation effect formed by the hair to be rendered being illuminated; A second calculation subunit is configured to calculate a transmission-reflection-transmission effect of the hair to be rendered in the backlight state according to a layered effect formed by the hair to be rendered in the backlight state; The second rendering sub-unit is configured to render the hair to be rendered according to the transmission-reflection-transmission effect of the hair to be rendered in a backlight state.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the hair rendering method according to any one of claims 1 to 4. 10 . A computer-readable storage medium, wherein when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the hair rendering method according to claim 1 .

11. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the hair rendering method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Hair rendering method and device, electronic equipment and storage medium

    CN109685876A

  • Hair rendering method and device, electronic equipment and readable storage medium

    CN112669425A