Model shadow generation method and device, electronic equipment and computer program product

By integrating multi-mask image synthesis and SDF generation in 3D painting software, the problem of inefficiency in the model shadow generation process is solved, efficient and real-time shadow effect preview and precise shadow transition are achieved, and cross-team communication costs are reduced.

CN120765828APending Publication Date: 2025-10-10NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510898864.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

The existing technology has problems in the model shadow generation process, such as lack of real-time preview, cumbersome operation process, long parameter adjustment cycle, dependence on external synthesis tools and high cross-team communication costs, resulting in low efficiency of model shadow production.

Method used

Integrate the multi-mask synthesis and SDF generation processes into a single 3D painting software platform. Use the signed distance field generator to automatically synthesize and preview shadow effects in real time within the same interface, enabling fine-tuning of shadow boundaries and mask shapes, reducing cross-team communication costs.

Benefits of technology

It significantly improves the iteration efficiency and control accuracy of model shadow production, shortens the overall cycle, reduces cross-team communication and debugging costs, and realizes a "what you see is what you get" shadow effect preview.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120765828A_ABST
    Figure CN120765828A_ABST
Patent Text Reader

Abstract

The invention relates to a model shadow generation method and device, electronic equipment and a computer program product, and belongs to the technical field of computers. The method comprises the steps that a plurality of input image layers and an output image layer are created in three-dimensional drawing software, each input image layer is used for drawing a mask image of a target model, and each mask image corresponds to an illumination angle; creating a directed distance field generator in the three-dimensional drawing software, and adding the directed distance field generator to the output layer; acquiring a mask image in the input layer through a directed distance field generator, and synthesizing a directed distance field image in the output layer according to the acquired mask image; and obtaining a shadow effect picture of the target model according to the directed distance field image, and previewing and displaying the shadow effect picture through a shader in three-dimensional drawing software. According to the invention, the generation process of the model shadow can be integrated to a single software platform, and the model shadow making efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method for generating a model shadow, a device for generating a model shadow, an electronic device, and a computer program product. Background Art

[0002] In game production, the generation of model shadows is a key step in improving visual effects. It is necessary to provide a variety of different model shadows for character models based on different game scenes and lighting angles.

[0003] To ensure accurate shadow effects at all angles, multiple mask images are typically used. However, the shadow generation process requires synthesizing the SDF (Signed Distance Field) in an external tool in multiple steps, and then testing it in the engine. This process is cumbersome and difficult to verify in real time.

[0004] In view of this, there is an urgent need in this field for a method for generating model shadows, which can integrate the model shadow generation process into a single software platform to improve the efficiency of model shadow production.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention

[0006] The purpose of the present disclosure is to provide a method for generating a model shadow, a device for generating a model shadow, an electronic device and a computer program product, thereby improving the efficiency of model shadow production at least to a certain extent.

[0007] According to a first aspect of the present disclosure, a method for generating a model shadow is provided, comprising:

[0008] Creating multiple input layers and one output layer in a 3D painting software, wherein each input layer is used to draw a mask image of the target model, and each mask image corresponds to a lighting angle;

[0009] Creating a signed distance field generator in the three-dimensional painting software, and adding the signed distance field generator to the output layer;

[0010] Acquire the mask image in the input layer through the signed distance field generator, and synthesize the signed distance field image in the output layer according to the acquired mask image;

[0011] The image display module is configured to obtain a shadow effect diagram of the target model according to the directional distance field image, and preview and display the shadow effect diagram in the three-dimensional drawing software through a shader.

[0012] According to a second aspect of the present disclosure, a model shadow generation apparatus is provided, comprising:

[0013] A layer creation module is configured to create a plurality of input layers and an output layer in a three-dimensional drawing software, wherein each of the input layers is used to draw a mask image of a target model, and each of the mask images corresponds to a light angle.

[0014] A generator creation module is configured to create a directional distance field generator in the three-dimensional drawing software, and add the directional distance field generator to the output layer.

[0015] An image synthesis module is configured to obtain the mask images in the input layers through the directional distance field generator, and synthesize a directional distance field image in the output layer according to the obtained mask images.

[0016] An image display module is configured to obtain a shadow effect diagram of the target model according to the directional distance field image, and preview and display the shadow effect diagram in the three-dimensional drawing software through a shader.

[0017] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the above-mentioned model shadow generation method via execution of the executable instructions.

[0018] According to a fourth aspect of the present disclosure, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the above-mentioned model shadow generation method.

[0019] The exemplary embodiments of the present disclosure can have the following beneficial effects:

[0020] In the model shadow generation method of the example embodiment of the present disclosure, by integrating the process of automatically synthesizing multiple mask maps and previewing SDF in real time into a single 3D painting software platform, on the one hand, it enables artists to quickly and efficiently perform visual debugging and iteration on character facial shadows, achieving a "what you see is what you get" facial shadow effect, thereby significantly improving iteration efficiency and control precision. There is no need to repeatedly switch between external tools and art software. Once a problem is discovered, the shadow boundary or mask shape can be fine-tuned at any time, and the correction can be directly made in the same interface and the new results can be immediately seen, greatly improving iteration efficiency. On the other hand, each mask map is managed under the same project, and accurate and smooth distance field synthesis is achieved through a directed distance field generator, which can improve the quality of shadow transitions. On the other hand, by consolidating the art and technical implementation stages into the same environment, cross-team communication and debugging costs are reduced. The unified platform also facilitates collaborative management and style control among different artists, shortening the overall cycle of character shadow production.

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

[0022] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.

[0023] Figure 1 A schematic flow chart showing a method for generating a model shadow according to an exemplary embodiment of the present disclosure is shown;

[0024] Figure 2 A schematic diagram of a process for synthesizing a signed distance field image according to an exemplary embodiment of the present disclosure is shown;

[0025] Figure 3 A schematic diagram of generating a gradient image from a first mask image to a second mask image according to a specific embodiment of the present disclosure is shown;

[0026] Figure 4 A schematic diagram showing a process of obtaining a shadow effect image of a target model according to a signed distance field image in an exemplary embodiment of the present disclosure is shown;

[0027] Figure 5 A schematic diagram showing a lighting result diagram and a shadow effect diagram according to a specific embodiment of the present disclosure is shown;

[0028] Figure 6A block diagram of a device for generating model shadows of example embodiments of the present disclosure is shown;

[0029] Figure 7 A structural schematic of a computer system of an electronic device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0030] Example embodiments now will be described more fully hereinafter with reference to the accompanying drawings. Example embodiments, however, can be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the aspects of the disclosure can be practiced without one or more of the specific details, or with other methods, components, materials, and so forth. In other instances, well-known structures have not been described in detail to avoid obscuring aspects of the disclosure.

[0031] Furthermore, the accompanying drawings are only intended to illustrate the present disclosure schematically, and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus repetitive descriptions thereof will be omitted. Some block diagrams shown in the drawings are functional entities, and do not necessarily have to correspond to physically or logically independent entities. The functional entities can be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0032] In some related embodiments, the steps for making a two-dimensional character face shadow are as follows:

[0033] 1. Use art tools (such as Photoshop, Substance Painter, etc.) to draw shadow masks (usually about 7 to 9) for the character model from multiple perspectives, each corresponding to a different light angle;

[0034] 2. Export these masks to a separate software or script tool, and combine all the masks into an SDF map through an algorithm;

[0035] 3. Reimport the generated SDF map into the game engine or rendering environment, and write or configure a special SDF shader on the engine side or rendering side for real-time calculation and rendering of the shadow area on the character face.

[0036] 4. If the artist sees problems in the actual effect, he needs to go back to the mask drawing stage, make modifications, and then repeat the above process (export, synthesis, import, test) for verification.

[0037] However, the methods in the above-mentioned related embodiments may have the following problems in actual operation:

[0038] 1. Real-time preview is missing:

[0039] Since SDF needs to be synthesized using independent tools, artists cannot directly see the terminal rendering results when drawing. Each debugging must be exported and imported, which greatly reduces work efficiency.

[0040] 2. The operation process is complicated:

[0041] Artists must complete a multi-step cycle of "drawing the mask map - exporting - merging - importing - testing." If problems like edge smoothing or mask overlap arise, subtle adjustments to the shadows are necessary, often requiring repeated corrections and re-synthesis, resulting in a significant amount of repetitive work.

[0042] 3. The parameter adjustment cycle is long and it is difficult to iterate quickly:

[0043] The above method doesn't allow for quick viewing of shadow effects under different lighting angles using a single platform. Each fine-tuning requires repeating the synthesis and testing process, as well as iterating the export and import steps, which lengthens the project iteration cycle.

[0044] 4. Dependence on external synthesis tools:

[0045] SDF generation relies on external tools to merge multiple mask maps and calculate distance fields, requiring repeated switching between different tools. This lacks a unified standard and visual interface. Tool incompatibility or data export issues further complicate debugging, making it impossible to achieve a "what you see is what you get" (WYSIWYG) view of the final engine results within a single software package.

[0046] 5. High personnel communication costs:

[0047] Shadow production and technical implementation are often completed by different teams. The lack of a unified platform leads to information asymmetry, increased communication costs and access barriers, and easily affects the final artistic quality.

[0048] Based on the above problems, this example embodiment first provides a method for generating a model shadow. Figure 1 As shown, the above-mentioned method for generating the model shadow may include the following steps:

[0049] Step S110: Create multiple input layers and one output layer in the three-dimensional painting software, wherein each input layer is used to draw a mask image of the target model, and each mask image corresponds to a lighting angle.

[0050] Step S120: Create a signed distance field generator in the 3D painting software, and add the signed distance field generator to the output layer.

[0051] Step S130: Obtain the mask image in the input layer through the signed distance field generator, and synthesize the signed distance field image in the output layer according to the obtained mask image.

[0052] Step S140: Obtain a shadow effect image of the target model according to the signed distance field image, and preview and display the shadow effect image through a shader in a three-dimensional painting software.

[0053] In the model shadow generation method of the example embodiment of the present disclosure, by integrating the process of automatically synthesizing multiple mask maps and previewing SDF in real time into a single 3D painting software platform, on the one hand, it enables artists to quickly and efficiently perform visual debugging and iteration on character facial shadows, achieving a "what you see is what you get" facial shadow effect, thereby significantly improving iteration efficiency and control precision. There is no need to repeatedly switch between external tools and art software. Once a problem is discovered, the shadow boundary or mask shape can be fine-tuned at any time, and the correction can be directly made in the same interface and the new results can be immediately seen, greatly improving iteration efficiency. On the other hand, each mask map is managed under the same project, and accurate and smooth distance field synthesis is achieved through a directed distance field generator, which can improve the quality of shadow transitions. On the other hand, by consolidating the art and technical implementation stages into the same environment, cross-team communication and debugging costs are reduced. The unified platform also facilitates collaborative management and style control among different artists, shortening the overall cycle of character shadow production.

[0054] Next, combine Figures 2 to 5 The above steps of this exemplary embodiment are described in more detail.

[0055] In step S110 , a plurality of input layers and an output layer are created in the three-dimensional painting software, wherein each input layer is used to draw a mask image of the target model, and each mask image corresponds to a lighting angle.

[0056] In this example implementation, the three-dimensional painting software refers to software used for 3D texture painting and material production, such as SP (Substance Painter) software, which is used to help artists efficiently create realistic maps and materials for 3D models.

[0057] Input layers are independent canvas layers used to draw mask data for different lighting angles. Each layer corresponds to shadow outline information under a specific light source direction. Output layers are composite layers that integrate signed distance field generators and are used to aggregate input data from multiple layers.

[0058] To do this, create a layer folder called Mask and create multiple layers within it. For example, create nine layers numbered 0-8 to serve as canvases for drawing the light mask at various angles. Additionally, create a layer called Output as the final output layer.

[0059] In this example implementation, each input layer corresponds to a layer number. When drawing the mask image of each input layer, the mask image of the previous layer number is added to the current input layer, so that the mask image of the current input layer is drawn based on the mask image of the previous layer number.

[0060] The layer number refers to a serial identifier used to identify the order in which the input layers are drawn. This can be achieved by increasing the number, for example, marking the first input layer as layer 0, and increasing the number of subsequent layers in sequence. This number provides a sequential basis for the overlay drawing of the mask image. The mask image of the previous layer number refers to the drawing content contained in the previous layer immediately preceding the current layer in the layer number sorting order. This can be achieved through the image overlay mode, for example, the pixel data of the previous layer is imported into the current layer in a transparent overlay manner, so that the current layer can directly call the completed drawing results as a basis, that is, except for layer 0, each layer will be filled with the content of the previous layer, so as to ensure that each layer is drawn on the basis of the previous layer, avoiding manual copying or repeated drawing of the same structure.

[0061] In step S120 , a signed distance field generator is created in the 3D painting software, and the signed distance field generator is added to the output layer.

[0062] In this example implementation, a new channel named SDF is created to store and calculate the final SDF information. SDF is widely used in games and graphics for font rendering, region detection, and other applications. It represents the distance to the shape's boundaries, creating smooth transitions and facilitating shader shading or contouring.

[0063] In this example implementation, an SDF generator can be created based on 3D painting software such as Substance Designer and exported as a generator callable in Substance Painter, providing parameters for "Number of Input Masks" and "Input Ports for Each Mask Map." A signed distance field generator is an algorithm module that performs distance field calculations, generating vectorized distance field data by reading pixel information from each input layer.

[0064] In step S130 , a mask image in the input layer is acquired by a signed distance field generator, and a signed distance field image is synthesized in the output layer according to the acquired mask image.

[0065] In this example implementation, each input layer is bound to an anchor point. When the signed distance field generator obtains the mask image from the input layer, it can map the anchor point of each input layer to the signed distance field generator's input channel. This allows the generator to obtain the mask image from the input layer. An input channel is a logical interface within the signed distance field generator for receiving external data and establishing a data transmission path between the layer and the generator.

[0066] Specifically, in 3D painting software, each input layer is assigned a separate anchor point. When the Signed Distance Field Generator needs to obtain a mask image, the anchor points of each input layer are automatically mapped to the corresponding input channel of the generator. This allows the generator to automatically access the content of each layer based on the channel number and calculate the SDF result in real time into the SDF channel of the output layer. By reserving multiple layer input ports, the Signed Distance Field Generator can accommodate the synthesis of multiple mask images.

[0067] In this example implementation, the imported SDF generator is applied to the output layer, and the masks drawn on each layer are read through anchor binding. Utilizing Substance Painter's multi-layer anchor mechanism, multiple masks are dynamically input into the SDF generator for real-time synthesis, so that the mask image data can be automatically aligned and synthesized in the generator, significantly improving the real-time and accuracy of shadow generation.

[0068] In this example implementation, Figure 2 As shown, synthesizing a signed distance field image in the output layer based on the obtained mask image can specifically include the following steps:

[0069] Step S210. For every two first mask images in the first input layer and the second mask image in the second input layer with adjacent layer numbers, obtain a difference mask image according to the difference between the second mask image and the first mask image.

[0070] The difference mask image refers to a difference region between adjacent layers obtained by a pixel-level subtraction operation, and is used to capture the change characteristics of the shadow form under different light angles.

[0071] For example, input black and white images A, B and C, where A is the first mask image, B is the second mask image, and B-A can obtain the part that B has more than A, that is, the difference mask image between A and B.

[0072] Step S220. The first mask image is blurred along the direction of the difference mask image to obtain a gradient image from the first mask image to the second mask image.

[0073] The blurring process refers to a non-uniform diffusion convolution operation along the difference direction, which can be implemented by a directional Gaussian filter, and is used to form a gradient effect conforming to physical laws at the shadow edge. The gradient image refers to an intermediate transition state with spatial continuity, which can be generated by superimposing multiple blurring results, and is used to eliminate the hard boundary of adjacent mask layers. For example, blurring A along the direction of B-A can obtain the gradient image of A to B.

[0074] Figure 3 A schematic diagram of generating a gradient image from the first mask image to the second mask image in one specific embodiment of the present disclosure is shown, from left to right, A, B, A to B gradient image. Similarly, B and C, C and D, and other mask images can be calculated.

[0075] Step S230. Synthesize the directed distance field image in the output layer according to the gradient image corresponding to each two adjacent input layers numbered.

[0076] Suppose the MaskNumber of the number of pictures used in the generator, divide each gradient image by (MaskNumber-1), and add to synthesize a picture, which is the SDF image. For example, if the number of input images is 9, divide each gradient image by 8 and then add to synthesize the corresponding directed distance field image.

[0077] In the example embodiment, the gradient image is first generated by calculating the difference between each two images, and then the accumulation and normalization processing is performed, and finally a synthesized SDF representing the distance change between the masks is output, which ensures that the transition area of adjacent mask images maintains vector continuity, and realizes the visualization interaction of the synthesis process.

[0078] In the example embodiment, the number of mask images in the input layer obtained by the directed distance field generator can also be determined according to the target layer number input in the directed distance field generator.

[0079] Based on the input target layer number (MaskNumber parameter), only layers numbered 0 to MaskNumber are calculated at a time, thereby controlling the number of mask images involved in the synthesis. This mechanism enables the system to dynamically adjust the number of layers involved in the calculation based on actual needs when processing mask images with different lighting angles. For example, when only shadows within a specific angle range need to be processed, interference from irrelevant layers can be eliminated by narrowing the target layer number range, preserving the continuity of the layer sequence while avoiding redundant calculations.

[0080] In step S140 , a shadow effect image of the target model is obtained according to the signed distance field image, and the shadow effect image is previewed and displayed in the three-dimensional painting software through a shader.

[0081] After obtaining the synthesized signed distance field image, color blending and shading can be performed according to the SDF texture to generate the final output color.

[0082] In this example implementation, Figure 4 As shown, obtaining the shadow effect image of the target model according to the signed distance field image can specifically include the following steps:

[0083] Step S410: According to the coordinates of each pixel point in the target model, the basic color of each pixel point is obtained by sampling from the model texture of the target model.

[0084] The base color baseColor refers to the original color of the target model surface in the unshadowed state. It can be sampled from the model texture map according to the coordinates of the pixel point to preserve the inherent color characteristics of the material.

[0085] Step S420: Obtain the shadow color of each pixel according to the basic color of each pixel.

[0086] The shadow color refers to the dark tone that the base color should present in the shadow area. You can multiply the base color by 0.5 to get the shadow color shadeColor, which makes the color darker and is used as the shadow part.

[0087] Step S430: According to the coordinates of each pixel point, sample the signed distance field image to obtain the signed distance field value of each pixel point.

[0088] A signed distance field value refers to the signed geometric distance between a pixel point and the nearest mask boundary. It is generally used to represent the distance between the surface or boundary of an object and the current pixel. The signed distance field value of each pixel point can be obtained by sampling the signed distance field image.

[0089] Step S440: Obtain preset illumination direction parameters and edge softness parameters, and perform smooth interpolation on the signed distance field value according to the illumination direction parameters and edge softness parameters to obtain a shadow smooth transition value of each pixel point.

[0090] Smooth interpolation refers to the nonlinear transition processing of the distance field value according to the illumination angle and edge softness parameter. Based on the illumination direction parameter shadepos and the edge softness parameter softness, the SDF value can be smoothly interpolated between shadepos and (shadepos+softness / 2) using the smoothstep function to form a soft transition and obtain the shadow smooth transition value SDFshadow, which can be used to represent shadow gradients, etc.

[0091] Step S450: Perform interpolation processing on the basic color and the shadow color based on the shadow smooth transition value to obtain the color transition value of each pixel.

[0092] The shadow color and the base color can be interpolated based on the shadow smooth transition value SDFshadow. When SDFshadow is closer to 0, it is closer to the shadow color shadeColor; when it is closer to 1, it is closer to the base color baseColor.

[0093] Step S460: Map the signed distance field value of each pixel point to a corresponding grayscale vector.

[0094] Grayscale vector refers to the single-channel grayscale data formed by normalizing the distance field value. The SDF value is converted into a grayscale vector for mixing with other colors.

[0095] Step S470: Obtain an illumination result map of the target model according to the color transition value of each pixel point, and obtain a shadow effect map of the target model according to the grayscale vector of each pixel point.

[0096] In this example embodiment, in the 3D painting software, a preview of the target model's illumination result or shadow effect can be displayed based on the input image display parameters. Specifically, if the image display parameter is a first parameter value, the target model's shadow effect is previewed; if the image display parameter is a second parameter value, the target model's illumination result is previewed.

[0097] Image display parameters are user-input variables used to control the preview display mode. For example, setting the first parameter value to 0 displays the shadow effect image, while setting the second parameter value to 1 displays the lighting result image. These parameters receive user input commands through graphical interface controls, triggering the shader to switch rendering modes.

[0098] Specifically, when users adjust shadow generation parameters in 3D painting software, the shader program selects the corresponding rendering process based on the current image display parameter value. If the parameter value is 0, the shader reads the signed distance field image data and performs a grayscale vector mapping algorithm to generate the shadow effect image. If the parameter value is 1, the shader uses the interpolation calculation result of the base color and the shadow color to output the lighting result image. Finally, the color and opacity are output. The opacity can be set to 1.0, which means completely opaque. Figure 5 A schematic diagram of an illumination result diagram and a shadow effect diagram according to a specific embodiment of the present disclosure is shown, wherein the two diagrams on the left are illumination result diagrams at different angles, and the one on the right is an SDF shadow effect diagram.

[0099] In this example implementation, the original colors are first taken and the shadow color is calculated. The shadow is then blended based on the SDF information and the smoothstep. Finally, the SDF grayscale image and the blended shadow color are interpolated to produce the final color output. This can be used to create patterns with soft transition edges or shadow effects.

[0100] In this example implementation, you can customize the SDF generation algorithm, supporting channels and shaders, use real-time updated SDF, and implement shadow transitions with functions such as smoothstep. You can preview and fine-tune the shadow transition effects in real time during drawing, adjust the brush strokes, shapes, or soft and hard boundaries, and provide a WYSIWYG final shadow preview.

[0101] In this example implementation, a base texture of the target model may be generated in 3D painting software, and the shadow effect image of the target model and the base texture may be exported together to the game engine.

[0102] Basemap refers to the image data containing the basic texture information of the model surface, which is used to render the basic appearance of the model in the game engine. Figure 1 Once exported to the game engine, it can be directly used without the need for separate synthesis in external software. By completing texture generation and joint export in the same software environment, a closed-loop operation of the art resource production process is achieved, reducing the cost of texture matching during the engine debugging phase.

[0103] It should be noted that although the steps of the method of the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all steps must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0104] Furthermore, the present disclosure also provides a device for generating a model shadow. Figure 6As shown, the model shadow generation device may include a layer creation module 610, a generator creation module 620, an image synthesis module 630, and an image display module 640.

[0105] The layer creation module 610 can be used to create multiple input layers and one output layer in the 3D painting software, wherein each input layer is used to draw a mask image of the target model, and each mask image corresponds to a lighting angle;

[0106] The generator creation module 620 may be used to create a signed distance field generator in the 3D painting software and add the signed distance field generator to an output layer;

[0107] The image synthesis module 630 may be configured to obtain a mask image in an input layer through a signed distance field generator, and synthesize a signed distance field image in an output layer based on the obtained mask image;

[0108] The image display module 640 can be used to obtain a shadow effect image of the target model according to the signed distance field image, and preview and display the shadow effect image through a shader in the three-dimensional painting software.

[0109] In some exemplary embodiments of the present disclosure, the image synthesis module 630 may include a mask image acquisition unit, which may be configured to map the anchor points of each input layer to the input channels of the signed distance field generator, so that the signed distance field generator acquires the mask image in the input layer.

[0110] In some exemplary embodiments of the present disclosure, a model shadow generation device provided by the present disclosure may also include a mask image drawing module, which can be used to add the mask image of the previous layer number to the current input layer when drawing the mask image of each input layer, so that the mask image of the current input layer is drawn based on the mask image of the previous layer number.

[0111] In some exemplary embodiments of the present disclosure, the image synthesis module 630 may further include a difference mask image determination unit, a gradient image determination unit, and a signed distance field image synthesis unit.

[0112] The difference mask image determining unit may be configured to obtain a difference mask image according to a difference between the second mask image and the first mask image for each two adjacent layer numbers of the first mask image in the first input layer and the second mask image in the second input layer;

[0113] The gradient image determination unit may be configured to perform blurring processing on the first mask image along the direction of the difference mask image to obtain a gradient image from the first mask image to the second mask image;

[0114] The signed distance field image synthesis unit may be configured to synthesize a signed distance field image in an output layer according to gradient images corresponding to every two input layers with adjacent layer numbers.

[0115] In some exemplary embodiments of the present disclosure, a model shadow generation device provided by the present disclosure may further include a mask quantity determination module, which may be configured to determine the number of mask images in an input layer obtained by the signed distance field generator based on a target layer number input into the signed distance field generator.

[0116] In some exemplary embodiments of the present disclosure, the image display module 640 may include a basic color sampling unit, a shadow color generating unit, a signed distance field value sampling unit, a smooth transition value determining unit, a color transition value determining unit, a grayscale vector determining unit, and a shadow effect map generating unit. Among them:

[0117] The basic color sampling unit can be used to obtain the basic color of each pixel point from the model texture of the target model according to the coordinates of each pixel point in the target model;

[0118] The shadow color generation unit can be used to obtain the shadow color of each pixel according to the basic color of each pixel;

[0119] The signed distance field value sampling unit may be used to obtain the signed distance field value of each pixel point by sampling from the signed distance field image according to the coordinates of each pixel point;

[0120] The smooth transition value determination unit can be used to obtain a preset illumination direction parameter and an edge softness parameter, and perform smooth interpolation on the signed distance field value according to the illumination direction parameter and the edge softness parameter to obtain a shadow smooth transition value for each pixel point;

[0121] The color transition value determination unit may be configured to perform interpolation processing on the base color and the shadow color based on the shadow smooth transition value to obtain a color transition value for each pixel point;

[0122] The grayscale vector determination unit may be configured to map the signed distance field value of each pixel point to a corresponding grayscale vector;

[0123] The shadow effect map generating unit can be used to obtain the illumination result map of the target model according to the color transition value of each pixel point, and obtain the shadow effect map of the target model according to the grayscale vector of each pixel point.

[0124] In some exemplary embodiments of the present disclosure, the image display module 640 may further include an image display switching unit, which may be used to preview the illumination result image or shadow effect image of the target model in 3D painting software according to input image display parameters.

[0125] In some exemplary embodiments of the present disclosure, the image display switching unit may include a shadow effect graph display unit and a lighting result graph display unit.

[0126] The shadow effect diagram display unit may be configured to preview and display the shadow effect diagram of the target model if the image display parameter is a first parameter value;

[0127] The illumination result graph display unit may be configured to preview and display the illumination result graph of the target model if the image display parameter is a second parameter value.

[0128] In some exemplary embodiments of the present disclosure, a model shadow generation device provided by the present disclosure may also include a base texture generation module, which can be used to generate a base texture of a target model in three-dimensional painting software, and export the shadow effect map and the base texture of the target model to a game engine.

[0129] The specific details of each module / unit in the above-mentioned model shadow generation device have been described in detail in the corresponding method embodiment part and will not be repeated here.

[0130] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0131] Figure 7 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present disclosure is shown.

[0132] It should be noted that Figure 7 The computer system 700 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0133] like Figure 7 As shown, computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage unit 708 into a random access memory (RAM) 703. Various programs and data required for system operation are also stored in RAM 703. CPU 701, ROM 702, and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to bus 704.

[0134] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, and the like; an output section 707 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 708 including a hard disk; and a communication section 709 including a network interface card such as a LAN card or a modem. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 710 as needed, so that computer programs read therefrom can be installed into the storage section 708 as needed.

[0135] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from a removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, various functions defined in the system of the present disclosure are executed.

[0136] The exemplary embodiments of the present disclosure further provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, implements the above-mentioned method for generating a model shadow.

[0137] In one embodiment, a computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing the computer program. The computer-readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk drive (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing the computer program, such as a read-only memory, NAND flash memory, and the like.

[0138] In one embodiment, the computer program product may be an intangible product containing a computer program. For example, the computer program product may be implemented as a virtual digital product, such as a digital file such as an executable file or installation package storing the computer program.

[0139] The code of the computer program can be written in one or more programming languages. Programming languages ​​include C, Java, C++, etc. The program code can be executed entirely on the user computing device, partially on the user computing device, or as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device via any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., via an Internet connection provided by a carrier).

[0140] Computer programs can be carried or transmitted via electrical, magnetic, optical, electromagnetic, infrared, or other signals. Electronic devices can convert signals carrying computer programs into digital signals, thereby running the computer programs. When the computer program is run on an electronic device, its code is used to cause the electronic device to execute (more specifically, the processor of the electronic device to execute) the method steps of various exemplary embodiments of the present disclosure, such as the above-mentioned method for generating model shadows.

[0141] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0142] It should be noted that although several modules of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules to be embodied.

[0143] Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features disclosed herein. It is intended that the disclosure be construed as including any paterns, uses, or adaptations of the features disclosed herein and including modifications apparent to those skilled in the art with the ordinary knowledge of the art to which the features disclosed herein pertain.

[0144] It is to be understood that the disclosure is not limited to the precise construction hereindescribed and illustrated and that various modifications and changes can be made by those skilled in the art without departing from the scope of the disclosure. The scope of the disclosure is limited only by the claims appended hereto.

Claims

1. A method for generating a model shadow, characterized in that: include: Creating multiple input layers and one output layer in a 3D painting software, wherein each input layer is used to draw a mask image of the target model, and each mask image corresponds to a lighting angle; Creating a signed distance field generator in the three-dimensional painting software, and adding the signed distance field generator to the output layer; Acquire the mask image in the input layer through the signed distance field generator, and synthesize the signed distance field image in the output layer according to the acquired mask image; A shadow effect image of the target model is obtained according to the signed distance field image, and the shadow effect image is previewed and displayed in the three-dimensional painting software through a shader.

2. The method for generating a model shadow according to claim 1, wherein: Each of the input layers is respectively bound to an anchor point, and obtaining the mask image in the input layer through the signed distance field generator includes: The anchor points of each input layer are mapped to the input channel of the signed distance field generator, so that the signed distance field generator obtains the mask image in the input layer.

3. The method for generating a model shadow according to claim 1, wherein: Each of the input layers corresponds to a layer number, and the method further includes: When drawing the mask image of each input layer, the mask image of the previous layer number is added to the current input layer, so that the mask image of the current input layer is drawn based on the mask image of the previous layer number.

4. The method for generating a model shadow according to claim 3, wherein: The synthesizing a signed distance field image in the output layer according to the acquired mask image includes: For every two first mask images in the first input layer and the second mask images in the second input layer with adjacent layer numbers, obtaining a difference mask image according to a difference between the second mask image and the first mask image; Blurring the first mask image along the direction of the difference mask image to obtain a gradient image from the first mask image to the second mask image; A signed distance field image is synthesized in the output layer according to the gradient images corresponding to every two input layers with adjacent layer numbers.

5. The method for generating a model shadow according to claim 3, wherein: The method further comprises: The number of mask images in the input layer acquired by the signed distance field generator is determined according to the target layer number input into the signed distance field generator.

6. The method for generating a model shadow according to claim 1, wherein: Obtaining a shadow effect image of the target model according to the signed distance field image includes: According to the coordinates of each pixel point in the target model, sampling from the model texture of the target model to obtain the basic color of each pixel point; Obtaining a shadow color of each pixel point according to a base color of each pixel point; Sampling the signed distance field image according to the coordinates of each pixel to obtain a signed distance field value of each pixel; Obtaining a preset illumination direction parameter and an edge softness parameter, and performing smooth interpolation on the signed distance field value according to the illumination direction parameter and the edge softness parameter to obtain a shadow smooth transition value of each pixel point; Performing interpolation processing on the basic color and the shadow color based on the shadow smooth transition value to obtain a color transition value of each pixel; Mapping the signed distance field value of each pixel point into a corresponding grayscale vector; An illumination result map of the target model is obtained according to the color transition value of each pixel point, and a shadow effect map of the target model is obtained according to the grayscale vector of each pixel point.

7. The method for generating a model shadow according to claim 6, wherein: The previewing and displaying of the shadow effect diagram by using a shader in the three-dimensional painting software includes: In the three-dimensional painting software, the illumination result image or the shadow effect image of the target model is previewed and displayed according to the input image display parameters.

8. The method for generating a model shadow according to claim 7, wherein: The previewing and displaying the illumination result image or the shadow effect image of the target model according to the input image display parameters includes: If the image display parameter is the first parameter value, a preview of the shadow effect image of the target model is displayed; If the image display parameter is the second parameter value, the illumination result image of the target model is previewed and displayed.

9. The method for generating a model shadow according to claim 1, wherein: The method further comprises: A base texture of the target model is generated in the three-dimensional painting software, and the shadow effect map of the target model and the base texture are exported to the game engine.

10. A device for generating a model shadow, characterized in that: include: A layer creation module is used to create multiple input layers and one output layer in the three-dimensional painting software, wherein each input layer is used to draw a mask image of the target model, and each mask image corresponds to a lighting angle; A generator creation module, configured to create a signed distance field generator in the three-dimensional painting software and add the signed distance field generator to the output layer; an image synthesis module, configured to obtain the mask image in the input layer through the signed distance field generator, and synthesize a signed distance field image in the output layer according to the obtained mask image; An image display module is used to obtain a shadow effect image of the target model according to the signed distance field image, and to preview and display the shadow effect image in the three-dimensional painting software through a shader.

11. An electronic device, characterized in that: include: processor; as well as A memory for storing one or more programs, which, when executed by the processor, enables the processor to implement the method for generating a model shadow according to any one of claims 1 to 9.

12. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for generating a model shadow according to any one of claims 1 to 9 is implemented.