Role face shadow processing method and device, electronic equipment and readable storage medium

By capturing mask images in segments along multiple shooting rotation axes and controlling shadow information using fusion weights and lighting angle results, the problem of cumbersome shadow processing and unstable effects in existing technologies is solved, achieving efficient and natural facial lighting effects.

CN121962404APending Publication Date: 2026-05-01BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
Filing Date
2025-12-23
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing technologies for processing facial shadows are cumbersome and complex. When the angle between SDFs is large, the fusion result is difficult to control, which can easily lead to unnatural lighting and shadow effects and affect the quality and stability of facial lighting and shadows.

Method used

By capturing mask images segmentally along multiple shooting rotation axes, grayscale transition information is generated. Shadow information is then controlled using fusion weights and illumination angle results, achieving the fusion of grayscale transition information from multiple angles. This avoids drawing a large number of SDF results and ensures the accuracy and stability of the shadow effect.

Benefits of technology

It achieves natural and realistic 360-degree shadow fitting results, improves the quality and stability of facial lighting and shadows, reduces the number of mask images, and improves processing efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962404A_ABST
    Figure CN121962404A_ABST
Patent Text Reader

Abstract

The invention discloses a role face shadow processing method and device, an electronic device and a readable storage medium, relates to the technical field of image processing, can observe a correct face illumination result of a role at each illumination angle, and improves the quality and stability of a face illumination shadow. The method comprises the following steps: determining a target role face model, and shooting a preset number of segments of mask images in a plurality of preset shooting rotation axes; generating corresponding gray scale transition information by using a preset number of segments of mask images shot in the upward direction of each shooting rotation axis, and performing assembly to obtain an image channel result; setting a corresponding fusion weight for each shooting angle according to a vertical projection angle of current illumination on a target role face model plane, and calculating an illumination angle result; sampling image channel results, fusing the sampling results of the shooting rotation axial directions according to the fusion weight, and performing control by using illumination angle results to obtain final shadow information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus, electronic device, and readable storage medium for processing facial shadows. Background Technology

[0002] In game development and image processing, facial lighting and shadow effects play a crucial role in creating a realistic and stylized character. High-quality facial lighting and shadows can accurately depict the changes in light and shadow on a character's face under different lighting conditions, enhancing the character's three-dimensionality and depth, thereby improving the player's visual experience.

[0003] In related technologies, when processing shadows on a character's face, an SDF (Signed Distance Field) facial lighting and shadow scheme can be used. This scheme generates a corresponding distance field in the horizontal direction based on a mask image customized by the artist, and then merges these distance fields into stylized facial lighting and shadows. Alternatively, a 360-degree facial lighting and shadow scheme can be used. This scheme generates stylized facial shadows by drawing 65 SDF result frames of light orientation and then performing four sampling fusions on these frames.

[0004] However, the applicant recognizes that the relevant technology has at least the following technical problems in its implementation: The source images in the SDF facial lighting and shadow scheme only contain lighting information from one direction, resulting in insufficient expressiveness when handling complex lighting scenes. It can only achieve lighting effects with a horizontal rotation of 180 degrees and cannot respond to lighting results from other directions. Although the 360-degree SDF graphics scheme can handle lighting from all directions, it requires drawing up to 65 images of lighting directions and performing four sampling and compositing of the image results. This process is not only cumbersome and complex, but also makes it difficult to control the fusion results when the angle span between SDFs is large, easily resulting in unnatural lighting and shadow effects and affecting the quality and stability of facial lighting and shadows. Summary of the Invention

[0005] In view of this, this application provides a method, apparatus, electronic device and readable storage medium for processing facial shadows. The main purpose is to solve the problem that the current process is cumbersome and complicated, and when the angle span between SDFs is large, the fusion result becomes difficult to control, which easily leads to unnatural lighting and shadow effects and affects the quality and stability of facial lighting and shadows.

[0006] According to a first aspect of this application, a method for processing facial shadows is provided, the method comprising: A target character facial model to be shadowed is determined. A preset number of mask images are captured on the target character facial model in segments along multiple preset shooting rotation axes. The multiple shooting rotation axes cover multiple discrete directions from the side to the top and bottom of the target character facial model. Using the mask images with a preset number of segments obtained by shooting along each shooting rotation axis, grayscale transition information corresponding to each shooting rotation axis is generated, and the grayscale transition information corresponding to each shooting rotation axis is assembled to obtain the image channel result. Based on the vertical projection angle of the current light on the plane of the target character's facial model, a corresponding fusion weight is set for each shooting angle, and the linear angle of the current light is calculated to obtain the lighting angle result. The lighting angle result indicates the degree of offset of the position of the current light projected on the target character's facial model relative to the front of the target character's face. The image channel results are sampled, and the sampling results of each shooting rotation axis are fused according to the fusion weight corresponding to each shooting angle. The grayscale image thresholding result of the fused result is controlled by the illumination angle result to obtain the final shadow information of the target character's facial model under the current illumination.

[0007] According to a second aspect of this application, a facial shadow processing device for a character is provided, the device comprising: The shooting module is used to determine the target character's facial model to be shadowed, and to take a preset number of mask images of the target character's facial model in segments along multiple preset shooting rotation axes. The multiple shooting rotation axes cover multiple discrete directions from the side to the top and bottom of the target character's facial model. The generation module is used to generate grayscale transition information corresponding to each shooting rotation axis by using the mask images with a preset number of segments obtained by shooting along each shooting rotation axis, and to assemble the grayscale transition information corresponding to each shooting rotation axis to obtain the image channel result. The calculation module is used to set corresponding fusion weights for each shooting angle based on the vertical projection angle of the current light on the plane of the target character's facial model, and to calculate the front and back linear angles of the current light to obtain the lighting angle result. The lighting angle result indicates the degree of offset of the position of the projection of the current light on the target character's facial model relative to the front of the target character's face. The fusion module is used to sample the image channel results, fuse the sampling results of each shooting rotation axis according to the fusion weight corresponding to each shooting angle, and control the grayscale image threshold result of the fusion result using the illumination angle result, so as to obtain the final shadow information of the target character's facial model under the current illumination.

[0008] According to a third aspect of this application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in any of the first aspects above.

[0009] According to a fourth aspect of this application, a readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first aspects above.

[0010] By utilizing the above technical solutions, this application provides a method, apparatus, electronic device, and readable storage medium for processing facial shadows. This application achieves the fusion of multi-angle grayscale transition information by setting multiple shooting rotation axes to obtain a 360-degree shadow fitting result. Furthermore, on each shooting rotation axis, the number of mask images captured is limited by a preset number of segments, eliminating the need to draw a large number of SDF results. This solves the problems of accurate direction and excessive material with fewer materials. Through fusion weight allocation, the correctness of facial lighting and shadows is ensured, and the correct facial lighting result can be observed from various lighting angles, improving the quality and stability of facial lighting and shadows.

[0011] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0012] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This illustration shows a flowchart of a character facial shadow processing method provided in an embodiment of this application; Figure 2 This application provides a schematic diagram of a photographic rotation axis according to an embodiment of the present application; Figure 3 This illustration shows a schematic diagram of facial region division provided in an embodiment of this application; Figure 4 This illustration shows a structural schematic diagram of a character facial shadow processing device provided in an embodiment of this application; Figure 5 A schematic diagram of the device structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0013] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.

[0014] This application provides a method for processing facial shadows on a character, such as... Figure 1 As shown, the method includes: S10: Determine the target character's facial model to be shadowed, and take a preset number of mask images for the target character's facial model in segments along multiple preset shooting rotation axes.

[0015] This application's embodiments can be applied to image rendering engines. The underlying architecture of the image rendering engine integrates a multi-layered graphics processing pipeline, covering the complete process from geometric data parsing to pixel-level shading. Regarding character facial shadow rendering, the image rendering engine achieves precise alignment between model space and lighting space by constructing a coordinate system transformation module. Simultaneously, it integrates a physically based lighting calculation model to dynamically simulate the interaction between light and facial surfaces. In this application's embodiments, by introducing multi-directional distance field baking technology and grayscale transition information fusion algorithms, the image rendering engine can achieve real-time shadow weight calculation and channel blending at the GPU (Graphics Processing Unit) shader level. Combined with texture sampling optimization strategies, this significantly improves the accuracy and performance of shadow rendering, providing strong underlying support for character facial representation under complex lighting environments.

[0016] First, the image rendering engine identifies the target character's facial model that requires shadow processing. This model is the foundation for all subsequent processing. Next, the engine determines multiple preset shooting rotation axes, covering discrete directions from the side to the top and bottom of the target character's facial model. Specifically, these axes include five rotation axes: up, upper right, right, lower right, and down. These axes are used to capture lighting information from different angles. The engine then takes a preset number of mask images for each rotation axis, segmenting the target character's facial model. Specifically, it takes mask images according to a specific angular range. For example, assuming the current lighting is 0° in front of the face, the engine takes the five rotation axes (up, upper right, right, lower right, and down) and subdivides each axis into eight segments based on the angle from the back of the head to 0°. Each segment corresponds to a mask image, resulting in a preset number of mask images taken along each rotation axis. The mask images record the lighting conditions of different areas of the target character's facial model under the current lighting conditions and are the basic data for generating the distance field (SDF).

[0017] In this way, by capturing mask images segmented along different rotation axes, the lighting conditions of the character's face under different lighting angles can be comprehensively captured, providing a rich data source for subsequent generation of multi-angle grayscale transition information. At the same time, the preset number of segments limits the number of mask images, avoiding the high cost of drawing a large number of SDF results and improving processing efficiency. For example, when rendering shadows on a cartoon character's facial model, 40 mask images are captured along five rotation axes (upper, upper right, right, lower right, and lower), with eight segments on each axis. These mask images record the lighting conditions of the character's face under different lighting angles, providing basic data for subsequent processing.

[0018] In step S10, which involves determining the target character's facial model to be shadowed, a preset number of mask images are captured on the target character's facial model along multiple preset shooting rotation axes. This includes the following steps: S11: Determine the preset number of segments and multiple shooting rotation axes.

[0019] In this embodiment, the image rendering engine has a preset number of segments, which can be set according to the complexity of the target character's facial model and the required shadow accuracy. Simultaneously, the image rendering engine also determines multiple shooting rotation axes, including an upward rotation axis, an upward-right rotation axis, a right rotation axis, a downward-right rotation axis, and a downward rotation axis. These axes cover the main directions in which the character's face may be illuminated, ensuring accurate shadow information can be captured from all angles. See details... Figure 2 , Figure 2 The document describes multiple shooting rotation axes. Figure 2The black area in the middle represents the character's face, and the two holes on it can be seen as the position of the eyes. The multiple colored lines around the face represent the light projections from different shooting rotation axes. These axes include directions such as up, upper right, right, lower right, and down, covering the main directions in which the character's face may be illuminated.

[0020] In this way, by presetting the number of segments and multiple shooting rotation axes, the acquisition of shadow data can be systematically controlled, avoiding the omission of important lighting angles. At the same time, the total number of mask images is limited, reducing the amount of data for subsequent processing. This ensures that comprehensive fusion of multi-angle grayscale transition information is achieved with fewer materials, laying the foundation for obtaining 360-degree shadow fitting results and improving the accuracy and efficiency of character facial shadow rendering. For example, if the preset number of segments is 8, that is, 8 mask images are taken for each shooting rotation direction; at the same time, 5 shooting rotation axes are determined: up, upper right, right, lower right, and down. In this way, a total of 40 mask images need to be taken (5 axes × 8 segments) to cover all possible lighting angles of the character's face.

[0021] S12: Rotate and photograph the target character's facial model along each shooting rotation axis according to the preset number of segments until the preset end shooting angle is reached, and obtain the mask map with the preset number of segments photographed along each shooting rotation axis.

[0022] In this embodiment, the image rendering engine will rotate and capture images gradually along each shooting rotation axis, starting from the initial angle and according to the preset number of segments. A mask image will be captured every certain angle of rotation until the preset end shooting angle is reached, thus obtaining a mask image with the preset number of segments captured along each shooting rotation axis.

[0023] It should be noted that in this embodiment, the ending shooting angle is set to cover half of the target character's facial model. This is because mirroring technology can be used to generate shadow information for the other half, thus saving resources. Furthermore, during shooting, the image rendering engine ensures that the camera position and lighting conditions remain consistent to accurately record the facial lighting at each angle.

[0024] In this way, by rotating and shooting along each shooting axis according to a preset number of segments, detailed shadow information of the character's face under different lighting angles can be systematically collected. By limiting the shooting to half of the face area and combining it with mirroring technology, the shooting workload is effectively reduced, while ensuring the integrity and accuracy of the shadow data. This provides basic data for the subsequent generation of multi-angle grayscale transition information, making the final 360-degree shadow fitting result more natural and realistic, and improving the quality and stability of the character's facial lighting and shadows.

[0025] S20: Using the mask images with a preset number of segments obtained by shooting along each shooting rotation axis, generate grayscale transition information corresponding to each shooting rotation axis, and assemble the grayscale transition information corresponding to each shooting rotation axis to obtain the image channel result.

[0026] In this embodiment, for each shooting rotation axis, the image rendering engine uses a mask map with a preset number of segments to calculate and generate planar distance field information using an algorithm (such as 8ssedt). The planar distance field information shows the distance information from different areas to the light source when viewing the character's face from that axis. Subsequently, the image rendering engine fuses the planar distance field information of the preset number of segments for each shooting rotation axis into a grayscale transition information. The grayscale transition information reflects the gradual change in the light intensity received by the face through changes in grayscale values. Finally, the grayscale transition information of multiple shooting rotation axes is assembled into an image to obtain the image channel result, realizing the effective integration of multi-angle lighting information, providing a basis for subsequent shadow fusion, and also improving the image sampling hit rate, because all relevant information is concentrated in one image.

[0027] In step S20, which involves using the mask images with a preset number of segments obtained along each shooting rotation axis to generate corresponding grayscale transition information for each shooting rotation axis, and assembling the grayscale transition information corresponding to each shooting rotation axis to obtain the image channel result, the following steps are included: S21: Calculate the planar distance field information of the mask map with a preset number of segments obtained by shooting along each shooting rotation axis, so as to obtain the grayscale transition information corresponding to each shooting rotation axis.

[0028] In this embodiment, for each mask image captured upwards along each shooting rotation axis, the image rendering engine first calculates the planar distance field (SDF) information to obtain the planar distance field information of a preset number of segments corresponding to the shooting rotation axis. SDF is a function representing the distance from a point in a scene to the surface of the nearest object; its positive or negative value indicates whether the point is inside or outside the object, and its absolute value represents the distance.

[0029] Through calculation, each mask image is converted into a corresponding planar distance field information map, which records the distance from different areas of the face to the illumination boundary. Subsequently, the image rendering engine uses a preset fusion algorithm, such as the 8ssedt algorithm, to calculate and fuse all planar distance field information along the same shooting rotation axis, generating image content with grayscale transition effects as grayscale transition information corresponding to the shooting rotation axis. The grayscale transition effect uses different gray values ​​to represent the gradual change of shadows from dark to light, providing a foundation for subsequent multi-angle fusion.

[0030] In this way, by calculating planar distance field information and fusing it to generate a grayscale transition image, the transformation from discrete mask images to continuous shadow representation is achieved. This provides an accurate data foundation for subsequent multi-angle shadow fusion, reduces the complexity of directly processing a large number of original mask images, and improves the efficiency and accuracy of shadow processing. For example, assuming eight mask images are captured along the upper rotation axis, and each image yields corresponding distance field information after SDF calculation, the fusion algorithm fuses these distance field information into a single grayscale transition image, where dark areas represent areas with deeper shadows and light areas represent areas with lighter shadows or areas unaffected by light.

[0031] S22: Generate the right half image index by utilizing the grayscale transition information corresponding to the lower rotation axis of multiple shooting rotation axes.

[0032] Due to the limitation on the number of texture channels (e.g., four RGBA channels are insufficient to directly store grayscale information for five axes), in this embodiment, the image rendering engine uses two indices to assemble the grayscale transition information for the five shooting rotation axes into a 2:1 ratio image. Therefore, firstly, the image rendering engine selects the grayscale transition information corresponding to the lower rotation axis as the basis, and generates the right half image index of an image through specified image processing techniques, such as index mapping. That is, the grayscale transition information of the lower rotation axis is stored in the R channel of the right half of the image. Image indexing is a method of encoding grayscale image information into a more compact form, which is convenient for subsequent processing and storage.

[0033] S23: Determine multiple other shooting rotation axes, assemble multiple other grayscale transition information corresponding to the multiple other shooting rotation axes, and obtain the left half image index.

[0034] In this embodiment, the image rendering engine excludes the lower rotation axis from all shooting rotation axes, assembles the grayscale transition information corresponding to the remaining axes (upper, upper right, right, lower right), and arranges and combines the grayscale information of different axes according to the facial logical direction to form the left half image index of an image.

[0035] It should be noted that during assembly, the lighting transition and shadow blending between each axis need to be considered to ensure the naturalness and continuity of the shadows in the left half. Specifically, the grayscale transition information of the four shooting rotation axes (upper, upper right, right, and lower right) needs to be stored in the R, G, B, and A channels of the left half of the image, respectively. As mentioned above, the grayscale transition information of the lower rotation axis is stored in the R channel of the right half of the image. Since only one channel is used in the right half, the overall image ratio obtained by combining the left half image index with the right half image index is 2:1.

[0036] In this way, by assembling multiple other grayscale transition information, the consistency and coordination between the left half shadow and the right half in terms of lighting and shadow representation are ensured, thereby enhancing the realism of the overall shadow effect.

[0037] S24: Combine the right half image index and the left half image index to obtain the image channel result.

[0038] In this embodiment, the image rendering engine combines the right half image index with the left half image index to form a complete image channel result. During combination, it ensures that the left and right images are correctly aligned in space and that the channel information does not conflict. The final image channel result contains complete shadow information of the character's face along all preset rotation axes, which can be directly used in subsequent rendering processes. This achieves comprehensive fusion of multi-angle grayscale transition information, resulting in shadow fitting results that cover 360-degree lighting changes. This not only improves the efficiency and accuracy of shadow processing but also ensures that the character's face presents correct and natural shadow effects under different lighting angles, significantly improving the quality and stability of facial lighting and shadows.

[0039] S30: Based on the vertical projection angle of the current light on the plane of the target character's facial model, set corresponding fusion weights for each shooting angle, and calculate the linear angle of the current light to obtain the lighting angle result.

[0040] In this embodiment, the image rendering engine first constructs a facial coordinate system, then calculates the vertical projection angle of the current light onto the plane of the target character's facial model. Based on this angle, it determines which area (e.g., upper top, upper right) the current light falls on in the facial coordinate system, and sets the corresponding fusion weight for each shooting angle accordingly. Simultaneously, the image rendering engine calculates the linear angles of the current light to obtain the lighting angle result indicating whether the target character's facial model is illuminated from the front or back. The lighting angle result ranges from 0 (front illumination) to 1 (back illumination), indicating the degree of offset of the position of the current light projection on the target character's facial model relative to the front of the target character's face.

[0041] In this way, by setting blending weights for each shooting angle and adjusting the shadow range according to the lighting angle results, a dynamic response of shadows to changes in lighting can be achieved, improving the realism and accuracy of facial lighting. For example, assuming the current vertical projection angle of the light on the face plane is 30°, the light source falls between the upper and upper right. Blending weights for the upper and upper right axes are set according to preset rules, so that the shadow information of these two axes is blended in the final result according to a certain proportion. Simultaneously, assuming the calculated light angle result is 0.3, 0.3 is used to indicate that the current lighting is from the side of the face, and the shadow range should be adjusted accordingly.

[0042] In step S30, which involves setting corresponding fusion weights for each shooting angle based on the vertical projection angle of the current light onto the plane of the target character's facial model, the following steps are included: S31: Construct a facial coordinate system for the target character's facial model, and divide half of the target character's facial model into multiple sub-regions based on multiple shooting rotation axes.

[0043] In this embodiment, the image rendering engine first constructs a facial coordinate system for the target character's facial model. This system includes three key directions: Front (directly in front of the face, i.e., the direction the character is facing), Up (the direction of the top of the head, perpendicular to the facial plane and pointing towards the top of the head), and Right (obtained by the cross product of Front and Up, representing the direction of the right ear). The purpose of constructing the facial coordinate system is to ensure that regardless of how the model rotates within the overall scene, lighting calculations are based on the logical orientation of the face itself, avoiding errors in lighting calculations due to model rotation. Next, the image rendering engine divides half of the target character's facial model into multiple sub-regions based on multiple shooting rotation axes, specifically as follows: Figure 3 As shown, according to multiple shooting rotation axes, half of the facial area is divided into four regions consisting of PI / 4, PI / 2, 0, -PI / 2, and -PI / 4. These regions are used to determine the target sub-regions based on the projection angle of the light.

[0044] In this way, by constructing a facial coordinate system, a unified and stable reference benchmark is provided for subsequent lighting calculations, ensuring that the lighting effect is not affected by the overall rotation of the model. Furthermore, dividing the face into multiple regions provides a basis for accurately identifying the facial parts affected by lighting, which helps to accurately allocate fusion weights according to the lighting conditions of different regions and improve the accuracy of shadow fitting.

[0045] S32: Based on the vertical projection angle of the current light on the plane of the target character's face model, determine the arc angle of the current light on the face coordinate system, and identify the target sub-region to which the arc angle belongs in multiple sub-regions.

[0046] In this embodiment, the image rendering engine first calculates the vertical projection angle of the current light on the plane of the target character's facial model. The vertical projection angle reflects whether the light is coming from the top of the head, cheek, or chin, etc. Then, based on the facial coordinate system, the image rendering engine converts the vertical projection angle into a radian angle, compares the calculated radian angle with the angle range of multiple sub-regions, and identifies the target sub-region to which the radian angle belongs. For example, continuing with... Figure 3 For example, if the arc angle is between PI / 4 and PI / 2, then the light source is considered to fall between the upper and upper right. At this time, the facial area corresponding to the upper and upper right, that is, the area formed between PI / 4 and PI / 2, is the target sub-region.

[0047] In this way, by determining the arc angle of the light on the facial coordinate system and identifying the target sub-region, the range of the light's influence on the face can be accurately located, providing a basis for subsequently assigning blending weights to the target sub-region and ensuring the accurate presentation of shadow effects under different lighting angles.

[0048] S33: Determine two first shooting rotation axes among multiple shooting rotation axes.

[0049] In this embodiment, the image rendering engine determines two first shooting rotation axes among multiple shooting rotation axes, wherein the two boundaries of the target sub-region are located on the two first shooting rotation axes. Continuing with... Figure 3 For example, assuming the area formed between PI / 4 and PI / 2 is the target sub-region, the two determined first shooting rotation axes are divided into shooting rotation axes corresponding to PI / 4 and PI / 2, that is, the upper and upper right shooting rotation axes.

[0050] S34: Query the axial angle corresponding to each first shooting rotation axis to obtain two axial angles. Use the two axial angles and the radian angle to calculate the fusion weight corresponding to each first shooting rotation axis.

[0051] In this embodiment, the image rendering engine queries the axial angle corresponding to each first shooting rotation axis to obtain two axial angles. Using the two axial angles and the radian angle, it calculates the fusion weight corresponding to each first shooting rotation axis.

[0052] Continuing with the example above, assuming the two first shooting rotation axes are PI / 4 and PI / 2, and the radian angle is represented by angle, the image rendering engine can use linear interpolation to assign fusion weights, mapping the radian angle angle to the corresponding interval w = (angle - PI / 4) / (PI / 2 - PI / 4), thus calculating a weight of (0, 1). This weight is set as the fusion weight corresponding to PI / 4, and the corresponding fusion weight for PI / 2 is set to 1.0 - w. This yields the fusion weights corresponding to the top and top right shooting rotation axes, enabling the grayscale transition information of different shooting axes to be fused according to the lighting conditions of the facial area under multi-angle lighting, achieving effective fusion of multi-angle grayscale transition information, and laying the foundation for obtaining 360-degree shadow fitting results.

[0053] S35: Obtain the default weight value, determine multiple second shooting rotation axes among multiple shooting rotation axes, set the corresponding fusion weight for each second shooting rotation axis using the default weight value, and the multiple second shooting rotation axes are shooting rotation axes other than the two first shooting rotation axes among the multiple shooting rotation axes.

[0054] In this embodiment, after completing the above steps, the image rendering engine checks multiple shooting rotation axes (up, upper right, right, lower right, and down) to find the shooting rotation axes other than the two first shooting rotation axes. Continuing with the example above, the two first shooting rotation axes are up and upper right, so the determined multiple second shooting rotation axes are right, lower right, and down.

[0055] For multiple second-shot rotation axes, the image rendering engine obtains pre-set default weight values. These default weight values ​​can be set to 0, as lighting does not contribute weight, so setting them to 0 is sufficient. The image rendering engine uses these default weight values ​​to set corresponding blending weights for these second-shot rotation axes, ensuring that all shooting rotation axes have corresponding blending weights to participate in subsequent shadow fitting calculations. This avoids shadow calculation errors caused by missing weights for some axes, further improving the quality and stability of facial lighting and shadows, and ensuring that the correct facial lighting results can be observed from various lighting angles. For example, assuming that in a certain lighting condition, the determined multiple second-shot rotation axes are right, lower right, and down, and the default weight value is 0, then the blending weights for these shooting axes will be set to 0, so that they do not contribute weight in subsequent shadow fitting calculations.

[0056] In step S30, which involves calculating the linear angle between the front and back of the current illumination to obtain the illumination angle result used to indicate whether the target character's facial model is illuminated from the front or back, the following steps are included: S35: Determine the illuminated area of ​​the target character's facial model based on the vertical projection angle of the current light onto the plane of the target character's facial model.

[0057] In this embodiment, the vertical projection angle is calculated in the above process. The vertical projection angle refers to the angle between the projection formed by light rays on the facial model plane in a direction perpendicular to the facial plane and a specific reference direction of the facial plane (such as the direction directly in front of the face). By calculating this vertical projection angle, it is possible to determine whether the light is coming from the front or the back of the character's face. Therefore, the image rendering engine determines the illuminated area of ​​the target character's facial model based on the current vertical projection angle of the light illuminating the target character's facial model plane. Specifically, when the vertical projection angle causes the light to mainly illuminate the front area of ​​the face, the illuminated area of ​​the target character's facial model is determined to be the front; conversely, when the light mainly illuminates the back area of ​​the face, the illuminated area is determined to be the back.

[0058] In this way, accurately determining the illuminated area (front or back) of the target character's facial model provides a crucial basis for calculating subsequent lighting angles. Clearly defining the illuminated area helps in the rational allocation of shadow resources, ensuring that shadow effects are accurately presented according to the facial lighting conditions. This avoids abnormal shadow display caused by incorrect determination of the illuminated area, laying the foundation for improving the quality and stability of facial lighting and shadows. For example, in a virtual scene, there is a character's facial model. A beam of light shines from slightly above and directly in front of the character's face. After calculating the vertical projection angle of this light beam on the plane of the facial model, it is found that the light mainly illuminates the front area of ​​the face. Therefore, it can be determined that the illuminated area of ​​the target character's facial model is the front.

[0059] S36: Determine a preset linear range, map the illuminated area to the linear range, determine the linear value corresponding to the illuminated area in the linear range, and use the linear value as the illumination angle result.

[0060] In this embodiment, the image rendering engine pre-defines a linear range from 0 to 1, where 0 represents the front of the target character's facial model being illuminated, and 1 represents the back of the target character's facial model being illuminated. The image rendering engine maps the determined illuminated areas to this linear range. For example, if the illuminated area is the front, it is mapped to position 0 of the linear range; if the illuminated area is the back, it is mapped to position 1 of the linear range. Through this mapping relationship, the linear value corresponding to the illuminated area in the linear range is calculated. This linear value, which is between 0 and 1, indicates the degree of offset of the current position of the projection of the light onto the target character's facial model relative to the front of the target character's face. Finally, this linear value is used as the illumination angle result, which can concisely and clearly indicate the illumination situation of the target character's facial model, providing key parameters for the subsequent determination of the SDF shadow range. Since the grayscale image fused by SDF can be understood as an image that displays the progress of the binary shadow according to the threshold, the result of this illumination angle can be regarded as a dynamic threshold that controls the progress of this image. It is mapped to the process range of (0,1) from the front to the back, which is used to drive the grayscale image threshold result of the weighted fusion channel result, so as to achieve the effect of whether the shadow range is driven by the light rotating to the front or the back of the head, ensuring the linearity and uniform speed of the shadow movement with the illumination, and avoiding the problem of changing too fast.

[0061] In this way, by mapping the illuminated area to a preset linear range and obtaining a linear value as the lighting angle result, a quantitative representation of the lighting condition of the target character's facial model is achieved. This facilitates subsequent calculations and operations during shadow processing, enabling precise control of the SDF shadow range and ensuring that the shadow moves linearly and at a uniform speed with the light, avoiding the problem of shadows changing too quickly. This improves the quality and stability of facial lighting and shadows, allowing the character to present the correct facial lighting result at various lighting angles. For example, after determining that the illuminated area is frontal, it is mapped to a preset 0-1 linear range, corresponding to a linear value of 0. This 0 value is used as the lighting angle result. In subsequent SDF shadow processing, this 0 value will be used as a dynamic threshold to drive the grayscale image threshold of the weighted fusion channel result, controlling the shadow range and ensuring the rationality and stability of the shadow's movement with the light.

[0062] S40: Sample the image channel results, fuse the sampling results of each shooting rotation axis according to the fusion weight corresponding to each shooting angle, and use the illumination angle results to control the grayscale image threshold results of the fusion results to obtain the final shadow information of the target character's facial model under the current illumination.

[0063] In this embodiment, the image rendering engine samples the assembled image channel results and performs weighted fusion of the sampling results along each rotation axis according to the fusion weights corresponding to each shooting angle. Simultaneously, the image rendering engine uses the illumination angle results to control the grayscale image threshold of the fusion result, causing the shadow range to dynamically adjust with changes in illumination, ultimately obtaining the final shadow information of the target character's facial model under the current illumination.

[0064] In this way, through weighted fusion and threshold control, the shadow information is dynamically adjusted and optimized, so that the character's face can present the correct shadow effect under different lighting angles, thereby improving the quality and stability of facial lighting and shadows.

[0065] In step S40, which involves sampling the image channel results, setting corresponding fusion weights based on each shooting angle, fusing the sampling results along each shooting rotation axis, and controlling the grayscale image thresholding result of the fused result using the illumination angle result to obtain the final shadow information of the target character's facial model under the current illumination, the steps are as follows: S41: Mirror the image channel results to obtain complete channel information, and sample the right half image index and left half image index in the complete channel information in batches. Integrate the results obtained from the two batches of sampling to obtain the sampling results of each shooting rotation axis.

[0066] As can be seen from the above, in order to save image space, the SDF channel information only renders half of the target character's facial model. Therefore, in this embodiment, the image rendering engine will mirror the image channel results and obtain complete information by mirroring the UVs of the left and right faces to obtain complete channel information. The complete channel information is divided into two parts with a ratio of 2×1. Therefore, during batch sampling, the right half of the image index in the complete channel information is sampled first, and pixel data is obtained from the right half of the image according to sampling rules (such as uniform sampling). Then, the left half of the image index is sampled according to the same rules. The results obtained from these two batches of sampling are integrated. The integration method can be to stitch the left and right sampling results together according to the original layout of the image, thereby obtaining the sampling results for each shooting rotation axis.

[0067] In this way, an image is stored contiguously in memory, which can make full use of the continuity of the image in memory. By dividing it into two parts, sampling the left and right parts separately, and then merging them, the sampling hit rate can be improved. While saving image space (only drawing half of the face information), the sampling results of each shooting rotation axis can be accurately obtained, which provides a reliable data foundation for subsequent weight calculation and shadow fusion. This helps to improve the overall shadow processing performance and can obtain the required shadow information more efficiently.

[0068] S42: Set corresponding fusion weights for each shooting angle, calculate the weights of the sampling results for each shooting rotation axis, and obtain the fusion result.

[0069] In this embodiment, the image rendering engine sets corresponding fusion weights for each shooting angle. When calculating the weights for the sampling results along each shooting rotation axis, the sampling result along each shooting rotation axis is multiplied by its corresponding fusion weight, and then all the weighted sampling results are added together. For example, if there are three shooting rotation axes with sampling results A, B, and C, and corresponding fusion weights a, b, and c, the fusion result is aA + bB + cC. In this way, the sampling results from different shooting rotation axes are fused according to a certain ratio to obtain a comprehensive fusion result that takes into account the shadow information from each shooting angle.

[0070] In this way, by setting corresponding fusion weights for each shooting angle and performing calculations, the shadow information of different shooting rotation axes can be reasonably integrated to achieve the fusion of grayscale transition information from multiple angles, resulting in a more comprehensive and accurate fusion result. This helps to obtain 360-degree shadow fitting results, improve the quality of facial lighting and shadows, and ensure that the character can present the correct facial lighting and shadow effects under different lighting angles.

[0071] S43: Based on the illumination angle result, drive the grayscale image threshold result in the fusion result to perform dynamic transformation so that the shadow effect rotates with the illumination angle result to obtain the final shadow information.

[0072] In this embodiment, the illumination angle result is determined in the above process. This illumination angle result indicates whether the target character's facial model is illuminated from the front or back. Therefore, the image rendering engine uses this illumination angle result to dynamically transform the grayscale image threshold result in the fusion result, causing the shadow effect to rotate with the illumination angle result to obtain the final shadow information. The grayscale image threshold result is a threshold that controls the shadow display range. By dynamically transforming this threshold, the shadow effect can rotate accordingly with changes in the illumination angle. For example, when the illumination angle gradually shifts from the front to the back, the grayscale image threshold result will also change accordingly, causing a reasonable change in the distribution and display range of the shadow on the face.

[0073] After obtaining the final shadow information, the image rendering engine identifies the direction of the current light source and determines whether the light is coming from the left or right ear of the target character. If the direction of the light source is inconsistent with the default direction (e.g., the default light source comes from the right), for example, the light comes from the left, then the final shadow information is horizontally flipped according to the direction of the light source, that is, the UV.x axis is flipped to match the final shadow information with the direction of the light source. This ensures that regardless of where the light is, data from the illuminated side of the SDF surface can be captured, presenting the correct shadow effect.

[0074] In this way, by dynamically transforming the grayscale image thresholding result based on the illumination angle, the shadow effect can change accurately and in real time with the illumination angle, resulting in final shadow information that conforms to the actual situation. Furthermore, horizontal flipping based on the illumination source direction further ensures the matching of the final shadow information with the illumination direction, solving the adaptation problem of unidirectional baking results under different illumination directions. This ensures that the correct facial illumination result can be observed from all illumination angles, improving the quality and stability of facial lighting and shadows. For example, in a virtual scene, the illumination angle result of the target character's facial model shows backlighting. Based on this result, the grayscale image thresholding result in the fusion result is dynamically transformed to make the shadow display reasonably in the back area of ​​the face. Then, it is recognized that the illumination source direction is from the left, which is different from the default right light source direction. Therefore, the final shadow information is horizontally flipped, flipping the UV.x axis to match the shadow effect with the left illumination direction, presenting the correct facial shadow.

[0075] The method provided in this application embodiment achieves the fusion of multi-angle grayscale transition information by setting multiple shooting rotation axes to obtain a 360-degree shadow fitting result. Furthermore, on each shooting rotation axis, the number of mask images captured is limited by a preset number of segments, eliminating the need to draw a large number of SDF results. This solves the problems of accurate direction and excessive material with fewer materials. Through fusion weight allocation, the correctness of facial lighting and shadow rendering of the character is ensured. The correct facial lighting result of the character can be observed from various lighting angles, improving the quality and stability of facial lighting and shadow.

[0076] Furthermore, as Figure 1 To specifically implement the method, this application provides a facial shadow processing device for characters, such as... Figure 4 As shown, the device includes: a shooting module 401, a generating module 402, a calculation module 403, and a fusion module 404.

[0077] The shooting module 401 is used to determine the target character's facial model to be shadowed, and to take a preset number of mask images of the target character's facial model in segments along multiple preset shooting rotation axes. The multiple shooting rotation axes cover multiple discrete directions from the side to the top and bottom of the target character's facial model. The generation module 402 is used to generate grayscale transition information corresponding to each shooting rotation axis by using the mask map with a preset number of segments obtained by shooting along each shooting rotation axis, and to assemble the grayscale transition information corresponding to each shooting rotation axis to obtain the image channel result. The calculation module 403 is used to set corresponding fusion weights for each shooting angle based on the vertical projection angle of the current light on the plane of the target character's facial model, and to calculate the front and back linear angles of the current light to obtain the lighting angle result. The lighting angle result indicates the degree of offset of the position of the projection of the current light on the target character's facial model relative to the front of the target character's face. The fusion module 404 is used to sample the image channel results, fuse the sampling results of each shooting rotation axis according to the fusion weight corresponding to each shooting angle, and control the grayscale image threshold result of the obtained fusion result using the illumination angle result, so as to obtain the final shadow information of the target character's facial model under the current illumination.

[0078] In a specific application scenario, the shooting module 401 is used to determine the preset number of segments and the multiple shooting rotation axes, including an upper rotation axis, an upper right rotation axis, a right rotation axis, a lower right rotation axis, and a lower rotation axis; on each shooting rotation axis, the target character's facial model is rotated and shot according to the preset number of segments until it is rotated to a preset end shooting angle, thereby obtaining a mask map with the preset number of segments shot on each shooting rotation axis, wherein the end shooting angle is used to limit the shooting of half of the facial area of ​​the target character's facial model.

[0079] In a specific application scenario, the generation module 402 is used to calculate the planar distance field information of the mask images with a preset number of segments captured along each shooting rotation axis to obtain the grayscale transition information corresponding to each shooting rotation axis; using the grayscale transition information corresponding to the lower rotation axis among the multiple shooting rotation axes, a right half image index is generated; multiple other shooting rotation axes are determined, and multiple other grayscale transition information corresponding to the multiple other shooting rotation axes are assembled to obtain a left half image index, wherein the multiple other shooting rotation axes include an upper rotation axis, a right upper rotation axis, a right rotation axis, and a right lower rotation axis; the right half image index and the left half image index are combined to obtain the image channel result.

[0080] In a specific application scenario, the generation module 402 is used to calculate planar distance field information for each mask image captured on each shooting rotation axis, and obtain the planar distance field information of the preset number of segments corresponding to each shooting rotation axis; using a preset fusion algorithm, the planar distance field information of the preset number of segments corresponding to each shooting rotation axis is calculated and fused, and for each shooting rotation axis, the image content with grayscale transition effect is obtained as the grayscale transition information corresponding to each shooting rotation axis.

[0081] In a specific application scenario, the calculation module 403 is used to construct a facial coordinate system for the target character's facial model, and to divide half of the target character's facial model's facial region into multiple sub-regions based on the multiple shooting rotation axes; to determine the radian angle of the current light on the facial model's plane based on the vertical projection angle of the current light, and to identify the target sub-region to which the radian angle belongs among the multiple sub-regions; to determine two first shooting rotation axes among the multiple shooting rotation axes, wherein the two boundaries of the target sub-region are located on the two first shooting rotation axes; to query the axial angle corresponding to each first shooting rotation axis to obtain two axial angles, and to calculate the fusion weight corresponding to each first shooting rotation axis using the two axial angles and the radian angle; to obtain a default weight value, to determine multiple second shooting rotation axes among the multiple shooting rotation axes, and to set a corresponding fusion weight for each second shooting rotation axis using the default weight value, wherein the multiple second shooting rotation axes are shooting rotation axes other than the two first shooting rotation axes among the multiple shooting rotation axes.

[0082] In a specific application scenario, the calculation module 403 is used to determine the illuminated area of ​​the target character's face model based on the vertical projection angle of the current light on the plane of the target character's face model, wherein the illuminated area is the front or the back; determine a preset linear range, map the illuminated area into the linear range to determine the linear value corresponding to the illuminated area in the linear range, and use the linear value as the illumination angle result, wherein the linear range is 0 to 1.

[0083] In a specific application scenario, the fusion module 404 is used to mirror the image channel results to obtain complete channel information, and to sample the right half image index and the left half image index in the complete channel information in batches. The results obtained from the two batches of sampling are integrated to obtain the sampling results of each shooting rotation axis. The fusion weights are set according to each shooting angle, and the weights of the sampling results of each shooting rotation axis are calculated to obtain the fusion result. Based on the illumination angle result, the grayscale image threshold result in the fusion result is driven to undergo dynamic transformation so that the shadow effect rotates with the illumination angle result to obtain the final shadow information. After obtaining the final shadow information, the illumination source direction of the current illumination is identified, and it is determined whether to perform horizontal flip processing on the final shadow information according to the illumination source direction so that the final shadow information matches the illumination source direction.

[0084] The device provided in this application embodiment achieves the fusion of multi-angle grayscale transition information by setting multiple shooting rotation axes to obtain a 360-degree shadow fitting result. Furthermore, on each shooting rotation axis, the number of mask images captured is limited by a preset number of segments, eliminating the need to draw a large number of SDF results. This solves the problems of accurate direction and excessive material with fewer materials. Through fusion weight allocation, the correctness of facial lighting and shadow rendering of the character is ensured. The correct facial lighting result of the character can be observed from various lighting angles, improving the quality and stability of facial lighting and shadow.

[0085] It should be noted that other corresponding descriptions of the functional units involved in the character facial shadow processing device provided in this application embodiment can be found in the following references. Figures 1 to 4 The corresponding descriptions in [the document] will not be repeated here.

[0086] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0087] The above embodiments and the technical features in the embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0088] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

[0089] In an exemplary embodiment, see Figure 5 Furthermore, an electronic device is provided, comprising a bus, a processor, a memory, and a communication interface. It may also include an input / output interface and a display device, wherein the various functional units can communicate with each other via the bus. The memory stores a computer program, and the processor executes the program stored in the memory to perform the facial shadow processing method described in the above embodiments.

[0090] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the character facial shadow processing method.

[0091] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented in hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) and includes several instructions to cause an electronic device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0092] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application.

[0093] Those skilled in the art will understand that the modules in the apparatus of the implementation scenario can be distributed within the apparatus of the implementation scenario as described, or they can be located in one or more apparatuses different from this implementation scenario, with corresponding changes. The modules of the above-described implementation scenario can be combined into one module, or they can be further divided into multiple sub-modules.

[0094] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of the implementation scenario.

[0095] The above disclosures are only a few specific implementation scenarios of this application. However, this application is not limited to these. Any variations that can be conceived by those skilled in the art should fall within the protection scope of this application.

Claims

1. A method for processing facial shadows on a character, characterized in that, include: A target character facial model to be shadowed is determined. A preset number of mask images are captured on the target character facial model in segments along multiple preset shooting rotation axes. The multiple shooting rotation axes cover multiple discrete directions from the side to the top and bottom of the target character facial model. Using the mask images with a preset number of segments obtained by shooting along each shooting rotation axis, grayscale transition information corresponding to each shooting rotation axis is generated, and the grayscale transition information corresponding to each shooting rotation axis is assembled to obtain the image channel result. Based on the vertical projection angle of the current light on the plane of the target character's facial model, a corresponding fusion weight is set for each shooting angle, and the linear angle of the current light is calculated to obtain the lighting angle result. The lighting angle result indicates the degree of offset of the position of the current light projected on the target character's facial model relative to the front of the target character's face. The image channel results are sampled, and the sampling results of each shooting rotation axis are fused according to the fusion weight corresponding to each shooting angle. The grayscale image thresholding result of the fused result is controlled by the illumination angle result to obtain the final shadow information of the target character's facial model under the current illumination.

2. The method according to claim 1, characterized in that, The process involves determining the target character's facial model to be shadowed, and capturing a preset number of mask images for the target character's facial model segmented along multiple preset shooting rotation axes, including: The preset number of segments and the plurality of shooting rotation axes are determined, including the upper rotation axis, the upper right rotation axis, the right rotation axis, the lower right rotation axis, and the lower rotation axis. On each shooting rotation axis, the target character's facial model is rotated and photographed according to a preset number of segments until it reaches a preset end shooting angle, resulting in a mask map with a preset number of segments photographed on each shooting rotation axis. The end shooting angle is used to limit the photographing of half of the target character's facial model's facial area.

3. The method according to claim 2, characterized in that, The process involves using mask images with a preset number of segments captured along each shooting rotation axis to generate grayscale transition information corresponding to each shooting rotation axis, and assembling the grayscale transition information corresponding to each shooting rotation axis to obtain image channel results, including: The planar distance field information of the mask images with a preset number of segments obtained by shooting upwards along each shooting rotation axis is calculated to obtain the grayscale transition information corresponding to each shooting rotation axis. Using the grayscale transition information corresponding to the lower rotation axis in the multiple shooting rotation axes, a right half image index is generated; Multiple other shooting rotation axes are determined, and multiple other grayscale transition information corresponding to the multiple other shooting rotation axes are assembled to obtain the left half image index. The multiple other shooting rotation axes include the upper rotation axis, the upper right rotation axis, the right rotation axis, and the lower right rotation axis. The image channel result is obtained by combining the right half image index and the left half image index.

4. The method according to claim 3, characterized in that, The calculation of planar distance field information for the mask images obtained by shooting along each shooting rotation axis with a preset number of segments, in order to obtain grayscale transition information corresponding to each shooting rotation axis, includes: For each mask image captured on each shooting rotation axis, planar distance field information is calculated to obtain the planar distance field information corresponding to the preset number of segments for each shooting rotation axis; A preset fusion algorithm is used to calculate and fuse the planar distance field information of the preset number of segments corresponding to each shooting rotation axis. For each shooting rotation axis, the image content with grayscale transition effect is obtained as the grayscale transition information corresponding to each shooting rotation axis.

5. The method according to claim 1, characterized in that, The step of setting corresponding fusion weights for each shooting angle based on the vertical projection angle of the current light onto the plane of the target character's facial model includes: A facial coordinate system is constructed for the target character's facial model, and based on the multiple shooting rotation axes, half of the target character's facial model's facial region is divided into multiple sub-regions; Based on the vertical projection angle of the current light on the plane of the target character's facial model, the arc angle of the current light on the facial coordinate system is determined, and the target sub-region to which the arc angle belongs is identified among the multiple sub-regions; Two first shooting rotation axes are determined among the plurality of shooting rotation axes, wherein the two boundaries of the target sub-region are located on the two first shooting rotation axes; Query the axial angle corresponding to each of the first shooting rotation axes to obtain two axial angles. Use the two axial angles and the radian angle to calculate the fusion weight corresponding to each of the first shooting rotation axes. Obtain a default weight value, determine multiple second shooting rotation axes among the multiple shooting rotation axes, and set a corresponding fusion weight for each second shooting rotation axis using the default weight value. The multiple second shooting rotation axes are shooting rotation axes other than the two first shooting rotation axes among the multiple shooting rotation axes.

6. The method according to claim 1, characterized in that, The calculation of the linear angle between the front and back of the current illumination to obtain the illumination angle result used to indicate whether the target character's facial model is illuminated from the front or back includes: Based on the vertical projection angle of the current light onto the plane of the target character's facial model, the illuminated area of ​​the target character's facial model is determined, and the illuminated area is either the front or the back. A preset linear range is determined, and the illuminated area is mapped to the linear range to determine the linear value corresponding to the illuminated area in the linear range. The linear value is then used as the illumination angle result, wherein the linear range is from 0 to 1.

7. The method according to claim 1, characterized in that, The process of sampling the image channel results, setting corresponding fusion weights according to each shooting angle, fusing the sampling results along each shooting rotation axis, and controlling the grayscale image thresholding result of the fused result using the illumination angle results to obtain the final shadow information of the target character's facial model under the current illumination includes: The image channel results are mirrored to obtain complete channel information. The right half image index and the left half image index in the complete channel information are sampled in batches. The results of the two batches of sampling are integrated to obtain the sampling results of each shooting rotation axis. By setting corresponding fusion weights for each shooting angle, the sampling results of each shooting rotation axis are weighted and calculated to obtain the fusion result; Based on the illumination angle result, the grayscale image threshold result in the fusion result is dynamically transformed so that the shadow effect rotates with the illumination angle result to obtain the final shadow information. After obtaining the final shadow information, the illumination source direction of the current illumination is identified, and it is determined whether to perform horizontal flip processing on the final shadow information according to the illumination source direction so that the final shadow information matches the illumination source direction.

8. A device for processing facial shadows, characterized in that, include: The shooting module is used to determine the target character's facial model to be shadowed, and to take a preset number of mask images of the target character's facial model in segments along multiple preset shooting rotation axes. The multiple shooting rotation axes cover multiple discrete directions from the side to the top and bottom of the target character's facial model. The generation module is used to generate grayscale transition information corresponding to each shooting rotation axis by using the mask images with a preset number of segments obtained by shooting along each shooting rotation axis, and to assemble the grayscale transition information corresponding to each shooting rotation axis to obtain the image channel result. The calculation module is used to set corresponding fusion weights for each shooting angle based on the vertical projection angle of the current light on the plane of the target character's facial model, and to calculate the front and back linear angles of the current light to obtain the lighting angle result. The lighting angle result indicates the degree of offset of the position of the projection of the current light on the target character's facial model relative to the front of the target character's face. The fusion module is used to sample the image channel results, fuse the sampling results of each shooting rotation axis according to the fusion weight corresponding to each shooting angle, and control the grayscale image threshold result of the fusion result using the illumination angle result, so as to obtain the final shadow information of the target character's facial model under the current illumination.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.