Map generation method and device, computer equipment and storage medium

By correcting the lighting direction and mapping the light and shadow on the original shadow map of the 3D model, a shadow color map is generated, which solves the problem that computer devices cannot render subsurface scattering and makes the lighting and shadow effects of two-dimensional objects closer to the real effect.

CN114519760BActive Publication Date: 2026-02-17BEIJING SWEET SUGARSOFT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210158377.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-21
Publication Date
2026-02-17
Estimated Expiration
2042-02-21

AI Technical Summary

Technical Problem

Existing computer equipment cannot effectively render the subsurface scattering effect of two-dimensional objects, resulting in unrealistic lighting and shadow effects.

Method used

By acquiring the original shadow map and shadow tendency map of the 3D model, and performing correction processing and light and shadow mapping using the lighting direction, a shadow color map is generated to simulate the subsurface scattering effect.

Benefits of technology

Without actually implementing subsurface scattering, shadow tendency mapping and light and shadow mapping are used to generate similar lighting and shadow effects, which are suitable for general computer equipment and improve the realism of lighting and shadow effects of two-dimensional objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114519760B_ABST
    Figure CN114519760B_ABST
Patent Text Reader

Abstract

This disclosure provides a method, apparatus, computer device, and storage medium for generating textures. The method includes: acquiring a three-dimensional model of a target object, an original shadow texture corresponding to the three-dimensional model, and a shadow tendency texture; performing a correction process on the original shadow texture based on the lighting direction corresponding to the three-dimensional model to obtain a target shadow texture corresponding to the three-dimensional model; and performing a light and shadow mapping process on the target shadow texture using the shadow tendency texture to obtain a shadow color texture corresponding to the three-dimensional model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a method, apparatus, computer device, and storage medium for generating textures. Background Technology

[0002] Sub-surface scattering (3S) refers to the process by which light enters an object from its surface, is scattered internally, and then exits through other vertices on the object's surface. It is used to describe the lighting phenomenon of light scattering when passing through a transparent / semi-transparent surface, and can be specifically represented by the light and shadow effects on human skin under illumination in the real world.

[0003] In the rendering of two-dimensional objects, if the subsurface scattering phenomenon under light illumination can be displayed, the lighting and shadow effects of the rendered two-dimensional objects can be closer to reality. However, subsurface scattering specifically involves the scattering phenomenon after light enters the interior of the medium, and general computer equipment cannot provide the computing power to support it, resulting in the current problem of poor realism in the lighting and shadow effects of two-dimensional object rendering. Summary of the Invention

[0004] This disclosure provides at least one method, apparatus, computer device, and storage medium for generating textures.

[0005] In a first aspect, embodiments of this disclosure provide a method for generating textures, comprising: acquiring a three-dimensional model of a target object, an original shadow texture corresponding to the three-dimensional model, and a shadow tendency texture; performing a correction process on the original shadow texture based on the lighting direction corresponding to the three-dimensional model to obtain a target shadow texture corresponding to the three-dimensional model; and performing a light and shadow mapping process on the target shadow texture using the shadow tendency texture to obtain a shadow color texture corresponding to the three-dimensional model.

[0006] In this way, instead of actually implementing subsurface scattering, the original shadow map is corrected under a defined lighting direction to present the shadow effect under the lighting direction. The lighting effect of the shadow area is obtained by processing the light and shadow mapping of the shadow tendency map. This makes the shadow color map present a similar lighting effect to subsurface scattering. Therefore, it requires less computing power and is suitable for general computer equipment. Thus, it is relatively easy to add subsurface scattering effects to two-dimensional objects, making the lighting effect of the two-dimensional objects closer to the real effect.

[0007] In one optional implementation, the step of performing light and shadow mapping processing on the target shadow map using the shadow tendency map to obtain the shadow color map of the three-dimensional model includes: remapping the shadow tendency map onto the target shadow map to obtain the shadow color map of the three-dimensional model.

[0008] In one optional implementation, the method further includes: obtaining a color texture map of the three-dimensional model; performing color rendering on the three-dimensional model using the color texture map to generate an intermediate rendering model; and performing shadow color rendering on the intermediate rendering model using the shadow color map to obtain a target rendering model.

[0009] In this way, the resulting target rendering model can possess the corresponding features of shadow effects, subsurface scattering effects, and shading effects.

[0010] In one optional implementation, the method further includes: obtaining a texture map corresponding to the three-dimensional model; the step of using the shadow color map to perform shadow color rendering on the intermediate rendering model to obtain a target rendering model includes: performing shadow color rendering on the intermediate rendering model using the shadow color map, and performing texture rendering on the intermediate rendering model using the texture map to obtain the target rendering model.

[0011] In this way, the resulting target rendering model can also have texture features.

[0012] In one optional implementation, the method further includes: generating a target rendering image of the target object using the target rendering model.

[0013] In this way, the obtained target rendering model can be specifically applied to obtain the target rendering image of the target object, and the obtained target rendering image can be used for animation or film production.

[0014] In one optional implementation, the step of correcting the original shadow map based on the lighting direction corresponding to the 3D model to obtain the target shadow map corresponding to the 3D model includes: determining a lighting model corresponding to the 3D model based on the 3D model and the lighting direction corresponding to the 3D model; the lighting model is used to characterize the shadow intensity information corresponding to multiple vertices of the 3D model; using the lighting model to correct the lighting direction of the original shadow map to obtain an intermediate shadow map of the target human 3D model; and in response to receiving a shadow range adjustment command, performing partitioning processing on the intermediate shadow map based on the target shadow partition grayscale threshold carried in the shadow range adjustment command to obtain the target shadow map.

[0015] In this way, since the obtained lighting model can reflect the shadow intensity information corresponding to multiple vertices of the 3D model under the current lighting direction, the original shadow map determined for the 3D model can be corrected in the lighting direction using the lighting model. The resulting target shadow map, compared to the original shadow map, can be flexibly adjusted according to the lighting direction. Therefore, after rendering the 3D model using the obtained target shadow map, the 2D object can express the shadow effect under the current lighting direction.

[0016] In one optional implementation, determining the lighting model corresponding to the three-dimensional model based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model includes: determining the normal directions corresponding to multiple vertices in the three-dimensional model; performing a dot product operation on the normal direction corresponding to each vertex and the lighting direction for each vertex to obtain the shadow intensity information corresponding to each vertex; and obtaining the lighting model based on the shadow intensity information corresponding to the multiple vertices.

[0017] In this way, the lighting model determined by the direction of illumination and the normal direction corresponding to each vertex in the 3D model can more accurately reflect the shadow tendency that each vertex in the 3D model should exhibit under the target light source. That is, the obtained lighting model can reflect the lighting effect of the target light source on the 3D model and is more suitable for correcting the original shadow map corresponding to the 3D model under the direction of illumination of the target light source.

[0018] In one optional implementation, the step of correcting the lighting direction of the original shadow map using the lighting model to obtain the intermediate shadow map of the target human body 3D model includes: using the shadow degree information corresponding to each of the multiple vertices included in the lighting model to perform remapping processing on the original shadow degree information corresponding to each vertex in the 3D model to obtain the intermediate shadow map of the 3D model.

[0019] Secondly, embodiments of this disclosure also provide a texture generation apparatus, comprising: a first acquisition module, configured to acquire a three-dimensional model of a target object, an original shadow texture corresponding to the three-dimensional model, and a shadow tendency texture; a first processing module, configured to perform correction processing on the original shadow texture based on the lighting direction corresponding to the three-dimensional model to obtain a target shadow texture corresponding to the three-dimensional model; and a second processing module, configured to perform light and shadow mapping processing on the target shadow texture using the shadow tendency texture to obtain a shadow color texture corresponding to the three-dimensional model.

[0020] In one optional implementation, when the second processing module performs light and shadow mapping processing on the target shadow map using the shadow tendency map to obtain the shadow color map of the three-dimensional model, it is used to: remap the shadow tendency map to the target shadow map to obtain the shadow color map of the three-dimensional model.

[0021] In one optional embodiment, the generation device further includes a second acquisition module, configured to: acquire a color texture map of the three-dimensional model; perform color rendering on the three-dimensional model using the color texture map to generate an intermediate rendering model; and perform shadow color rendering on the intermediate rendering model using the shadow color texture map to obtain a target rendering model.

[0022] In one optional implementation, the second acquisition module is further configured to: acquire the texture map corresponding to the three-dimensional model; when the second acquisition module performs shadow color rendering on the intermediate rendering model using the shadow color map to obtain the target rendering model, it is configured to: perform shadow color rendering on the intermediate rendering model using the shadow color map and perform texture rendering on the intermediate rendering model using the texture map to obtain the target rendering model.

[0023] In one optional implementation, the second acquisition module is further configured to: generate a target rendering image of the target object using the target rendering model.

[0024] In one optional implementation, when the first processing module corrects the original shadow map based on the lighting direction corresponding to the 3D model to obtain the target shadow map corresponding to the 3D model, it is configured to: determine a lighting model corresponding to the 3D model based on the 3D model and the lighting direction corresponding to the 3D model; the lighting model is used to characterize the shadow intensity information corresponding to multiple vertices of the 3D model; correct the lighting direction of the original shadow map using the lighting model to obtain an intermediate shadow map of the target human 3D model; and, in response to receiving a shadow range adjustment command, partition the intermediate shadow map based on the target shadow partition grayscale threshold carried in the shadow range adjustment command to obtain the target shadow map.

[0025] In one optional implementation, when the first processing module determines the lighting model corresponding to the three-dimensional model based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, it is configured to: determine the normal directions corresponding to multiple vertices in the three-dimensional model; perform a dot product operation on the normal direction corresponding to each vertex and the lighting direction for each vertex to obtain the shadow intensity information corresponding to each vertex; and obtain the lighting model based on the shadow intensity information corresponding to the multiple vertices.

[0026] In one optional implementation, when the first processing module performs illumination direction correction processing on the original shadow map using the lighting model to obtain the intermediate shadow map of the target human body 3D model, it is used to: use the shadow degree information corresponding to the multiple vertices included in the lighting model to perform remapping processing on the original shadow degree information corresponding to each vertex in the 3D model to obtain the intermediate shadow map of the 3D model.

[0027] Thirdly, an optional implementation of this disclosure also provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the steps of the first aspect above, or any possible implementation of the first aspect, are performed.

[0028] Fourthly, an optional implementation of this disclosure also provides a computer-readable storage medium storing a computer program that, when run, performs the steps of the first aspect or any possible implementation of the first aspect.

[0029] For a description of the effects of the above-mentioned texture generation apparatus, computer equipment, and computer-readable storage medium, please refer to the description of the texture generation method above, which will not be repeated here.

[0030] It should be understood that the above general description and the following detailed description are merely exemplary and illustrative, and not intended to limit the technical solutions of this disclosure.

[0031] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0032] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0033] Furthermore, the accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this disclosure and, together with the specification, serve to illustrate the technical solutions of this disclosure.

[0034] Figure 1 A flowchart illustrating a texture generation method provided in an embodiment of this disclosure is shown;

[0035] Figure 2 A schematic diagram of a three-dimensional model of a target object provided in an embodiment of this disclosure is shown;

[0036] Figure 3 A schematic diagram of an original shadow map provided in an embodiment of this disclosure is shown;

[0037] Figure 4 A schematic diagram of a shadow tendency map provided in an embodiment of the present disclosure is shown;

[0038] Figure 5 This diagram illustrates a specific flowchart of a method for determining a target shadow map according to an embodiment of the present disclosure;

[0039] Figure 6 A schematic diagram of a target rendering image provided by an embodiment of the present disclosure is shown;

[0040] Figure 7 A schematic diagram of a texture generation apparatus provided in an embodiment of the present disclosure is shown;

[0041] Figure 8 A schematic diagram of a computer device provided in an embodiment of this disclosure is shown. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown herein can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0043] Research has revealed that subsurface scattering can be specifically manifested in the light and shadow effects on human skin under illumination in the real world. This is similar to the faint glowing areas near the flame of a lit candle due to diffuse reflection of light within the candle. Applying this real-world subsurface scattering effect to the rendering of two-dimensional objects could improve the realism of their lighting and shadow effects. However, due to the complexity of the physics behind subsurface scattering, rendering equipment needs to track light in real-time and simulate the scattering of light by the object's surface medium. Typical computers lack the computational power to support this, making it impossible to add subsurface scattering effects to two-dimensional objects, resulting in the current problem of poor realism in two-dimensional object rendering.

[0044] Based on the above research, this disclosure provides a method for generating textures that does not require actual implementation of subsurface scattering. Instead, it uses a method to correct the original shadow texture under a determined lighting direction to present the shadow effect under the lighting direction. By processing the light and shadow mapping of the shadow tendency texture, the light and shadow effect of the shadow area is obtained. This allows the shadow color texture to present a light and shadow effect similar to subsurface scattering. Therefore, it requires less computing power and is suitable for general computer equipment. Thus, it is relatively easy to add subsurface scattering effects to two-dimensional objects, making the light and shadow effect of the obtained two-dimensional objects closer to the real effect.

[0045] The shortcomings of the above solutions are the result of the inventor's practical experience and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.

[0046] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0047] To facilitate understanding of this embodiment, a method for generating textures disclosed in this disclosure will first be described in detail. The execution entity of the texture generation method provided in this disclosure is generally a computer device with certain computing capabilities. This computer device may include, for example, a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. In some possible implementations, the texture generation method can be implemented by a processor calling computer-readable instructions stored in memory.

[0048] The following describes the texture generation method provided in this disclosure. This disclosure provides a texture generation method that can be used to determine the shadow color texture of a two-dimensional object, and specifically can be applied to the rendering of the shadow color of a two-dimensional object. The two-dimensional object described herein can specifically include cartoon characters, game characters, virtual pets, etc. Therefore, the generation method provided in this disclosure can be specifically applied to different application fields such as game screen production or generation, animation and film production. After determining the shadow color texture using the generation method provided in this disclosure, the determined shadow color texture can be further used to render the two-dimensional object, so that the rendered lighting and shadow effects make the two-dimensional object more realistic and plausible.

[0049] See Figure 1 The diagram shown is a flowchart of a texture generation method provided in an embodiment of this disclosure. The method includes steps S101 to S103, wherein:

[0050] S101: Obtain the 3D model of the target object, the original shadow map corresponding to the 3D model, and the shadow tendency map;

[0051] S102: Based on the lighting direction corresponding to the three-dimensional model, the original shadow map is corrected to obtain the target shadow map corresponding to the three-dimensional model;

[0052] S103: Use the shadow tendency map to perform light and shadow mapping processing on the target shadow map to obtain the shadow color map corresponding to the three-dimensional model.

[0053] This embodiment utilizes a 3D model of the target object and a determined lighting direction corresponding to the 3D model to correct the original shadow map of the 3D model, obtaining a target shadow map. Then, a shadow tendency map is used to perform light and shadow mapping on the target shadow map to obtain a shadow color map of the 3D model. When rendering a 3D model using such a shadow color map, the target object can display a subsurface scattering lighting effect. Since this method does not require actual implementation of subsurface scattering, but instead uses a determined lighting direction to correct the original shadow map to present a shadow effect under the lighting direction, and then uses the light and shadow mapping of the shadow tendency map to obtain the lighting effect of the shadow area, the shadow color map can exhibit a similar subsurface scattering lighting effect. Therefore, it requires less computing power and is suitable for general computer equipment. Thus, it is relatively easy to add subsurface scattering effects to 2D objects, making the resulting 2D object's lighting effect closer to a realistic effect.

[0054] The above S101 to S103 are explained in detail below.

[0055] Regarding S101 above, the three-dimensional model of the target object will first be explained. The target object may specifically include a two-dimensional object. Since a two-dimensional object is a virtual object and does not actually exist, its physical characteristics such as height and weight can be determined by constructing a three-dimensional model corresponding to the two-dimensional object. The determined three-dimensional model can then be used to simulate the desired appearance of the two-dimensional object in the real world. For example, see... Figure 2 The diagram shown is a schematic representation of a three-dimensional model of a target object provided in an embodiment of this disclosure. The three-dimensional model shown here is an artificially constructed virtual model. Specifically, the three-dimensional model can be further refined to represent facial features and clothing characteristics. Figure 2 The image is not shown. Furthermore, different 3D models can be determined for different 2D objects.

[0056] A 3D model typically consists of multiple vertices located on the surface of the 3D model, and meshes formed by the interconnections between the vertices.

[0057] After determining the target object model, the original shadow map corresponding to the 3D model can be obtained. The original shadow map specifically includes a grayscale image, composed of pixels at different grayscale values, which reflects the original shadow intensity information corresponding to each vertex in the 3D model. For example, see... Figure 3The diagram shown is a schematic of an original shadow map provided in an embodiment of this disclosure. In one possible case, when actually determining the shadow map for the target object model, a light map is first determined for the 3D model. The light map is composed of grayscale images in different channels, and the grayscale image in the shadow channel of the light map can also be used as the grayscale image of the original shadow map.

[0058] Additionally, a shadow tendency map corresponding to the 3D model can be obtained; for example, see [link to example]. Figure 4 The diagram shown is a schematic representation of a shadow tendency map provided in an embodiment of this disclosure. In practice, different regions of the shadow tendency map have different colors. Specifically, the shadow tendency map can be used to render shadow and highlight areas that reflect the target object.

[0059] Regarding S102 above, for the original shadow map corresponding to the obtained 3D model, the original shadow map can be corrected by the lighting direction corresponding to the 3D model to obtain the target shadow map corresponding to the 3D model.

[0060] In specific implementation, see Figure 5 The diagram shown is a flowchart illustrating a specific process for determining a target shadow map according to an embodiment of this disclosure, which specifically includes:

[0061] S501: Based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, determine the lighting model corresponding to the three-dimensional model; the lighting model is used to characterize the shadow degree information corresponding to multiple vertices of the three-dimensional model respectively.

[0062] First, the specific method for determining the lighting model is explained. In a specific implementation, the lighting model can be determined as follows: determine the normal directions corresponding to multiple vertices in the 3D model; for each vertex, perform a dot product operation on the normal direction and the lighting direction corresponding to each vertex to obtain the shadow intensity information corresponding to each vertex; based on the shadow intensity information corresponding to the multiple vertices, the lighting model is obtained.

[0063] For multiple vertices in the 3D model and the normal directions corresponding to these vertices, see [link to documentation]. Figure 2 As shown, some vertices in the illustrated 3D model are labeled, along with the corresponding normal directions at each vertex. Since the 3D model is fixed, multiple vertices can be determined on the outer contour of the 3D model, and the normal directions for each vertex can be determined based on their respective positions on the 3D model. The specific method for determining the normal directions will not be elaborated upon here.

[0064] Regarding the direction of illumination, another embodiment of this disclosure also provides a specific method for determining the direction of illumination. Specifically, the position information of the target light source in the model coordinate system corresponding to the three-dimensional model can be determined, and then the illumination direction corresponding to the three-dimensional model can be determined based on the position information of the light source.

[0065] The target light source can include a virtual light source. When determining the illumination direction of the target light source, the relative positional relationship between the target light source and the 3D model is involved because the illumination direction specifically affects the 3D model. Therefore, to more accurately determine the illumination direction, a corresponding model coordinate system can be established based on the 3D model, and the light source position information of the target light source can be determined within this model coordinate system. In this way, for the target light source and the 3D model within the same model coordinate system, the relative positional relationship between the target light source and the 3D model can be accurately determined, thereby enabling the determination of the illumination direction corresponding to the 3D model.

[0066] Given a defined lighting direction, for each of the multiple vertices, a dot product operation can be performed using the normal direction and the lighting direction to obtain the shadow intensity information for each vertex. By determining the shadow intensity information for each of the multiple vertices, a lighting model can be obtained. Specifically, the shadow intensity information reflected in the lighting model indicates whether each vertex appears in a shadow area after rendering, and if so, whether the shadow color is darker or lighter.

[0067] In this way, the lighting model determined by the direction of illumination and the normal direction corresponding to each vertex in the 3D model can more accurately reflect the shadow tendency that each vertex in the 3D model should exhibit under the target light source. That is, the obtained lighting model can reflect the lighting effect of the target light source on the 3D model and is more suitable for correcting the original shadow map corresponding to the 3D model under the direction of illumination of the target light source.

[0068] Following on from S501 above, the specific methods for determining the target shadow map also include:

[0069] S502: The original shadow map is corrected for lighting direction using the lighting model to obtain the intermediate shadow map of the target human body 3D model.

[0070] In a specific implementation, the shadow intensity information corresponding to each of the multiple vertices in the lighting model can be used to remap the original shadow intensity information corresponding to each vertex in the three-dimensional model to obtain the intermediate shadow texture of the three-dimensional model.

[0071] The remapping process specifically involves remapping the original shadow intensity information across the grayscale range, which can be achieved using linear interpolation. This allows the remapping calculation to utilize the shadow intensity information corresponding to multiple vertices under a lighting model that reflects the direction of illumination. The original shadow intensity information in the original shadow map also retains the influence of the lighting direction, resulting in an intermediate shadow map that reflects the effect of the lighting direction on the target object model.

[0072] S503: In response to receiving a shadow range adjustment instruction, the intermediate shadow map is partitioned based on the target shadow partition grayscale threshold carried in the shadow range adjustment instruction to obtain the target shadow map.

[0073] Specifically, the shadow range of the intermediate shadow map can be partitioned to achieve dual-sided shadow adjustment, which is used to present a layered shadow that reflects the occlusion relationship after the 3D model is rendered and displayed.

[0074] The shadow range adjustment command includes a target shadow partition grayscale threshold. Here, the target shadow partition grayscale threshold is a grayscale value that controls the shadow tendency of each pixel in the intermediate shadow map on the corresponding area of ​​the 3D model. In one possible scenario, if the target shadow partition grayscale threshold is determined to be 128, then pixels with grayscale values ​​less than 128 in the intermediate shadow map will be less likely to produce shadows on the corresponding area of ​​the 3D model, while pixels with grayscale values ​​greater than 128 in the intermediate shadow map will be more likely to produce shadows on the corresponding area of ​​the 3D model.

[0075] Here, the grayscale threshold of the target shadow partition can be adjusted. Specifically, in response to input commands to the input box corresponding to the grayscale threshold of the target shadow partition or operation commands to the adjustment knob, the shadow range adjustment command can be determined. The adjustable range and the size of the grayscale threshold of the target shadow partition after adjustment can be controlled according to the actual situation, which will not be elaborated here.

[0076] When partitioning the intermediate shadow map using the target shadow partition grayscale threshold, pixels in the intermediate shadow map with grayscale values ​​greater than or equal to the target shadow partition grayscale threshold can be assigned to the first partition, and pixels with grayscale values ​​less than the target shadow partition grayscale threshold can be assigned to the second partition. Using the shadow tendencies that different regions should exhibit as described above, a first correction process for shadow depth can be performed on the first and second partitions respectively, resulting in the target shadow map under the target shadow partition grayscale threshold.

[0077] In this way, since the obtained lighting model can reflect the shadow intensity information corresponding to multiple vertices of the 3D model under the current lighting direction, the original shadow map determined for the 3D model can be corrected in the lighting direction using the lighting model. The resulting target shadow map, compared to the original shadow map, can be flexibly adjusted according to the lighting direction. Therefore, after rendering the 3D model using the obtained target shadow map, the 2D object can express the shadow effect under the current lighting direction.

[0078] Regarding S103 above, after obtaining the target shadow map, the shadow tendency map can be used to perform light and shadow mapping on the target shadow map to obtain the shadow color map corresponding to the three-dimensional model.

[0079] In practical implementation, remapping can be used when performing lighting and shadow mapping. For example, the shadow tendency map can be remapped onto the target shadow map to obtain the shadow color map of the model. Here, linear interpolation can be used for texture remapping.

[0080] Since the obtained shadow color map is obtained by remapping, it can retain the characteristics of the target shadow map, that is, it has the shadow characteristics under a certain lighting direction. In addition, it can also retain the characteristics of the shadow tendency map, so that the shadow color map also has the light and shadow effect of subsurface scattering in the shadow part after rendering, thereby improving the realism of the light and shadow effect of rendering two-dimensional objects.

[0081] In another embodiment of this disclosure, the shadow color map of the 3D model described above can be practically applied to obtain a target rendering model of the 3D model. In specific implementations, for example, a color map of the 3D model can be obtained; the 3D model can be rendered using the color map to generate an intermediate rendering model; and the intermediate rendering model can be rendered using the shadow color map to obtain a target rendering model.

[0082] In this process, different areas of a color map possess different colors. Color maps add color effects to the 3D model of a target object during rendering, effectively coloring the model. Therefore, after rendering the 3D model of a target object using color maps, the resulting intermediate rendered model can reflect the patterns and corresponding colors of facial features, clothing, etc. In some cases, if no further rendering of the target object is required, the resulting intermediate rendered model can be directly used to generate an image that fully displays the target object.

[0083] Using the shadow color map described above, shadow color rendering can be further applied to the intermediate rendering model, so that the resulting target rendering model can have more realistic shadow effects and subsurface scattering light and shadow effects in addition to color effects.

[0084] Alternatively, in another possible scenario, the texture map corresponding to the 3D model can be obtained. The texture map can be used to change the appearance of the target object, such as making a certain property of the target object's surface exhibit anisotropy, thereby causing changes to the target object beyond just diffuse color, bump effects, highlights, and opacity.

[0085] In a specific implementation, when the intermediate rendering model is rendered with shadow color using the shadow color map to obtain the target rendering model, the intermediate rendering model can also be rendered with shadow color using the shadow color map and with texture map using the texture map to obtain the target rendering model.

[0086] The method for rendering shadow colors can be found in the above explanation and will not be repeated here. As for texture rendering, a mapping method is established to map the properties of the target object's surface to the corresponding data in the texture map. Then, the data from the corresponding locations in the texture map is used to change the properties of the target object's surface, thereby altering the surface appearance of the target object.

[0087] In another embodiment of this disclosure, the target rendering model obtained in the above description can be specifically used to generate a target rendering image of the target object. For example, see [link to example]. Figure 6 The diagram shown is a schematic representation of a target rendering image provided in an embodiment of this disclosure; specifically, the target rendering image renders a hand. Figure 6 Image (a) shows a rendered image obtained after rendering a target object without using the texture generation method provided in the embodiments of this disclosure. Figure 6 Image (b) shows the target rendered image obtained after rendering a hand using the texture generation method provided in this embodiment. A comparison clearly shows that... Figure 6 Region 62 in the target rendered image shown in (b) is compared to Figure 6 The corresponding region 61 in (a) has a subsurface scattering effect due to light, which can make the hand more reflective of the "medium" effect, that is, can improve the realism of the light and shadow effects of the two-dimensional object rendering.

[0088] In fact, since the texture generation method provided in this embodiment involves calculations such as remapping, lighting and shadow mapping, shadow color rendering, and texture rendering, the computational power required for these calculations is relatively small. Therefore, the generation method provided in this embodiment can make the target object more realistic and has lower requirements for computer equipment, and can be deployed on computer equipment such as mobile devices.

[0089] Meanwhile, since the generation method provided in this embodiment requires less computing power and can express the shadow effect and subsurface scattering effect under the current lighting direction after rendering the two-dimensional object, it can support the generation of continuous images for two-dimensional objects using computer equipment, such as generating animation images or movie images. Compared with the method of determining textures frame by frame for rendering or the method of pipeline post-processing, it is more efficient.

[0090] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0091] Based on the same inventive concept, this disclosure also provides a texture generation apparatus corresponding to the texture generation method. Since the principle of the apparatus in this disclosure for solving the problem is similar to the texture generation method described above in this disclosure, the implementation of the apparatus can refer to the implementation of the method, and the repeated parts will not be described again.

[0092] Reference Figure 7 The diagram shown is a schematic of a texture generation device provided in an embodiment of this disclosure. The device includes: a first acquisition module 71, a first processing module 72, and a second processing module 73; wherein,

[0093] The first acquisition module 71 is used to acquire the three-dimensional model of the target object, the original shadow map corresponding to the three-dimensional model, and the shadow tendency map.

[0094] The first processing module 72 is used to perform correction processing on the original shadow map based on the lighting direction corresponding to the three-dimensional model to obtain the target shadow map corresponding to the three-dimensional model;

[0095] The second processing module 73 is used to perform light and shadow mapping processing on the target shadow map using the shadow tendency map to obtain the shadow color map corresponding to the three-dimensional model.

[0096] In one optional implementation, when the second processing module 73 performs light and shadow mapping processing on the target shadow map using the shadow tendency map to obtain the shadow color map of the three-dimensional model, it is used to: remap the shadow tendency map to the target shadow map to obtain the shadow color map of the three-dimensional model.

[0097] In one optional embodiment, the generation device further includes a second acquisition module 74, configured to: acquire a color texture map of the three-dimensional model; perform color rendering on the three-dimensional model using the color texture map to generate an intermediate rendering model; and perform shadow color rendering on the intermediate rendering model using the shadow color texture map to obtain a target rendering model.

[0098] In one optional implementation, the second acquisition module 74 is further configured to: acquire the texture map corresponding to the three-dimensional model; when the second acquisition module 74 performs shadow color rendering on the intermediate rendering model using the shadow color map to obtain the target rendering model, it is configured to: perform shadow color rendering on the intermediate rendering model using the shadow color map and perform texture rendering on the intermediate rendering model using the texture map to obtain the target rendering model.

[0099] In one optional implementation, the second acquisition module 74 is further configured to: generate a target rendering image of the target object using the target rendering model.

[0100] In one optional implementation, when the first processing module 72 corrects the original shadow map based on the lighting direction corresponding to the 3D model to obtain the target shadow map corresponding to the 3D model, it is configured to: determine a lighting model corresponding to the 3D model based on the 3D model and the lighting direction corresponding to the 3D model; the lighting model is used to characterize the shadow intensity information corresponding to multiple vertices of the 3D model; correct the lighting direction of the original shadow map using the lighting model to obtain an intermediate shadow map of the target human 3D model; and, in response to receiving a shadow range adjustment instruction, partition the intermediate shadow map based on the target shadow partition grayscale threshold carried in the shadow range adjustment instruction to obtain the target shadow map.

[0101] In one optional implementation, when the first processing module 72 determines the lighting model corresponding to the three-dimensional model based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, it is configured to: determine the normal directions corresponding to multiple vertices in the three-dimensional model; perform a dot product operation on the normal direction corresponding to each vertex and the lighting direction for each vertex to obtain the shadow intensity information corresponding to each vertex; and obtain the lighting model based on the shadow intensity information corresponding to the multiple vertices.

[0102] In one optional implementation, when the first processing module 72 performs illumination direction correction processing on the original shadow map using the lighting model to obtain the intermediate shadow map of the target human body 3D model, it is used to: use the shadow degree information corresponding to the multiple vertices included in the lighting model to perform remapping processing on the original shadow degree information corresponding to each vertex in the 3D model to obtain the intermediate shadow map of the 3D model.

[0103] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0104] This disclosure also provides a computer device, such as... Figure 8 The diagram shown is a schematic representation of a computer device structure provided in an embodiment of this disclosure, including:

[0105] Processor 10 and memory 20; the memory 20 stores machine-readable instructions executable by processor 10, and processor 10 executes the machine-readable instructions stored in memory 20. When the machine-readable instructions are executed by processor 10, processor 10 performs the following steps:

[0106] Obtain the 3D model of the target object, the original shadow map corresponding to the 3D model, and the shadow tendency map; based on the lighting direction corresponding to the 3D model, perform correction processing on the original shadow map to obtain the target shadow map corresponding to the 3D model; use the shadow tendency map to perform light and shadow mapping processing on the target shadow map to obtain the shadow color map corresponding to the 3D model.

[0107] The aforementioned memory 20 includes a main memory 210 and an external memory 220; the main memory 210, also known as internal memory, is used to temporarily store the computational data in the processor 10, as well as the data exchanged with external memory 220 such as a hard disk. The processor 10 exchanges data with the external memory 220 through the main memory 210.

[0108] The specific execution process of the above instructions can be referred to the steps of the texture generation method described in the embodiments of this disclosure, and will not be repeated here.

[0109] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the texture generation method described in the above method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0110] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the texture generation method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0111] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0112] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

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

[0114] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0115] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0116] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A method for generating a map, characterized in that, The method comprises the following steps: obtaining a three-dimensional model of a target object, an original shadow map corresponding to the three-dimensional model, and a shadow tendency map; based on the light direction corresponding to the three-dimensional model, correcting the original shadow map to obtain a target shadow map corresponding to the three-dimensional model; using the shadow tendency map to perform light shadow mapping processing on the target shadow map to obtain a shadow color map corresponding to the three-dimensional model; wherein, based on the light direction corresponding to the three-dimensional model, the original shadow map is corrected to obtain a target shadow map corresponding to the three-dimensional model, comprising: based on the three-dimensional model and the light direction corresponding to the three-dimensional model, determine the light model corresponding to the three-dimensional model; the light model is used to represent the shadow degree information corresponding to each vertex of the three-dimensional model; using the light model to correct the light direction of the original shadow map to obtain the intermediate shadow map of the target human body three-dimensional model; in response to receiving a shadow range adjustment instruction, based on the target shadow partition gray threshold carried in the shadow range adjustment instruction, partition processing is performed on the intermediate shadow map to obtain the target shadow map; the use of the light model to correct the light direction of the original shadow map to obtain the intermediate shadow map of the target human body three-dimensional model, comprising: using the shadow degree information corresponding to each vertex included in the light model to perform remapping processing on the original shadow degree information corresponding to each vertex of the three-dimensional model to obtain the intermediate shadow map of the three-dimensional model.

2. The generation method of claim 1, wherein, the use of the shadow tendency map to perform light shadow mapping processing on the target shadow map to obtain the shadow color map of the three-dimensional model, comprising: remapping the shadow tendency map to the target shadow map to obtain the shadow color map of the three-dimensional model.

3. The generation method according to claim 1 or 2, characterized in that, Further comprising: obtaining a color map of the three-dimensional model; using the color map to perform color rendering on the three-dimensional model to generate an intermediate rendering model; using the shadow color map to perform shadow color rendering on the intermediate rendering model to obtain a target rendering model.

4. The generation method of claim 3, wherein, The method further comprises: obtaining a texture map corresponding to the three-dimensional model; the use of the shadow color map to perform shadow color rendering on the intermediate rendering model to obtain a target rendering model, comprising: using the shadow color map to perform shadow color rendering on the intermediate rendering model, and using the texture map to perform texture rendering on the intermediate rendering model to obtain the target rendering model.

5. The generation method of claim 4, wherein, Further comprising: using the target rendering model to generate a target rendering image of the target object.

6. The generation method of claim 1, wherein, based on the three-dimensional model and the light direction corresponding to the three-dimensional model, determining the light model corresponding to the three-dimensional model, comprising: determining the normal direction corresponding to each vertex of the three-dimensional model; for each vertex of the plurality of vertices, the dot product operation is performed on the normal direction corresponding to each vertex and the light direction to obtain the shadow degree information corresponding to each vertex; The light model is obtained based on the shadow degree information corresponding to each of the vertices.

7. An apparatus for generating a map, characterized by The method comprises the steps of: The first obtaining module is configured to obtain a three-dimensional model of a target object, an original shadow map corresponding to the three-dimensional model, and a shadow tendency map. The first processing module is configured to correct the original shadow map based on a light direction corresponding to the three-dimensional model to obtain a target shadow map corresponding to the three-dimensional model. The first processing module is configured to correct the original shadow map based on a light direction corresponding to the three-dimensional model to obtain a target shadow map corresponding to the three-dimensional model. The first processing module is configured to correct the original shadow map based on a light direction corresponding to the three-dimensional model to obtain a target shadow map corresponding to the three-dimensional model.

8. A computer device, comprising: The second processing module is configured to perform light and shadow mapping on the target shadow map based on the shadow tendency map to obtain a shadow color map corresponding to the three-dimensional model. The method comprises the steps of:

9. A computer-readable storage medium, characterized in that, The processor is configured to execute the machine-readable instructions stored in the memory, and the machine-readable instructions executed by the processor cause the processor to perform the steps of the map generation method according to any one of claims 1 to 6. The computer program is stored on the computer-readable storage medium and executed by the computer device, and the computer device performs the steps of the map generation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Subsurface scattering calculation method for semitransparent material rendering

    CN113674375A

  • Image processing device and method

    WO2019031259A1