Shadow rendering method and device and electronic equipment

By using the pixel layering control strategy in shadow rendering technology to adjust the pixel values ​​of the target map, fine control of the timing of shadow appearance is achieved, which solves the problem that shadow effects in the existing technology cannot meet the needs of high-quality rendering and reduces rendering performance consumption.

CN118608679APending Publication Date: 2024-09-06NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410687899.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing technology cannot precisely control the timing of shadow appearance in model rendering, resulting in shadow effects that cannot meet high-quality rendering requirements.

Method used

By obtaining the target map and adjusting its pixel value according to the preset pixel layering control strategy, multiple pixel intervals are divided, each interval corresponds to a different shadow control strategy, thereby achieving fine control of shadows on the model.

Benefits of technology

While maintaining the shadow effect, it achieves fine control of the timing of shadow appearance, reduces the performance consumption of shadow rendering, and meets the demand for high-quality rendering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608679A
    Figure CN118608679A
Patent Text Reader

Abstract

The invention provides a shadow rendering method and apparatus, and an electronic device. The method comprises the steps of obtaining a target map used for controlling a shadow presentation effect of a target model under illumination; according to a preset pixel hierarchical control strategy, adjusting the pixel value of the target map to obtain an adjusted target map; wherein the pixel hierarchical control strategy comprises a plurality of pixel intervals and shadow control strategies corresponding to the pixel intervals; the occurrence and / or removal opportunities of shadows corresponding to different shadow control strategies on the target model are different; and based on the adjusted target map, rendering the shadow of the target model to obtain a shadow rendering result corresponding to the target model. In the mode, different pixel intervals in the pixel hierarchical control strategy correspond to different shadow control strategies, so that the target map adjusted based on the pixel hierarchical control strategy can realize fine control of the shadow appearance opportunity while keeping the shadow effect of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of model rendering, and in particular to a shadow rendering method, device and electronic device. Background Art

[0002] In the field of computer graphics, stylized rendering has become an important research direction. Among them, the control of shadow maps is the key to achieving high-quality rendering effects. The control process of shadow maps provided in related technologies usually uses a single-channel marking method to determine the offset before and after the shadow appears, but this method cannot finely control the timing of the shadow. For example, when the character is facing the light source, it will be completely in the shadow after 90°. By marking the shadow map with a channel, the shadow change of a certain angle can be changed or offset, but this change is overall and cannot be finely controlled. Summary of the invention

[0003] The purpose of the present disclosure is to provide a shadow rendering method, device and electronic device to achieve fine control of the timing of shadow appearance while maintaining the shadow effect.

[0004] In a first aspect, the present disclosure provides a shadow rendering method, which includes: obtaining a target map; wherein the target map is used to control the shadow rendering effect of a target model under lighting; according to a preset pixel layering control strategy, adjusting the pixel value of the target map to obtain an adjusted target map; wherein the pixel layering control strategy includes: multiple pixel intervals, and shadow control strategies corresponding to each pixel interval; different shadow control strategies correspond to different times when shadows appear and / or are removed on the target model; based on the adjusted target map, rendering the shadow of the target model to obtain a shadow rendering result corresponding to the target model.

[0005] In a second aspect, the present disclosure provides a shadow rendering device, which includes: a texture acquisition module, used to acquire a target texture; wherein the target texture is used to control the shadow rendering effect of a target model under illumination; a texture partitioning module, used to adjust the pixel value of the target texture according to a preset pixel layering control strategy to obtain an adjusted target texture; wherein the pixel layering control strategy includes: multiple pixel intervals, and a shadow control strategy corresponding to each pixel interval; different shadow control strategies correspond to shadows that appear and / or are removed on the target model at different times; a shadow rendering module, used to render the shadow of the target model based on the adjusted target texture to obtain a shadow rendering result corresponding to the target model.

[0006] In a third aspect, the present disclosure provides an electronic device, which includes a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned shadow rendering method.

[0007] In a fourth aspect, the present disclosure provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned shadow rendering method.

[0008] The embodiments of the present disclosure bring the following beneficial effects:

[0009] The present disclosure provides a shadow rendering method, device and electronic device, firstly obtaining a target map, which is used to control the shadow rendering effect of a target model under illumination; then adjusting the pixel value of the target map according to a preset pixel layering control strategy to obtain an adjusted target map; wherein the pixel layering control strategy includes: multiple pixel intervals, and shadow control strategies corresponding to each pixel interval; shadows corresponding to different shadow control strategies appear and / or are removed at different times on the target model; then rendering the shadow of the target model based on the adjusted target map to obtain the shadow rendering result corresponding to the target model. In this method, since different pixel intervals in the pixel layering control strategy correspond to different shadow control strategies, the target map adjusted based on the pixel layering control strategy can achieve fine control of the timing of shadow appearance while maintaining the shadow effect of the model. At the same time, this method only needs to sample one map when rendering shadows, which reduces the performance consumption of shadow rendering.

[0010] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.

[0011] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, the following specifically cites preferred implementation modes and describes them in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0013] Figure 1A flowchart of a shadow rendering method provided by an embodiment of the present disclosure;

[0014] Figure 2 A schematic diagram of a target model and a texture unfolding diagram of the target model provided by an embodiment of the present disclosure;

[0015] Figure 3 A schematic diagram of a target map provided by an embodiment of the present disclosure;

[0016] Figure 4 A schematic diagram of an adjusted target map provided by an embodiment of the present disclosure;

[0017] Figure 5 A schematic diagram of the structure of a shadow rendering device provided in an embodiment of the present disclosure;

[0018] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. The components of the embodiments of the present disclosure described and shown in the drawings here can be arranged and designed in various different configurations.

[0020] Therefore, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the present disclosure claimed for protection, but merely represents selected embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present disclosure.

[0021] In the field of computer graphics, stylized rendering has become an important research direction. Among them, the control of shadow maps is the key to achieving high-quality rendering effects. The control process of shadow maps provided in related technologies usually uses a single-channel marking method to determine the offset of the timing of the shadow's appearance, but this method cannot precisely control the timing of the shadow's appearance. For example, if you want the nose tip area on the face to be brighter earlier and darker later, then due to the distinction between the images, you can only adjust the overall value, and all positions on the face will be "brighter earlier and darker later."

[0022] Based on the above problems, the embodiments of the present invention provide a shadow rendering method, device and electronic device. The technology can be applied to model rendering and shadow adjustment scenes.

[0023] In order to facilitate understanding of the embodiment of the present invention, a shadow rendering method disclosed in the embodiment of the present invention is first described in detail. Figure 1 As shown, the method comprises the following specific steps:

[0024] Step S102, obtaining a target map, where the target map is used to control the shadow rendering effect of the target model under illumination.

[0025] The target map can be made by the user in the drawing software, or it can be automatically generated according to preset rules. For example, the target map can be obtained by pulling the gradient of different curves in the drawing software, or it can be implemented based on the instance chain. Specifically, the target map can be a grayscale map, or an SDF (Signed Distance Field) map, or other maps, which can be determined according to R&D needs.

[0026] In a specific implementation, the target model can be any three-dimensional model, for example, the target model can be a clothing model, a face model or a building model, etc. The target map is made according to the target model, and the target map is mainly used to control the shadow rendering effect of each area in the target model under illumination, for example, for different areas in the target model, some areas may perform shadow offset in advance by a corresponding angle, and some areas may perform shadow offset in delay by a corresponding angle, etc.

[0027] Step S104, according to a preset pixel layering control strategy, adjust the pixel values ​​of the target map to obtain an adjusted target map; wherein the pixel layering control strategy includes: multiple pixel intervals, and shadow control strategies corresponding to each pixel interval; different shadow control strategies correspond to different times when shadows appear and / or are removed on the target model.

[0028] In specific implementation, the above pixel layering control strategy divides the pixel range of 0-255 into multiple pixel intervals, each pixel interval is configured with its own shadow control strategy, and the shadow control strategy corresponding to each pixel interval is different, that is, the timing of controlling the appearance of shadows or moving target models in the shadow control strategy corresponding to each pixel interval is different. In specific implementation, the shadow control strategy corresponding to each pixel interval can be determined according to research and development requirements or the rules of the texture itself. For example, the pixel range of 0-255 can be divided into three pixel intervals. The first pixel interval is 0-100, and the shadow control strategy corresponding to this pixel interval is configured as a standard linear gradient shadow; the second pixel interval is 100-150, and the shadow control strategy corresponding to this pixel interval is configured to advance the corresponding angle and perform shadow offset; the second pixel interval is 150-255, and the shadow control strategy corresponding to this pixel interval is configured to delay the corresponding angle and perform shadow offset. In this way, more refined shadow timing control can be achieved.

[0029] In a specific embodiment, 50 can be used as an interval, and the total brightness level from 0 to 255 can be divided into 5 pixel intervals, so that one target map can be used to solve the complex requirements of 6 shadow maps. The cost is the loss of accuracy, but this loss of accuracy is within an acceptable range. Different shadow effects can be obtained by sampling only one target map, thereby reducing the resource consumption of sampling multiple maps. Specifically, 0-255 can be divided into 5 pixel intervals. The first pixel interval is 0-50, and the shadow control strategy corresponding to this pixel interval is a standard linear gradient shadow; the second pixel interval is 50-100, and the shadow control strategy corresponding to this pixel interval is a more shadow-biased scheme, that is, it will be a constant shadow within the non-vertical lighting range; the third pixel interval is 100-150, and the shadow control strategy corresponding to this pixel interval is a constant convex surface scheme, that is, it can be observed that it directly brightens at the moment of entering the tangent. Taking a suit as an example, this scheme is suitable for the raised area of ​​trouser folds; the fourth pixel interval is 150-200, and the shadow control strategy corresponding to this pixel interval is a darker scheme, which can be described as: "It is easier to generate shadows, and it is more difficult to walk out of shadows"; the fifth pixel interval is 200-255, and the shadow control strategy corresponding to this pixel interval is a brighter scheme, that is, it can be described as: "It is less likely to generate shadows, and it is easier to walk out of shadows".

[0030] In practical applications, according to the shadow presentation characteristics corresponding to each model area in the target model, the pixel interval corresponding to each model area can be determined from the pixel layering control strategy, and the pixel values ​​corresponding to the map areas corresponding to each model area in the target model in the target map are adjusted to pixel values ​​that match the pixel values ​​in the pixel interval corresponding to each model area, thereby obtaining an adjusted target map. Based on this method, the adjusted target map can contain multiple pixel intervals, so that it is convenient to perform shadow control on the map area corresponding to each pixel interval based on the shadow control strategy corresponding to each pixel interval.

[0031] Step S106, rendering the shadow of the target model based on the adjusted target map to obtain a shadow rendering result corresponding to the target model.

[0032] In a specific implementation, the pixel value of each pixel point in the sampled and adjusted target map in the game engine can be used to render different shadow effects of the target model for different pixel values, thereby obtaining the shadow rendering result corresponding to the target model.

[0033] A shadow rendering method provided by an embodiment of the present invention can achieve fine control of the timing of shadow appearance while maintaining the shadow effect of the model, because different pixel intervals in the pixel layering control strategy correspond to different shadow control strategies. At the same time, this method only needs to sample one map when rendering the shadow, reducing the performance consumption of shadow rendering.

[0034] The following embodiments are used to describe a method of determining a target model and a method of adjusting a target map.

[0035] Specifically, the target map is determined by the following steps 10-11:

[0036] Step 10, obtaining a target model, and performing texture expansion processing on the target model to obtain a two-dimensional texture map corresponding to the target model.

[0037] In specific implementation, the above-mentioned target model can be obtained from three-dimensional drawing software, or it can be obtained from a preset model file, or it can be made by the user in the game engine. The specific shape corresponding to the target model can be determined according to R&D requirements or user operations. For example, the target model can be a face model or a building model. After obtaining the target model, it is necessary to perform UV unfolding on the target model to obtain a two-dimensional texture map corresponding to the target model. Specifically, UV unfolding is also texture unfolding. The UV unfolding is a process of converting a 3D model into a flat version that can be used in two-dimensional space. This process involves providing a second set of coordinates for each vertex and face of the model, which is usually referred to as UV coordinates. UV coordinates are used to map the two-dimensional texture back to three-dimensional space, thereby applying the texture map to the three-dimensional model. UV unfolding can be done through various tools, which can help convert the details of the model surface into a two-dimensional picture, that is, a UV map (equivalent to the above-mentioned two-dimensional texture map). For example, UV unfolding a cube can obtain 6 unfolded faces.

[0038] like Figure 2 FIG. 1 is a schematic diagram of a target model and a texture unfolding diagram of the target model provided by an embodiment of the present invention. Figure 2 The semi-cylinder in the left image is the target model, and the right image represents the two-dimensional texture map of the target model. The two-dimensional texture map includes two semi-circular surfaces corresponding to the upper and lower bases of the semi-cylinder, a curved surface and a rectangular surface. Figure 2 The surface in is a larger rectangle, which contains five strip areas. The shadow presentation characteristics corresponding to different strip areas may be different or the same, which can be determined according to user operations.

[0039] Step 11, based on the two-dimensional texture map, generate a target map whose size matches the size of the two-dimensional texture map corresponding to the target model; wherein the pixel value corresponding to each pixel point in the target map is used to indicate the distance between the pixel point and the target model.

[0040] In specific implementation, the corresponding target map can be generated according to the size and shape of the two-dimensional texture map. The size and shape of the target map are the same as those of the two-dimensional texture expansion map. At the same time, the pixel value corresponding to each pixel in the target map is used to indicate the straight-line distance between the pixel and the target model. It can also be understood that the target map is an SDF map, which stores distance information. There is a distance at the position of each pixel, which is the distance between the current pixel and the graphic to be expressed.

[0041] like Figure 3 FIG. 1 is a schematic diagram of a target map provided by an embodiment of the present invention. Figure 3 The target map in is Figure 2The shadow map corresponding to the unfolding result of the semi-cylinder surface in , the shadow map contains 5 strip areas, and the shapes and sizes of the 5 strip areas are the same as the unfolding result corresponding to the surface. Figure 3 The color of each bar area in the target map is a gradient color from left to right, and the gradient color is from black to white. According to the color of the target map, a shadow effect that gradually becomes brighter or darker from left to right can be rendered. However, the entire shadow effect is a whole. When the user wants to adjust the shadow effect of a certain area (for example, a bar area enters the shadow earlier but leaves the shadow later), this effect cannot be achieved through one SDF map. If two SDF maps are used, it is necessary to increase the map of the marked interval and increase the number of map sampling, thereby increasing resource consumption.

[0042] Based on the above description, the embodiment of the present invention performs pixel layering processing on a map, so as to use a map to solve the complex needs of multiple maps. Specifically, it is necessary to adjust the pixel value of the target map according to the shadow rendering characteristics corresponding to the target model and the preset pixel layering control strategy to obtain the adjusted target map, so as to perform shadow rendering through the adjusted target map.

[0043] In the specific implementation, the above target map is adjusted through the following steps 20-22:

[0044] Step 20, determining the shadow rendering characteristics corresponding to each model area in the target model; wherein the shadow rendering characteristics are used to indicate the shadow rendering effect of the target model under illumination.

[0045] In specific implementation, the shadow rendering characteristics corresponding to each model area in the target model can be determined according to R&D requirements or user operations, and the shadow rendering characteristics corresponding to different model areas may be the same or different. Specifically, the shadow rendering characteristics corresponding to different model areas in the target model may be different, and the shadow rendering characteristics include but are not limited to: standard linear gradient shadows, constant shadows within the non-vertical lighting range, instant brightening when entering the light tangent (which can also be understood as instantly walking out of the shadow), easier to produce shadows and more difficult to walk out of the shadows, or less likely to produce shadows and easier to walk out of the shadows, etc. For example, the shadow rendering characteristics of the nose tip area in the face model are that it is less likely to produce shadows and easier to walk out of the shadows; for some wrinkle areas in the suit model, it is easier to produce shadows and more difficult to walk out of the shadows.

[0046] Step 21, for each model area, determine the target shadow control strategy that matches the shadow presentation characteristics corresponding to the current model area from the pixel layering control strategy, and intercept the map area corresponding to the current model area from the target map, and adjust the pixel value of the map area corresponding to the current model area based on the pixel interval corresponding to the target shadow control strategy to obtain the adjusted map area corresponding to the current model area.

[0047] In the specific implementation, the shadow rendering characteristics corresponding to each model area have a matching shadow control strategy in the pixel layering control strategy, so that the pixel value of the map area of ​​the model area corresponding to the corresponding shadow rendering characteristics in the target map can be adjusted according to the pixel interval corresponding to the matching shadow control strategy, so that the adjusted pixel value falls within the corresponding pixel interval, so that the shadow rendering effect of the corresponding model area can be controlled based on the shadow control strategy corresponding to the pixel interval.

[0048] In a specific embodiment, the specific process of the above step 21 may include: scaling the pixel value of the mapping area corresponding to the current model area to the pixel interval corresponding to the target shadow control strategy, and obtaining the adjusted mapping area corresponding to the current model area. For example, the pixel value of the mapping area corresponding to the current model area is in the range of 50-200, and the pixel interval corresponding to the target shadow control strategy is 0-50, so 50-200 can be scaled to the range of 0-50, that is, 50 is reduced to 0, and 200 is reduced to 50. Correspondingly, the pixel value of the mapping area corresponding to the current model area is reduced to the range of 0-50. If the pixel value of the mapping area corresponding to the current model area is in the range of 100-200, and the pixel interval corresponding to the target shadow control strategy is 0-50, 100-200 can be scaled to the range of 0-50.

[0049] Step 22, integrating the adjusted map regions corresponding to the various model regions to obtain an adjusted target map.

[0050] Since the pixel values ​​of the map areas corresponding to the model areas are adjusted separately, the adjusted map areas corresponding to the model areas need to be integrated to obtain an adjusted target map, so as to sample the adjusted target map and render the shadow of the target model.

[0051] like Figure 4 FIG. 1 is a schematic diagram of an adjusted target map provided by an embodiment of the present invention. Figure 4 yes Figure 3The target map in the image is the target map after pixel adjustment. The adjusted target map corresponds to 5 pixel intervals from the first strip area to the last strip area. The five pixel intervals are 0-50, 50-100, 100-150, 150-200 and 200-250, that is, Figure 3 The pixel value of the first strip area in is adjusted to the pixel range of 0-50, the pixel value of the second strip area is adjusted to the pixel range of 50-100, and so on, until the pixel value of the last strip area is adjusted to the pixel range of 200-250, and the result is Figure 4 The adjusted target map is shown. Specifically, the shadow control strategy corresponding to the pixel interval of 0-50 is the standard linear gradient shadow; the shadow control strategy corresponding to the pixel interval of 50-100 is a more shadow-biased solution; the shadow control strategy corresponding to the pixel interval of 100-150 is a constant convex solution; the shadow control strategy corresponding to the pixel interval of 150-200 is a darker solution; the shadow control strategy corresponding to the pixel interval of 200-255 is a brighter solution. The above combination can meet the existing art needs. The pixel layering control strategy makes the changes in the target map more diverse and realizes the art effect more freely.

[0052] The above method can not only achieve fine control of shadows, but also greatly improve rendering effects and meet artistic requirements. Through layered processing of shadow control, the timing of shadow appearance can be better controlled to make it more in line with actual conditions. At the same time, this method can also provide more control flexibility, allowing users to adjust the shadow control strategy according to specific needs to achieve better rendering effects.

[0053] The following embodiments are used to describe the shadow rendering method.

[0054] Specifically, the specific process of rendering the shadow of the target model based on the adjusted target map to obtain the shadow rendering result corresponding to the target model can be achieved through the following steps 30-32:

[0055] Step 30: sampling the adjusted target map to obtain a pixel value corresponding to each pixel point in the adjusted target map.

[0056] In a specific implementation, the adjusted target map can be input into a sampling node to obtain a pixel value of each pixel point corresponding to a channel from the adjusted target map through the sampling node, and the pixel value is usually a grayscale value; wherein a channel in the adjusted target map can be one of the R channel, the G channel or the B channel.

[0057] Step 31, obtaining an interval map corresponding to each pixel interval according to the pixel value corresponding to each pixel point and a plurality of pixel intervals; wherein the interval map matches a partial image area in the adjusted target map.

[0058] According to the pixel value corresponding to each pixel point in the adjusted target map, the pixel interval to which each pixel point belongs can be determined, so that the interval map corresponding to each pixel interval can be obtained. The interval map corresponding to a certain pixel interval is the image area composed of the pixel points whose pixel values ​​in the adjusted target map belong to the pixel interval.

[0059] In an optional embodiment, the above step 31 can also be implemented through the following process: for the pixel value corresponding to each pixel point, based on the pixel interval to which the current pixel point belongs, the pixel value corresponding to the current pixel point is adjusted to the specified pixel range to obtain the final pixel value corresponding to the current pixel point; the pixel value corresponding to the current pixel point and the final pixel value corresponding to the current pixel point are input into the judgment node corresponding to each pixel interval in the multiple pixel intervals; for each judgment node, if the pixel value corresponding to the current pixel point is within the pixel interval corresponding to the current judgment node, the current judgment node is controlled to output the final pixel value corresponding to the current pixel point; if the pixel value corresponding to the current pixel point is not within the pixel interval corresponding to the current judgment node, the current judgment node is controlled to output zero; according to the output results of the judgment nodes corresponding to the multiple pixel intervals, an interval map corresponding to each pixel interval is obtained.

[0060] Specifically, the judgment nodes corresponding to different pixel intervals all contain the following parameters: a minimum parameter, a maximum parameter, a first input value, and a second input value. Among them, the minimum parameter is the minimum value of the pixel interval corresponding to the judgment node, the maximum parameter is the maximum value of the pixel interval corresponding to the judgment node, the first input value is the final pixel value corresponding to each pixel point, and the second input value is zero. When the pixel value of a certain pixel point is input to the judgment node, if the pixel value is greater than the minimum parameter and less than the maximum parameter, then the judgment node outputs the pixel value corresponding to the first input value, otherwise, it outputs zero.

[0061] In specific implementation, the above-mentioned specified pixel range can be determined according to research and development requirements. For example, the specified pixel range is a range of 0-255, that is, the pixel value corresponding to each pixel point is restored to the specified pixel range, so that the pixel value of each pixel point matches its pixel value in the target map before adjustment, thereby complying with the engine rendering rules.

[0062] Step 32, based on the interval map corresponding to each pixel interval, shadow rendering processing is performed on the target model to obtain a shadow rendering result.

[0063] In a specific implementation, shadow rendering may be performed on the target model according to the pixel value of the interval map corresponding to each pixel interval to obtain a shadow rendering result corresponding to the target model.

[0064] In an optional embodiment, after determining the interval map corresponding to each pixel interval in the adjusted target map, the first interval map corresponding to the target pixel interval in the multiple pixel intervals can also be determined, and the brightness of the first interval map can be adjusted to obtain the adjusted first interval map; based on this method, the user can adjust the brightness of any interval map as needed. Based on this, the above-mentioned specific process of performing shadow rendering processing on the target model based on the interval map corresponding to each pixel interval to obtain the shadow rendering result can also include: based on the adjusted first interval map, performing shadow rendering processing on the model area corresponding to the first interval map in the target model to obtain the first shadow rendering result of the model area corresponding to the first interval map; determining the second interval map corresponding to the pixel interval other than the target pixel interval from the interval maps corresponding to the multiple pixel intervals, performing shadow rendering processing on the model area corresponding to the second interval map in the target model based on the second interval map to obtain the second shadow rendering result of the model area corresponding to the second interval map; integrating the first shadow rendering result and the second shadow rendering result to obtain the shadow rendering result corresponding to the target model.

[0065] The target pixel interval may be any one of the plurality of pixel intervals. This method can adjust the brightness of the interval map corresponding to a certain pixel interval separately, thereby increasing the user's freedom in adjusting the map and further improving the user's control accuracy over the shadow.

[0066] In another optional embodiment, when shadow rendering is performed on the target model, it is also necessary to obtain the marking information of the target model, which is used to indicate the model identifier corresponding to each model area in the target model; based on the marking information of the target model, determine the map area corresponding to each model area in the adjusted target map. Based on this, after determining the interval map corresponding to each pixel interval in the adjusted target map, the target model area can also be determined based on the target model identifier, and a third interval map matching the map area corresponding to the target model area is determined from the interval map corresponding to each pixel interval; the brightness of the third interval map is adjusted to obtain the adjusted third interval map; based on the adjusted third interval map, the target model area in the target model is shadow rendered to obtain the third shadow rendering result of the target model area; a fourth interval map other than the third interval map is determined from the interval maps corresponding to the multiple pixel intervals, and the model area corresponding to the fourth interval map in the target model is shadow rendered based on the fourth interval map to obtain the fourth shadow rendering result of the model area corresponding to the fourth interval map; the third shadow rendering result and the fourth shadow rendering result are integrated to obtain the shadow rendering result corresponding to the target model.

[0067] In a specific implementation, the above-mentioned target model identifier can be any model identifier indicated by the marking information, so that the target model area corresponding to the target model identifier can be any model area in the target model. This method can individually adjust the brightness of the interval map corresponding to any model area, thereby increasing the freedom of map adjustment. Users can also finely control the shadow of a certain model area according to needs.

[0068] In practical applications, some customizable SDF maps (equivalent to the above-mentioned target maps) for controlling the shadow rendering effect of the model can be automatically generated through other software, and the content still hopes to be further adjusted through materials in the game. However, the adjustment part is constant. For example, the fixed area of ​​the nose part in the face model is inconsistent with the SDF map used for the entire face, and it needs to be dynamically adjusted within the game. In the prior art, to implement this method, it is necessary to use different areas of the two maps at the same time and distinguish the two maps. If the lowest consumption solution according to the traditional solution is also to use an SDF map, use different corresponding SDFs in the AB area respectively, and use another channel to distinguish the two areas. Since the accuracy requirement of the SDF map is not so high, it can sacrifice accuracy to a certain extent for performance. For example, AB is in the range of 0-1 pixels, which can be compressed into 0-0.5 pixel intervals and 0.5-1 pixel intervals respectively. In this way, the information of the sub-areas can be transmitted at the same time, and judgment and adjustment can be made in the material.

[0069] This method proposes an optimization solution for fine control of shadow maps using layering. This method mainly divides the range of shadow control into multiple pixel intervals, each pixel interval corresponds to a specific shadow control strategy, and then performs layered processing on shadow control to better control the timing of shadow appearance and make it more in line with actual conditions.

[0070] Corresponding to the above method embodiment, the present disclosure embodiment provides a shadow rendering device, such as Figure 5 As shown, the device comprises:

[0071] A texture acquisition module 50 is used to acquire a target texture; wherein the target texture is used to control the shadow rendering effect of the target model under illumination;

[0072] The texture partitioning module 51 is used to adjust the pixel values ​​of the target texture according to a preset pixel layering control strategy to obtain an adjusted target texture; wherein the pixel layering control strategy includes: multiple pixel intervals, and shadow control strategies corresponding to each pixel interval; different shadow control strategies correspond to different times when shadows appear and / or are removed on the target model.

[0073] The shadow rendering module 52 is used to render the shadow of the target model based on the adjusted target map to obtain a shadow rendering result corresponding to the target model.

[0074] The shadow rendering device described above can achieve fine control of the timing of shadow appearance while maintaining the shadow effect of the model, because different pixel intervals in the pixel layering control strategy correspond to different shadow control strategies. At the same time, this method only needs to sample one map when rendering shadows, which reduces the performance consumption of shadow rendering.

[0075] Specifically, the above-mentioned device also includes a map determination module, which is used to: obtain a target model and perform texture expansion processing on the target model to obtain a two-dimensional texture map corresponding to the target model; based on the two-dimensional texture map, generate a target map whose size matches the size of the two-dimensional texture map corresponding to the target model; wherein the pixel value corresponding to each pixel point in the target map is used to indicate the distance between the pixel point and the target model.

[0076] Furthermore, the above-mentioned map partitioning module 51 is used to: determine the shadow rendering characteristics corresponding to each model area in the target model; wherein the shadow rendering characteristics are used to indicate the shadow rendering effect of the target model under illumination; for each model area, determine a target shadow control strategy that matches the shadow rendering characteristics corresponding to the current model area from the pixel layering control strategy, and intercept the map area corresponding to the current model area from the target map, and adjust the pixel value of the map area corresponding to the current model area based on the pixel interval corresponding to the target shadow control strategy to obtain the adjusted map area corresponding to the current model area; integrate the adjusted map areas corresponding to each model area to obtain the adjusted target map.

[0077] In a specific implementation, the above-mentioned map partitioning module 51 is also used to: scale the pixel value of the map area corresponding to the current model area to the pixel interval corresponding to the target shadow control strategy to obtain the adjusted map area corresponding to the current model area.

[0078] Furthermore, the above-mentioned shadow rendering module 52 is used to: sample the adjusted target map to obtain the pixel value corresponding to each pixel point in the adjusted target map; obtain the interval map corresponding to each pixel interval according to the pixel value corresponding to each pixel point and multiple pixel intervals; wherein the interval map matches the partial image area in the adjusted target map; based on the interval map corresponding to each pixel interval, perform shadow rendering processing on the target model to obtain a shadow rendering result.

[0079] Furthermore, the above-mentioned shadow rendering module 52 is also used to: for the pixel value corresponding to each pixel point, based on the pixel interval to which the current pixel point belongs, adjust the pixel value corresponding to the current pixel point to within the specified pixel range to obtain the final pixel value corresponding to the current pixel point; input the pixel value corresponding to the current pixel point and the final pixel value corresponding to the current pixel point into the judgment node corresponding to each pixel interval in the multiple pixel intervals; for each judgment node, if the pixel value corresponding to the current pixel point is within the pixel interval corresponding to the current judgment node, control the current judgment node to output the final pixel value corresponding to the current pixel point; if the pixel value corresponding to the current pixel point is not within the pixel interval corresponding to the current judgment node, control the current judgment node to output zero; and obtain the interval map corresponding to each pixel interval according to the output results of the judgment nodes corresponding to the multiple pixel intervals.

[0080] Furthermore, the above-mentioned device also includes a first adjustment module, which is used to: after obtaining the interval map corresponding to each pixel interval according to the pixel value corresponding to each pixel point and multiple pixel intervals, determine the first interval map corresponding to the target pixel interval among the multiple pixel intervals, and adjust the brightness of the first interval map to obtain the adjusted first interval map; based on this, the above-mentioned shadow rendering module 52 is also used to: based on the adjusted first interval map, shadow rendering the model area corresponding to the first interval map in the target model to obtain the first shadow rendering result of the model area corresponding to the first interval map; determine the second interval map corresponding to the pixel interval other than the target pixel interval from the interval maps corresponding to the multiple pixel intervals, and shadow rendering the model area corresponding to the second interval map in the target model based on the second interval map to obtain the second shadow rendering result of the model area corresponding to the second interval map; integrate the first shadow rendering result and the second shadow rendering result to obtain the shadow rendering result corresponding to the target model.

[0081] Furthermore, the shadow rendering module 52 is also used to: obtain marking information of the target model, where the marking information is used to indicate the model identifier corresponding to each model area in the target model; determine the target model area based on the target model identifier, and determine a third interval map that matches the map area corresponding to the target model area from the interval map corresponding to each pixel interval; adjust the brightness of the third interval map to obtain an adjusted third interval map; perform shadow rendering processing on the target model area in the target model based on the adjusted third interval map to obtain a third shadow rendering result of the target model area; determine a fourth interval map other than the third interval map from the interval maps corresponding to multiple pixel intervals, and perform shadow rendering processing on the model area corresponding to the fourth interval map in the target model based on the fourth interval map to obtain a fourth shadow rendering result of the model area corresponding to the fourth interval map; integrate the third shadow rendering result and the fourth shadow rendering result to obtain a shadow rendering result corresponding to the target model.

[0082] The shadow rendering device provided in the embodiment of the present disclosure has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0083] The present disclosure also provides an electronic device, such as Figure 6 As shown, the electronic device includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above shadow rendering method.

[0084] Specifically, the above-mentioned shadow rendering method includes: obtaining a target map; wherein the target map is used to control the shadow rendering effect of the target model under lighting; according to a preset pixel layering control strategy, adjusting the pixel value of the target map to obtain an adjusted target map; wherein the pixel layering control strategy includes: multiple pixel intervals, and shadow control strategies corresponding to each pixel interval; different shadow control strategies correspond to shadows that appear and / or are removed on the target model at different times; based on the adjusted target map, rendering the shadow of the target model to obtain a shadow rendering result corresponding to the target model.

[0085] In the above shadow rendering method, since different pixel intervals in the pixel layering control strategy correspond to different shadow control strategies, the target map adjusted based on the pixel layering control strategy can achieve fine control of the timing of shadow appearance while maintaining the shadow effect of the model. At the same time, this method only needs to sample one map when rendering shadows, reducing the performance consumption of shadow rendering.

[0086] In an optional embodiment, the target map is determined in the following manner: a target model is acquired, and texture expansion processing is performed on the target model to obtain a two-dimensional texture map corresponding to the target model; based on the two-dimensional texture map, a target map is generated whose size matches the size of the two-dimensional texture map corresponding to the target model; wherein the pixel value corresponding to each pixel point in the target map is used to indicate the distance between the pixel point and the target model.

[0087] In an optional embodiment, the above-mentioned step of adjusting the pixel values ​​of the target map according to a preset pixel layering control strategy to obtain an adjusted target map includes: determining shadow rendering characteristics corresponding to each model area in the target model; wherein the shadow rendering characteristics are used to indicate the shadow rendering effect of the target model under illumination; for each model area, determining a target shadow control strategy that matches the shadow rendering characteristics corresponding to the current model area from the pixel layering control strategy, and intercepting a map area corresponding to the current model area from the target map, and adjusting the pixel values ​​of the map area corresponding to the current model area based on the pixel interval corresponding to the target shadow control strategy to obtain an adjusted map area corresponding to the current model area; and integrating the adjusted map areas corresponding to each model area to obtain an adjusted target map.

[0088] In an optional embodiment, the above-mentioned step of adjusting the pixel values ​​of the mapping area corresponding to the current model area based on the pixel interval corresponding to the target shadow control strategy to obtain the adjusted mapping area corresponding to the current model area includes: scaling the pixel values ​​of the mapping area corresponding to the current model area to the pixel interval corresponding to the target shadow control strategy to obtain the adjusted mapping area corresponding to the current model area.

[0089] In an optional embodiment, the step of rendering the shadow of the target model based on the adjusted target map to obtain a shadow rendering result corresponding to the target model includes: sampling the adjusted target map to obtain a pixel value corresponding to each pixel in the adjusted target map; obtaining an interval map corresponding to each pixel interval based on the pixel value corresponding to each pixel and multiple pixel intervals; wherein the interval map matches a partial image area in the adjusted target map; and performing shadow rendering processing on the target model based on the interval map corresponding to each pixel interval to obtain a shadow rendering result.

[0090] In an optional embodiment, the above-mentioned step of obtaining an interval map corresponding to each pixel interval based on the pixel value corresponding to each pixel point and multiple pixel intervals includes: for the pixel value corresponding to each pixel point, based on the pixel interval to which the current pixel point belongs, adjusting the pixel value corresponding to the current pixel point to within the specified pixel range to obtain the final pixel value corresponding to the current pixel point; inputting the pixel value corresponding to the current pixel point and the final pixel value corresponding to the current pixel point into the judgment node corresponding to each pixel interval in the multiple pixel intervals; for each judgment node, if the pixel value corresponding to the current pixel point is within the pixel interval corresponding to the current judgment node, controlling the current judgment node to output the final pixel value corresponding to the current pixel point; if the pixel value corresponding to the current pixel point is not within the pixel interval corresponding to the current judgment node, controlling the current judgment node to output zero; and obtaining the interval map corresponding to each pixel interval based on the output results of the judgment nodes corresponding to the multiple pixel intervals.

[0091] In an optional embodiment, after the step of obtaining an interval map corresponding to each pixel interval according to the pixel value corresponding to each pixel point and multiple pixel intervals, the above method also includes: determining a first interval map corresponding to a target pixel interval among multiple pixel intervals, and adjusting the brightness of the first interval map to obtain an adjusted first interval map; performing shadow rendering processing on a target model based on the interval map corresponding to each pixel interval to obtain a shadow rendering result, including: performing shadow rendering processing on a model area corresponding to the first interval map in the target model based on the adjusted first interval map to obtain a first shadow rendering result of the model area corresponding to the first interval map; determining a second interval map corresponding to a pixel interval other than the target pixel interval from the interval maps corresponding to the multiple pixel intervals, performing shadow rendering processing on a model area corresponding to the second interval map in the target model based on the second interval map to obtain a second shadow rendering result of the model area corresponding to the second interval map; integrating the first shadow rendering result and the second shadow rendering result to obtain a shadow rendering result corresponding to the target model.

[0092] In an optional embodiment, the step of performing shadow rendering processing on the target model based on the interval map corresponding to each pixel interval to obtain a shadow rendering result includes: obtaining marking information of the target model, the marking information being used to indicate the model identifier corresponding to each model area in the target model; determining the target model area based on the target model identifier, and determining a third interval map that matches the map area corresponding to the target model area from the interval map corresponding to each pixel interval; adjusting the brightness of the third interval map to obtain an adjusted third interval map; performing shadow rendering processing on the target model area in the target model based on the adjusted third interval map to obtain a third shadow rendering result of the target model area; determining a fourth interval map other than the third interval map from the interval maps corresponding to multiple pixel intervals, and performing shadow rendering processing on the model area corresponding to the fourth interval map in the target model based on the fourth interval map to obtain a fourth shadow rendering result of the model area corresponding to the fourth interval map; integrating the third shadow rendering result and the fourth shadow rendering result to obtain a shadow rendering result corresponding to the target model.

[0093] Further, Figure 6 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .

[0094] The memory 100 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0095] The processor 101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 101. The above processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and completes the steps of the method of the above embodiment in combination with its hardware.

[0096] The embodiment of the present disclosure further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned shadow rendering method.

[0097] Specifically, the above-mentioned shadow rendering method includes: obtaining a target map; wherein the target map is used to control the shadow rendering effect of the target model under lighting; according to a preset pixel layering control strategy, adjusting the pixel value of the target map to obtain an adjusted target map; wherein the pixel layering control strategy includes: multiple pixel intervals, and shadow control strategies corresponding to each pixel interval; different shadow control strategies correspond to shadows that appear and / or are removed on the target model at different times; based on the adjusted target map, rendering the shadow of the target model to obtain a shadow rendering result corresponding to the target model.

[0098] In the above shadow rendering method, since different pixel intervals in the pixel layering control strategy correspond to different shadow control strategies, the target map adjusted based on the pixel layering control strategy can achieve fine control of the timing of shadow appearance while maintaining the shadow effect of the model. At the same time, this method only needs to sample one map when rendering shadows, reducing the performance consumption of shadow rendering.

[0099] In an optional embodiment, the target map is determined in the following manner: a target model is acquired, and texture expansion processing is performed on the target model to obtain a two-dimensional texture map corresponding to the target model; based on the two-dimensional texture map, a target map is generated whose size matches the size of the two-dimensional texture map corresponding to the target model; wherein the pixel value corresponding to each pixel point in the target map is used to indicate the distance between the pixel point and the target model.

[0100] In an optional embodiment, the above-mentioned step of adjusting the pixel values ​​of the target map according to a preset pixel layering control strategy to obtain an adjusted target map includes: determining shadow rendering characteristics corresponding to each model area in the target model; wherein the shadow rendering characteristics are used to indicate the shadow rendering effect of the target model under illumination; for each model area, determining a target shadow control strategy that matches the shadow rendering characteristics corresponding to the current model area from the pixel layering control strategy, and intercepting a map area corresponding to the current model area from the target map, and adjusting the pixel values ​​of the map area corresponding to the current model area based on the pixel interval corresponding to the target shadow control strategy to obtain an adjusted map area corresponding to the current model area; and integrating the adjusted map areas corresponding to each model area to obtain an adjusted target map.

[0101] In an optional embodiment, the above-mentioned step of adjusting the pixel values ​​of the mapping area corresponding to the current model area based on the pixel interval corresponding to the target shadow control strategy to obtain the adjusted mapping area corresponding to the current model area includes: scaling the pixel values ​​of the mapping area corresponding to the current model area to the pixel interval corresponding to the target shadow control strategy to obtain the adjusted mapping area corresponding to the current model area.

[0102] In an optional embodiment, the step of rendering the shadow of the target model based on the adjusted target map to obtain a shadow rendering result corresponding to the target model includes: sampling the adjusted target map to obtain a pixel value corresponding to each pixel in the adjusted target map; obtaining an interval map corresponding to each pixel interval based on the pixel value corresponding to each pixel and multiple pixel intervals; wherein the interval map matches a partial image area in the adjusted target map; and performing shadow rendering processing on the target model based on the interval map corresponding to each pixel interval to obtain a shadow rendering result.

[0103] In an optional embodiment, the above-mentioned step of obtaining an interval map corresponding to each pixel interval based on the pixel value corresponding to each pixel point and multiple pixel intervals includes: for the pixel value corresponding to each pixel point, based on the pixel interval to which the current pixel point belongs, adjusting the pixel value corresponding to the current pixel point to within the specified pixel range to obtain the final pixel value corresponding to the current pixel point; inputting the pixel value corresponding to the current pixel point and the final pixel value corresponding to the current pixel point into the judgment node corresponding to each pixel interval in the multiple pixel intervals; for each judgment node, if the pixel value corresponding to the current pixel point is within the pixel interval corresponding to the current judgment node, controlling the current judgment node to output the final pixel value corresponding to the current pixel point; if the pixel value corresponding to the current pixel point is not within the pixel interval corresponding to the current judgment node, controlling the current judgment node to output zero; and obtaining the interval map corresponding to each pixel interval based on the output results of the judgment nodes corresponding to the multiple pixel intervals.

[0104] In an optional embodiment, after the step of obtaining an interval map corresponding to each pixel interval according to the pixel value corresponding to each pixel point and multiple pixel intervals, the above method also includes: determining a first interval map corresponding to a target pixel interval among multiple pixel intervals, and adjusting the brightness of the first interval map to obtain an adjusted first interval map; performing shadow rendering processing on a target model based on the interval map corresponding to each pixel interval to obtain a shadow rendering result, including: performing shadow rendering processing on a model area corresponding to the first interval map in the target model based on the adjusted first interval map to obtain a first shadow rendering result of the model area corresponding to the first interval map; determining a second interval map corresponding to a pixel interval other than the target pixel interval from the interval maps corresponding to the multiple pixel intervals, performing shadow rendering processing on a model area corresponding to the second interval map in the target model based on the second interval map to obtain a second shadow rendering result of the model area corresponding to the second interval map; integrating the first shadow rendering result and the second shadow rendering result to obtain a shadow rendering result corresponding to the target model.

[0105] In an optional embodiment, the step of performing shadow rendering processing on the target model based on the interval map corresponding to each pixel interval to obtain a shadow rendering result includes: obtaining marking information of the target model, the marking information being used to indicate the model identifier corresponding to each model area in the target model; determining the target model area based on the target model identifier, and determining a third interval map that matches the map area corresponding to the target model area from the interval map corresponding to each pixel interval; adjusting the brightness of the third interval map to obtain an adjusted third interval map; performing shadow rendering processing on the target model area in the target model based on the adjusted third interval map to obtain a third shadow rendering result of the target model area; determining a fourth interval map other than the third interval map from the interval maps corresponding to multiple pixel intervals, and performing shadow rendering processing on the model area corresponding to the fourth interval map in the target model based on the fourth interval map to obtain a fourth shadow rendering result of the model area corresponding to the fourth interval map; integrating the third shadow rendering result and the fourth shadow rendering result to obtain a shadow rendering result corresponding to the target model.

[0106] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a terminal device, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0107] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0108] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A shadow rendering method, characterized in that: The method comprises: Obtaining a target map; wherein the target map is used to control the shadow rendering effect of the target model under illumination; According to a preset pixel layering control strategy, the pixel values ​​of the target map are adjusted to obtain an adjusted target map; wherein the pixel layering control strategy includes: a plurality of pixel intervals, and shadow control strategies corresponding to each of the pixel intervals; shadows corresponding to different shadow control strategies appear and / or are removed at different times on the target model; Based on the adjusted target map, the shadow of the target model is rendered to obtain a shadow rendering result corresponding to the target model.

2. The method according to claim 1, characterized in that The target map is determined by: Acquire the target model, and perform texture expansion processing on the target model to obtain a two-dimensional texture map corresponding to the target model; Based on the two-dimensional texture map, a target map whose size matches the size of the two-dimensional texture map corresponding to the target model is generated; wherein the pixel value corresponding to each pixel point in the target map is used to indicate the distance between the pixel point and the target model.

3. The method according to claim 1, characterized in that: The step of adjusting the pixel values ​​of the target map according to a preset pixel layering control strategy to obtain an adjusted target map comprises: Determine the shadow rendering characteristics corresponding to each model area in the target model; wherein the shadow rendering characteristics are used to indicate the shadow rendering effect of the target model under illumination; For each model area, a target shadow control strategy matching the shadow presentation characteristics corresponding to the current model area is determined from the pixel layering control strategy, and a map area corresponding to the current model area is intercepted from the target map, and based on the pixel interval corresponding to the target shadow control strategy, the pixel value of the map area corresponding to the current model area is adjusted to obtain an adjusted map area corresponding to the current model area; The adjusted map regions corresponding to the various model regions are integrated to obtain the adjusted target map.

4. The method according to claim 3, characterized in that The step of adjusting the pixel value of the mapping area corresponding to the current model area based on the pixel interval corresponding to the target shadow control strategy to obtain the adjusted mapping area corresponding to the current model area includes: The pixel values ​​of the mapping area corresponding to the current model area are scaled to the pixel interval corresponding to the target shadow control strategy to obtain the adjusted mapping area corresponding to the current model area.

5. The method according to claim 1, characterized in that The step of rendering the shadow of the target model based on the adjusted target map to obtain the shadow rendering result corresponding to the target model includes: Sampling the adjusted target map to obtain a pixel value corresponding to each pixel point in the adjusted target map; Obtaining an interval map corresponding to each pixel interval according to the pixel value corresponding to each pixel point and the plurality of pixel intervals; wherein the interval map matches a partial image area in the adjusted target map; Based on the interval map corresponding to each pixel interval, shadow rendering processing is performed on the target model to obtain a shadow rendering result.

6. The method according to claim 5, characterized in that The step of obtaining an interval map corresponding to each pixel interval according to the pixel value corresponding to each pixel point and the plurality of pixel intervals comprises: For each pixel value corresponding to the pixel point, based on the pixel interval to which the current pixel point belongs, the pixel value corresponding to the current pixel point is adjusted to a specified pixel range to obtain a final pixel value corresponding to the current pixel point; Inputting the pixel value corresponding to the current pixel point and the final pixel value corresponding to the current pixel point into the judgment node corresponding to each of the plurality of pixel intervals; For each of the judgment nodes, if the pixel value corresponding to the current pixel point is within the pixel interval corresponding to the current judgment node, control the current judgment node to output the final pixel value corresponding to the current pixel point; if the pixel value corresponding to the current pixel point is not within the pixel interval corresponding to the current judgment node, control the current judgment node to output zero; According to the output results of the judgment nodes corresponding to the multiple pixel intervals, an interval map corresponding to each pixel interval is obtained.

7. The method according to claim 5, characterized in that After the step of obtaining an interval map corresponding to each pixel interval according to the pixel value corresponding to each pixel point and the plurality of pixel intervals, the method further comprises: Determine a first interval map corresponding to a target pixel interval among the plurality of pixel intervals, and adjust the brightness of the first interval map to obtain an adjusted first interval map; The step of performing shadow rendering processing on the target model based on the interval map corresponding to each pixel interval to obtain a shadow rendering result includes: Based on the adjusted first interval map, shadow rendering is performed on a model area corresponding to the first interval map in the target model to obtain a first shadow rendering result of the model area corresponding to the first interval map; Determining a second interval map corresponding to a pixel interval other than the target pixel interval from the interval maps corresponding to the multiple pixel intervals, and performing shadow rendering processing on a model area corresponding to the second interval map in the target model based on the second interval map to obtain a second shadow rendering result of the model area corresponding to the second interval map; The first shadow rendering result and the second shadow rendering result are integrated to obtain a shadow rendering result corresponding to the target model.

8. The method according to claim 5, characterized in that The step of performing shadow rendering processing on the target model based on the interval map corresponding to each pixel interval to obtain a shadow rendering result includes: Acquire marking information of the target model, where the marking information is used to indicate a model identifier corresponding to each model area in the target model; Determine the target model area based on the target model identifier, and determine a third interval map that matches the map area corresponding to the target model area from the interval maps corresponding to each pixel interval; Adjusting the brightness of the third interval map to obtain an adjusted third interval map; Based on the adjusted third interval map, shadow rendering is performed on the target model area in the target model to obtain a third shadow rendering result of the target model area; Determine a fourth interval map other than the third interval map from the interval maps corresponding to the multiple pixel intervals, and perform shadow rendering processing on a model area corresponding to the fourth interval map in the target model based on the fourth interval map to obtain a fourth shadow rendering result of the model area corresponding to the fourth interval map; The third shadow rendering result and the fourth shadow rendering result are integrated to obtain a shadow rendering result corresponding to the target model.

9. A shadow rendering device, characterized in that: The device comprises: A texture acquisition module, used to acquire a target texture; wherein the target texture is used to control the shadow rendering effect of the target model under illumination; A texture partitioning module, used for adjusting the pixel values ​​of the target texture according to a preset pixel layering control strategy to obtain an adjusted target texture; wherein the pixel layering control strategy includes: a plurality of pixel intervals, and shadow control strategies corresponding to each of the pixel intervals; shadows corresponding to different shadow control strategies appear and / or are removed at different times on the target model; A shadow rendering module is used to render the shadow of the target model based on the adjusted target map to obtain a shadow rendering result corresponding to the target model.

10. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the shadow rendering method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the shadow rendering method according to any one of claims 1 to 8.