Hair rendering method, device, electronic device and storage medium
Through topology optimization and detail engraving of hair models, combined with texture map optimization and baking technology, the problem of low hair rendering performance in the existing technology is solved, and efficient and accurate hair rendering effect is achieved.
Patent Information
- Application Number
- CN202411746497.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-04
AI Technical Summary
The existing technology has too low performance in hair rendering and cannot effectively improve the visual effect of rendering results, especially in non-realistic hair rendering requirements.
By obtaining a model with an initial hair morphology, topological optimization and detail engraving, hair models with different surface count levels are obtained; then, using texture map optimization and baking, high-precision hair texture maps are generated, and finally rendering the hair model with a lower surface count level is lower.
It improves the efficiency of hair rendering, while retaining the accuracy of the stylized hair effect, and significantly improving the overall performance.
Smart Images

Figure CN119762645A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of rendering technology, and in particular to a hair rendering method, device, electronic device and storage medium. Background Art
[0002] Hair rendering is a common technology in the field of 3D model rendering. How to efficiently obtain a hair model that can be used for rendering and conforms to the expected style is the key to improving model generation and rendering efficiency.
[0003] The existing technology usually produces a complex and detailed hair model, and then generates a low-poly hair model based on the detailed hair model for actual rendering. This method requires a lot of production costs. In some non-realistic hair rendering requirements, this method cannot improve the visual effect of the rendering results, and there is a technical problem of low efficiency. Summary of the invention
[0004] In view of this, an object of the present disclosure is to provide a hair rendering method, device, electronic device and storage medium to improve the efficiency of stylized hair rendering.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for rendering hair, the method comprising: obtaining a first model having an initial form of hair, performing topological optimization on the first model to obtain a second model; performing detail sculpting on the second model to obtain a third model; wherein the number of faces of the third model is greater than that of the second model; obtaining a first texture map, and generating a second texture map for the second model based on the first texture map; wherein the second texture map is of a different type from the first texture map; baking the texture of the third model to the second model to obtain a third texture map of the second model; rendering the second model based on the first texture map, the second texture map and the third texture map to obtain a rendering result of the hair.
[0006] In a second aspect, an embodiment of the present disclosure provides a hair rendering device, the device comprising: an acquisition module, used to acquire a first model having an initial form of hair, and perform topological optimization on the first model to obtain a second model; a carving module, used to perform detail carving on the second model to obtain a third model; wherein the number of faces of the third model is greater than that of the second model; a generation module, used to acquire a first texture map, and generate a second texture map for the second model based on the first texture map; wherein the second texture map is of a different type from the first texture map; a baking module, used to bake the texture of the third model to the second model to obtain the third texture map of the second model; a rendering module, used to render the second model based on the first texture map, the second texture map and the third texture map to obtain a rendering result of the hair.
[0007] In a third aspect, an embodiment of the present disclosure provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned hair rendering method.
[0008] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned hair rendering method.
[0009] The embodiments of the present disclosure bring the following beneficial effects:
[0010] The above-mentioned hair rendering method, device, electronic device and storage medium are based on a model with a general hair shape, and obtain hair models with different levels of face numbers through topology optimization and detail carving. Then, through map optimization and baking, high-precision hair texture maps are obtained, and then the hair models with lower face numbers are rendered, so that the efficiency of hair rendering can be improved, the accuracy of stylized hair effects can be retained, and the overall performance is improved.
[0011] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0012] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0014] Figure 1 is a flow chart of an embodiment of a method for rendering hair in an embodiment of the present disclosure;
[0015] Figure 2 is a schematic diagram of a hair rendering method in an embodiment of the present disclosure;
[0016] Figure 3 is another schematic diagram of the hair rendering method according to an embodiment of the present disclosure;
[0017] Figure 4 is another schematic diagram of the hair rendering method according to an embodiment of the present disclosure;
[0018] Figure 5 is another schematic diagram of the hair rendering method according to an embodiment of the present disclosure;
[0019] Figure 6 is another schematic diagram of the hair rendering method according to an embodiment of the present disclosure;
[0020] Figure 7 A schematic diagram of a hair rendering device provided in an embodiment of the present disclosure;
[0021] Figure 8 A schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0023] The terms "first", "second", "third", "fourth", etc. (if any) 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 sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] For ease of understanding, the specific process of the embodiment of the present disclosure is described below. Figure 1 , an embodiment of the hair rendering method in the embodiment of the present disclosure includes:
[0025] Step S10, obtaining a first model with an initial hair shape, and performing topological optimization on the first model to obtain a second model;
[0026] It should be noted that the first model with the initial shape of hair is a model that expresses the hair shape with the least number of model faces, and is a model with the general shape of hair that is easy to make. In one embodiment, the first model can be obtained by creating a sphere in the model making software and then adjusting the shape of the sphere. The required hair shape is different, and the adjustment method is also different, which is not limited here.
[0027] By way of example and not limitation, Figure 2 The diagram shows a schematic diagram of a change from a sphere to a first model and then to a second model. The schematic diagram only shows a local hair shape and can represent a tuft of hair. Figure 2 It can be seen that the texture of the first model between the two arrows is fuzzy because it has fewer faces or lower precision than the second model on the far right. Through topology optimization, a second model with higher precision can be obtained.
[0028] In this embodiment, it is only necessary to pre-make a model with the general shape of hair, and then obtain a high-precision hair rendering effect through subsequent processing, without the need to pre-make a complex and detailed hair model, thereby reducing the cost required for stylized hair production and improving efficiency.
[0029] It should be noted that the model is composed of multiple polygons (such as triangles, quadrilaterals, etc.), each polygon represents one of the faces of the model. The higher the number of faces of the model, the more computing resources are required for rendering. The connection relationship between faces constitutes the topological relationship of the model. Topology can be used to indicate the number, shape, connection method and other properties of the model's faces. When the model is deformed, the topological shape remains unchanged, so that the model can maintain stability.
[0030] In this embodiment, by performing topological optimization on the first model, a second model that can be directly used for rendering is obtained, wherein the topological optimization can be achieved by finding the optimal structure of the model while satisfying certain constraints. When finding the optimal structure of the model, the structural problems of the model (such as self-intersection, non-manifold, etc.) can be repaired, and the number of model faces can be increased / decreased to obtain the second model.
[0031] Step S20, performing detailed engraving on the second model to obtain a third model; wherein the number of faces of the third model is greater than that of the second model;
[0032] It can be understood that detail carving of the second model is a process of increasing the number of faces of the model. Through automated face increase, the details of the second model can be made richer, thereby obtaining a richer texture of the third model, which is baked to the second model, so that models with fewer faces can also be rendered to obtain rich and delicate texture details with high rendering efficiency.
[0033] In one embodiment, when the second model is detailed, the second model can be detailed sculpted by detail sculpting software (such as ZBrush, Mudbox, Blend, etc.) to obtain the third model. Furthermore, the second model can be detailed sculpted by a pre-written detail sculpting script to obtain the third model, wherein the detail sculpting script can be run based on any of the above-mentioned detail sculpting software, which is not specifically limited here.
[0034] In one embodiment, when the second model is engraved with details, a brush with a texture pattern can be printed on the surface of the second model multiple times by a stamp tool, so that the surface texture of the second model is more delicate and richer. The texture pattern carried by the brush can be extracted from the first texture map, or from other images, or can be a texture pattern preset in the detail engraving software, which is not limited here.
[0035] In one embodiment, when performing detail carving on the second model, the number of faces of the second model can also be increased by using a tool in the detail carving software that can increase / refine the number of faces of the model, thereby obtaining a third model with a larger number of faces than the second model and richer texture.
[0036] Step S30, obtaining a first texture map, and generating a second texture map of a second model according to the first texture map; wherein the second texture map is of a different type from the first texture map;
[0037] It should be noted that the first texture map can be any map that meets the required hair texture style, and the first texture map can be obtained from a texture map database, such as an online open map database, or a map database used within an enterprise, etc., which is not limited here. It can be understood that this convenient texture map acquisition method can reduce the time cost required for hair model production and / or rendering, and at the same time can ensure that the hair rendering effect meets expectations, which is an efficient implementation technology.
[0038] In this embodiment, a second texture map different from the first type can be generated by a first texture map of the first type for texture rendering of the second model, wherein the types of texture maps include color, normal, roughness, metalness, surface shadow AO map, etc. Different types of texture maps can be derived from one type of texture map without having to be made separately, and the production / rendering efficiency of the hair model is further improved.
[0039] In one embodiment, the first texture map is a color type map, that is, the first texture map is a color texture map, and the second texture map may include a normal map and a roughness map. Based on this, when executing this step, the first texture map for rendering the color texture of the second model is obtained, and according to the first texture map, a roughness map for rendering the roughness of the second model and / or a normal map for rendering the normal of the second model is generated to obtain the second texture map of the second model, so that the production / rendering efficiency of the hair model is further improved.
[0040] In one embodiment, when generating a second texture map of a second model according to the first texture map, the designated channel of the first texture map may be processed to obtain a second texture map of a different type. For example, the designated channel may be a red channel, a green channel, a blue channel, an alpha channel, etc. in an RGBA channel, and the specifics are not limited here.
[0041] Step S40, baking the texture of the third model into the second model to obtain a third texture map of the second model;
[0042] It should be noted that the third model is a refined hair model that has been sculpted in detail and is based on delicate textures. Therefore, by baking the texture of the third model to the second model, a third texture map with rich texture details that can be used for rendering the second model can be obtained. This allows the hair rendering to retain rich details while the number of faces of the hair model required does not need to be increased. This is a high-efficiency implementation technology.
[0043] It can be understood that texture baking (Texture Baking or Map Baking) is the process of saving the geometric features of a 3D mesh to a texture file (bitmap file). In this embodiment, through texture baking, the texture details of the third model with a high number of model faces are baked to the second model with a lower number of model faces, and a third texture map with a texture arranged according to the texture coordinates of the second model can be obtained, wherein the third texture map can include different types of texture maps such as color maps, normal maps, roughness maps, metalness, surface shadow AO maps, etc., which are not specifically limited here.
[0044] Step S50: Rendering the second model based on the first texture map, the second texture map and the third texture map to obtain a rendering result of the hair.
[0045] In this implementation, the directly acquired first texture map, the second texture map generated based on the first texture map, and the third texture map obtained by texture baking a third model with a higher number of faces can all be used for rendering the second model. By combining the rendering of these three texture maps, the rendering result of the hair can have richer texture details. The overall process is simple and efficient, and it is an efficient implementation method.
[0046] By way of example and not limitation, Figure 3 The figure is a schematic diagram of the hair rendering result obtained by the embodiment of the present disclosure, which includes a variety of stylized hair rendering results. It can be seen that the hair texture can be set according to the character's style, and the hair texture can be easily changed through different texture maps to obtain a special stylized hair rendering effect.
[0047] The hair rendering method provided in the above embodiment is based on a model with a general hair shape, and obtains a hair model with different levels of face numbers through topology optimization and detail carving. Then, a high-precision hair texture map is obtained through map optimization and baking, and then the hair model with a lower level of face numbers is rendered, thereby improving the efficiency of hair rendering and retaining the accuracy of the stylized hair effect, thereby improving the overall performance.
[0048] Next, a method for obtaining a texture map for hair rendering is specifically described, wherein the texture map for hair rendering includes the first texture map, the second texture map and the third texture map.
[0049] In one embodiment, a first model having an initial shape of hair is obtained, and topological optimization is performed on the first model. When obtaining the second model, the first model having the initial shape of hair is obtained, and the number of faces of the first model is supplemented to obtain the first model with supplemented face number; the turning edges of the topologically supplemented first model are hardened to obtain the second model.
[0050] In this embodiment, in order to make the hair model more stylized and ensure that the turning edge is not blurred and the turning characteristics are maintained when the surface is further subdivided in the future, firstly, the number of model faces is supplemented in the first model with the initial shape of the hair, so that the smoothness of the turning edge of the model is more controllable; then, the turning edge of the first model with the supplemented number of faces is hardened, so that when the surface is further subdivided in the future, the turning edge maintains hardness and is not blurred due to the increase of the surface.
[0051] In one embodiment, when hardening the turning edge of the first model supplemented by topology, the target turning edge with a turning degree less than or equal to a preset threshold in the first model supplemented by topology can be first identified, and then the target turning edge can be hardened to obtain a second model, wherein the preset threshold can be 90°, which is not limited here.
[0052] It can be understood that hardening the turning edges below a specific turning angle can allow the hardening treatment to be performed on sharper turning angles, while there is no need to perform hardening treatment on smoother model edges that also present specific turning angles, thereby achieving the desired stylized characteristics and maintaining the hardness of specific turning edges.
[0053] Furthermore, when performing the hardening treatment, it can be performed through the sharpening tools in the 3D modeling software. For example, the crease tool in the 3D modeling software Maya or Blender, the Soft Selection tool in 3ds Max, etc. can all be used for hardening treatment, and the specifics are not limited here.
[0054] In one embodiment, when performing detail carving on the second model to obtain the third model, the number of faces of the second model is increased to obtain the second model with increased number of faces; and the second model with increased number of faces is smoothed at least once to obtain the third model.
[0055] It can be understood that when the number of faces of the first model is supplemented as mentioned above, it is a supplement of the faces necessary for hardening the turning edges. Compared with the increase in the number of faces of the second model in this embodiment, the number of faces supplemented is smaller. The number of faces increased in this embodiment is more, which is an increase in the number of faces that meets high-precision requirements. There is a big difference in the order of magnitude of the number of faces between the two.
[0056] For example, when the number of faces of the first model is supplemented, the number of faces supplemented may be less than 10, while when the number of faces of the second model is increased, the number of faces increased may reach tens of thousands, depending on the accuracy requirements of the model and the accuracy requirements of the texture. As an example but not limitation, Figure 4 Shown is a schematic diagram of the second model before and after the number of faces is increased, wherein the left side is the second model before the number of faces is increased, and the right side is the second model after the number of faces is increased, and this is not specifically limited here.
[0057] In one implementation, when increasing the number of faces of the second model, the number of faces of the second model with specified attributes may be increased by using a subdivision tool in detail carving software, such as a Divide tool in ZBrush, which is not specifically limited here.
[0058] In one embodiment, when obtaining a first texture map and generating a second texture map of a second model based on the first texture map, a first texture map for rendering hair color is obtained; and a second texture map for rendering normals and / or roughness of the second model is generated based on the channel values of the first texture map.
[0059] In this implementation, after obtaining a first texture map of a color type, the channel value of a specified channel of the first texture map can be adjusted according to the type of texture map to be generated, thereby obtaining a second texture map of a specified type, wherein the specified type includes a normal and / or roughness type, which is not specifically limited here.
[0060] In one embodiment, when generating a second texture map of a normal type for a second model, the normal map of the second model can be obtained by adjusting the channel value of the first channel, and when generating a second texture map of a roughness type for the second model, the roughness map of the second model can be obtained by adjusting the channel value of the second channel; wherein the first channel and the second channel are different.
[0061] Furthermore, other types of second texture maps, such as metalness, surface shadow AO type, etc., may be obtained by adjusting the channel values of other channels of the first texture map, which is not specifically limited here.
[0062] In one embodiment, when generating a second texture map for rendering the normal and / or roughness of a second model based on the channel values of the first texture map, the brightness channel value of the first texture map is obtained, and a normal map is generated for the brightness channel value in a texture drawing tool to obtain the second texture map for rendering the normal of the second model.
[0063] In this embodiment, when generating the normal map of the second model, the brightness channel value of the first texture map is first obtained to obtain a brightness map, and then a normal map corresponding to the brightness map is generated through a texture drawing tool (such as Substance Painter, Quixel Mixer, etc.), thereby obtaining the normal map of the second model, that is, the second texture map used to render the normal of the second model.
[0064] In one embodiment, when generating a second texture map for rendering the normal and / or roughness of a second model based on the channel values of the first texture map, any channel in the first texture map is converted into grayscale to obtain a second texture map for rendering the roughness of the second model.
[0065] On the other hand, when generating the roughness map of the second model, you can first obtain the channel value of any channel in the first texture map to obtain the target channel map, and then convert the target channel map into a grayscale image to obtain the roughness map of the second model, that is, the second texture map used to render the roughness of the second model.
[0066] By way of example and not limitation, Figure 5 The figure shows a schematic diagram of the texture map of the second model, which includes three types of texture maps. The leftmost part is a schematic diagram of a color map, the middle part is a schematic diagram of a roughness map, and the rightmost part is a schematic diagram of a normal map. Figure 5 In the example, the color map can represent a schematic diagram of the first texture map. Based on the color map, Figure 5 The roughness map and normal map in the model improve the texture generation efficiency.
[0067] In one embodiment, when obtaining a first texture map for rendering hair color, multiple initial texture maps that can be used for hair color rendering are obtained in batches; through an artificial intelligence image processing tool, the multiple initial texture maps are processed for precision improvement to obtain multiple first texture maps; wherein any first texture map is used for rendering the second model.
[0068] It can be understood that in order to quickly obtain texture maps of hair models with different texture styles, this embodiment batches acquires multiple initial texture maps that can be used for hair color rendering, wherein the initial texture maps can be obtained from a texture map database, such as an online open map database, or a map database used within an enterprise, etc., which is not limited here.
[0069] Then, multiple initial texture maps are processed in batches through AI (artificial intelligence) image processing tools (such as Topazphoto AI), including pixel precision improvement and pixel amplification, to obtain multiple first texture maps with higher precision. Any of the first texture maps can be used for rendering the second model to obtain hair rendering results of different hair colors.
[0070] By way of example and not limitation, Figure 6 The following is a comparison of the texture map before and after the accuracy improvement. Figure 6 The image on the left is a schematic diagram of the initial texture map before the precision is improved, and the image on the right is a schematic diagram of the first texture map after the precision is improved. Figure 6 It can be seen that the accuracy of texture mapping has been greatly improved, which can make the texture of the rendered hair effect more detailed.
[0071] Corresponding to the above method embodiment, see Figure 7 A schematic diagram of a hair rendering device is shown, the device comprising: an acquisition module 70, used to acquire a first model having an initial shape of hair, and perform topological optimization on the first model to obtain a second model; a carving module 72, used to perform detail carving on the second model to obtain a third model; wherein the number of faces of the third model is greater than that of the second model; a generation module 74, used to acquire a first texture map, and generate a second texture map for the second model according to the first texture map; wherein the type of the second texture map is different from that of the first texture map; a baking module 76, used to bake the texture of the third model to the second model to obtain the third texture map of the second model; a rendering module 78, used to render the second model based on the first texture map, the second texture map and the third texture map to obtain a rendering result of the hair.
[0072] The above-mentioned hair rendering device is based on a model with a general hair shape, and obtains a hair model with different levels of face numbers through topology optimization and detail carving. Then, through map optimization and baking, a high-precision hair texture map is obtained, and then the hair model with a lower level of face numbers is rendered, so that the efficiency of hair rendering can be improved, and the accuracy of the stylized hair effect can be retained, thereby improving the overall performance.
[0073] Optionally, the acquisition module 70 is specifically used to: acquire a first model having an initial hair shape, supplement the number of faces of the first model to obtain the first model with supplemented faces; and perform a hardening process on the turning edges of the topologically supplemented first model to obtain a second model.
[0074] Optionally, the engraving module 72 is specifically used for: increasing the number of faces of the second model to obtain a second model with increased number of faces; and performing at least one smoothing process on the second model with increased number of faces to obtain a third model.
[0075] Optionally, the above-mentioned generation module 74 includes: an acquisition unit, used to acquire a first texture map for rendering hair color; and a generation unit, used to generate a second texture map for rendering the normal and / or roughness of the second model according to the channel value of the first texture map.
[0076] Optionally, the generating unit is further used to: obtain a brightness channel value of the first texture map, generate a normal map for the brightness channel value by using a texture drawing tool, and obtain a second texture map for rendering the normal of the second model.
[0077] Optionally, the generating unit is further used to: convert any channel in the first texture map into grayscale to obtain a second texture map for rendering the roughness of the second model.
[0078] Optionally, the above-mentioned acquisition unit is specifically used to: batch acquire multiple initial texture maps that can be used for hair color rendering; through artificial intelligence image processing tools, perform precision improvement processing on the multiple initial texture maps to obtain multiple first texture maps; wherein any first texture map is used for rendering the second model.
[0079] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above hair rendering method. The electronic device can be a server or a terminal device.
[0080] See also Figure 8 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine executable instructions that can be executed by the processor 100. The processor 100 executes the machine executable instructions to implement the above-mentioned hair rendering method.
[0081] Further, Figure 8 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .
[0082] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0083] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware, for example:
[0084] Acquire a first model with an initial form of hair, perform topology optimization on the first model to obtain a second model; perform detail sculpting on the second model to obtain a third model; wherein the number of faces of the third model is greater than that of the second model; acquire a first texture map, and generate a second texture map of the second model according to the first texture map; wherein the second texture map is of a different type from the first texture map; bake the texture of the third model to the second model to obtain a third texture map of the second model; render the second model based on the first texture map, the second texture map and the third texture map to obtain a rendering result of the hair.
[0085] In this method, based on a model with a general hair shape, a hair model with different levels of face numbers is obtained through topology optimization and detail carving, and then a high-precision hair texture map is obtained through map optimization and baking, and then the hair model with a lower level of face numbers is rendered. This can not only improve the efficiency of hair rendering, but also retain the accuracy of the stylized hair effect, thereby improving the overall performance.
[0086] Optionally, the step of obtaining a first model having an initial shape of hair and performing topological optimization on the first model to obtain a second model includes: obtaining a first model having an initial shape of hair, supplementing the number of faces of the first model to obtain a first model with supplemented number of faces; and performing hardening processing on the turning edges of the topologically supplemented first model to obtain a second model.
[0087] Optionally, the step of performing detail carving on the second model to obtain the third model includes: increasing the number of faces of the second model to obtain a second model with increased number of faces; and performing at least one smoothing process on the second model with increased number of faces to obtain the third model.
[0088] Optionally, the step of obtaining a first texture map and generating a second texture map for the second model based on the first texture map includes: obtaining a first texture map for rendering hair color; and generating a second texture map for rendering the normal and / or roughness of the second model based on the channel value of the first texture map.
[0089] Optionally, the step of generating a second texture map for rendering the normal and / or roughness of the second model based on the channel values of the first texture map includes: obtaining the brightness channel value of the first texture map, generating a normal map for the brightness channel value through a texture drawing tool, and obtaining the second texture map for rendering the normal of the second model.
[0090] Optionally, the step of generating a second texture map for rendering the normal and / or roughness of the second model based on the channel values of the first texture map includes: converting any channel in the first texture map into grayscale to obtain a second texture map for rendering the roughness of the second model.
[0091] Optionally, the step of obtaining a first texture map for rendering hair color includes: batch acquiring multiple initial texture maps that can be used for hair color rendering; using an artificial intelligence image processing tool, performing precision improvement processing on the multiple initial texture maps to obtain multiple first texture maps; wherein any first texture map is used for rendering the second model.
[0092] This embodiment further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned hair rendering method, for example:
[0093] Acquire a first model with an initial form of hair, perform topology optimization on the first model to obtain a second model; perform detail sculpting on the second model to obtain a third model; wherein the number of faces of the third model is greater than that of the second model; acquire a first texture map, and generate a second texture map of the second model according to the first texture map; wherein the second texture map is of a different type from the first texture map; bake the texture of the third model to the second model to obtain a third texture map of the second model; render the second model based on the first texture map, the second texture map and the third texture map to obtain a rendering result of the hair.
[0094] In this method, based on a model with a general hair shape, a hair model with different levels of face numbers is obtained through topology optimization and detail carving, and then a high-precision hair texture map is obtained through map optimization and baking, and then the hair model with a lower level of face numbers is rendered. This can not only improve the efficiency of hair rendering, but also retain the accuracy of the stylized hair effect, thereby improving the overall performance.
[0095] Optionally, the step of obtaining a first model having an initial shape of hair and performing topological optimization on the first model to obtain a second model includes: obtaining a first model having an initial shape of hair, supplementing the number of faces of the first model to obtain a first model with supplemented number of faces; and performing hardening processing on the turning edges of the topologically supplemented first model to obtain a second model.
[0096] Optionally, the step of performing detail carving on the second model to obtain the third model includes: increasing the number of faces of the second model to obtain a second model with increased number of faces; and performing at least one smoothing process on the second model with increased number of faces to obtain the third model.
[0097] Optionally, the step of obtaining a first texture map and generating a second texture map for the second model based on the first texture map includes: obtaining a first texture map for rendering hair color; and generating a second texture map for rendering the normal and / or roughness of the second model based on the channel value of the first texture map.
[0098] Optionally, the step of generating a second texture map for rendering the normal and / or roughness of the second model based on the channel values of the first texture map includes: obtaining the brightness channel value of the first texture map, generating a normal map for the brightness channel value through a texture drawing tool, and obtaining the second texture map for rendering the normal of the second model.
[0099] Optionally, the step of generating a second texture map for rendering the normal and / or roughness of the second model based on the channel values of the first texture map includes: converting any channel in the first texture map into grayscale to obtain a second texture map for rendering the roughness of the second model.
[0100] Optionally, the step of obtaining a first texture map for rendering hair color includes: batch acquiring multiple initial texture maps that can be used for hair color rendering; using an artificial intelligence image processing tool, performing precision improvement processing on the multiple initial texture maps to obtain multiple first texture maps; wherein any first texture map is used for rendering the second model.
[0101] The computer program product of the hair rendering method, device, electronic device and storage medium provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0102] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0103] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.
[0104] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0105] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0106] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, those skilled in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for rendering hair, characterized in that: The method comprises: Acquire a first model having an initial shape of hair, and perform topological optimization on the first model to obtain a second model; Carving details on the second model to obtain a third model; wherein the third model has a greater number of faces than the second model; Acquire a first texture map, and generate a second texture map of the second model according to the first texture map; wherein the second texture map is of a different type from the first texture map; Baking the texture of the third model into the second model to obtain a third texture map of the second model; The second model is rendered based on the first texture map, the second texture map and the third texture map to obtain a rendering result of the hair.
2. The method according to claim 1, characterized in that: The step of obtaining a first model having an initial hair shape and performing topological optimization on the first model to obtain a second model comprises: Acquire a first model having an initial shape of hair, and supplement the number of faces of the first model to obtain a first model with supplemented number of faces; The first model supplemented by topology is subjected to a hardening process on the turning edges to obtain a second model.
3. The method according to claim 1, characterized in that The step of performing detailed carving on the second model to obtain the third model comprises: increasing the number of faces of the second model to obtain a second model with increased number of faces; The second model with an increased number of faces is smoothed at least once to obtain a third model.
4. The method according to claim 1, characterized in that: The step of obtaining a first texture map and generating a second texture map of the second model according to the first texture map comprises: Obtaining a first texture map for rendering hair color; A second texture map for rendering the normal and / or roughness of the second model is generated according to the channel value of the first texture map.
5. The method according to claim 4, characterized in that The step of generating a second texture map for rendering the normal and / or roughness of the second model according to the channel value of the first texture map comprises: The brightness channel value of the first texture map is obtained, and a normal map is generated for the brightness channel value by using a texture drawing tool to obtain a second texture map for rendering the normal of the second model.
6. The method according to claim 4, characterized in that The step of generating a second texture map for rendering the normal and / or roughness of the second model according to the channel value of the first texture map comprises: Any channel in the first texture map is converted into grayscale to obtain a second texture map for rendering the roughness of the second model.
7. The method according to claim 4, characterized in that The step of obtaining a first texture map for rendering hair color comprises: Batch fetch multiple initial texture maps that can be used for hair color rendering; The multiple initial texture maps are processed for precision improvement through artificial intelligence image processing tools to obtain multiple first texture maps; wherein any first texture map is used for rendering the second model.
8. A hair rendering device, characterized in that: The device comprises: An acquisition module, used for acquiring a first model having an initial shape of hair, and performing topological optimization on the first model to obtain a second model; A carving module, used for carving details of the second model to obtain a third model; wherein the third model has a greater number of faces than the second model; A generating module, configured to obtain a first texture map, and generate a second texture map of the second model according to the first texture map; wherein the second texture map is of a different type from the first texture map; A baking module, used for baking the texture of the third model to the second model to obtain a third texture map of the second model; A rendering module is used to render the second model based on the first texture map, the second texture map and the third texture map to obtain a rendering result of the hair.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the hair rendering method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the hair rendering method according to any one of claims 1 to 7.