Soft shadow rendering method and device, display chip, electronic equipment and storage medium

By introducing diffusion analysis and reverse gradient growth methods into shadow rendering technology, the problem of the inability to effectively simulate soft shadows in the prior art is solved, and a natural and real shadow effect is achieved.

CN120219541APending Publication Date: 2025-06-27CHIPONE (SHENZHEN) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510286728.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

The shadow rendering technology in the prior art cannot effectively simulate the gradient and soft soft shadows generated by light sources in the real world, resulting in the visual effect of the shadows being not natural and realistic enough.

Method used

Through a soft shadow rendering method, the diffusion analysis results of candidate pixel points are determined using the initial shadow mask and the light direction, and whether the shadow diffusion conditions are met, the target pixel value is calculated based on the diffusion coefficient and initial pixel value, so as to achieve reverse gradient growth of hard shadows along the light direction, and generate gradient and soft shadow edges.

Benefits of technology

The diffusion and blur of hard shadows are achieved, and gradient and soft shadow edges are generated to obtain a ray-tracing visual effect, simulating the natural and real projection effect of the real world.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120219541A_ABST
    Figure CN120219541A_ABST
Patent Text Reader

Abstract

The invention relates to a soft shadow rendering method and device, a display chip, electronic equipment and a storage medium, and the method comprises the steps: determining a diffusion analysis result according to an initial shadow mask and a light direction of a to-be-rendered object, and the positions of a current diffusion starting point and a candidate pixel point; under the condition that the diffusion analysis result indicates that the shadow diffusion condition is met, determining a diffusion coefficient according to the position of the candidate pixel point and the position of the shadow starting point; determining a target pixel value of the candidate pixel point according to the diffusion coefficient and the initial pixel value of the candidate pixel point, determining the candidate pixel point as a new diffusion starting point, determining a new candidate pixel point based on a breadth-first traversal algorithm, and iteratively executing the steps until a preset termination condition is met; and determining a first target shadow according to the target pixel values of the pixel points meeting the shadow diffusion condition. According to the embodiment of the invention, the hard shadow of the to-be-rendered object can be diffused and blurred along the light direction, the gradually-changed soft shadow edge is generated, and the real projection effect of simulating the real world is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of graphic display, and in particular, to a method and apparatus for soft shadow rendering, a display chip, an electronic device, and a storage medium. Background Art

[0002] In the real world, light sources are usually not point light sources, but area light sources or volume light sources with a certain area; the shadows generated by such light sources have gradually changing and soft edges, which are usually called soft shadows. However, in the existing shadow rendering technologies, the rendering results are usually hard shadows with sharp edges, resulting in an unnatural and unrealistic visual effect of the shadows. Summary of the Invention

[0003] In view of this, the present disclosure provides a technical solution for a method and apparatus for soft shadow rendering, a display chip, an electronic device, and a storage medium.

[0004] According to one aspect of the present disclosure, there is provided a method for soft shadow rendering, including: determining a diffusion analysis result corresponding to a candidate pixel according to an initial shadow mask corresponding to an object to be rendered, a light direction, a position corresponding to a current diffusion start point, and a position corresponding to the candidate pixel, where the diffusion analysis result is used to indicate whether the candidate pixel meets a preset shadow diffusion condition, and the current diffusion start point is any pixel point that has been confirmed to meet the shadow diffusion condition, or a shadow start point corresponding to the object to be rendered; in a case where the diffusion analysis result indicates that the candidate pixel meets the shadow diffusion condition, determining a diffusion coefficient corresponding to the candidate pixel according to the position of the candidate pixel and the position of the shadow start point; determining a target pixel value corresponding to the candidate pixel according to the diffusion coefficient and an initial pixel value corresponding to the candidate pixel, and determining the candidate pixel as a new diffusion start point, determining new candidate pixels based on a breadth-first traversal algorithm, and iteratively executing the above steps until a preset termination condition is met; determining a first target shadow corresponding to the object to be rendered according to target pixel values corresponding to all pixel points that meet the shadow diffusion condition.

[0005] In a possible implementation, determining the diffusion analysis result corresponding to the candidate pixel according to the initial shadow mask corresponding to the object to be rendered, the light direction, the position corresponding to the current diffusion start point, and the position corresponding to the candidate pixel includes: determining the position analysis result corresponding to the candidate pixel according to the position corresponding to the current diffusion start point, the position corresponding to the candidate pixel, and the light direction, where the position analysis result is used to indicate whether the candidate pixel is located in the diffusion region determined by the shadow start point and the light direction; when the position analysis result indicates that the candidate pixel is located in the diffusion region, determining the diffusion analysis result according to the initial shadow mask, the position corresponding to the candidate pixel, and the initial pixel value corresponding to the candidate pixel.

[0006] In a possible implementation, determining the position analysis result corresponding to the candidate pixel according to the position corresponding to the current diffusion start point, the position corresponding to the candidate pixel, and the light direction includes: when the candidate pixel is located in the screen space corresponding to the object to be rendered, determining the diffusion vector corresponding to the candidate pixel according to the position corresponding to the candidate pixel and the position corresponding to the current diffusion start point; determining the position analysis result corresponding to the candidate pixel according to the diffusion vector corresponding to the candidate pixel and the light direction.

[0007] In a possible implementation, the initial pixel value corresponding to the candidate pixel includes: the initial luminance value corresponding to the candidate pixel in the YUV color space, and the shadow diffusion condition includes: the difference between the initial luminance value corresponding to the candidate pixel and the luminance value corresponding to the current diffusion start point in the YUV color space is less than or equal to a preset threshold, and the candidate pixel is located in the non-shadow region of the initial shadow mask.

[0008] In a possible implementation, when the diffusion analysis result indicates that the candidate pixel satisfies the shadow diffusion condition, determining the diffusion coefficient corresponding to the candidate pixel according to the position of the candidate pixel and the position of the shadow start point includes: determining the diffusion distance corresponding to the candidate pixel according to the position of the candidate pixel and the position of the shadow start point; determining the diffusion coefficient according to the diffusion distance and a preset increasing function.

[0009] In a possible implementation, the initial shadow mask is a shadow mask in the YUV color space; the method further includes: segmenting the initial shadow of the object to be rendered to determine a shadow mask in the RGB color space; performing gamut conversion on the shadow mask in the RGB color space to determine the initial shadow mask and the shadow start point.

[0010] In a possible implementation, the target pixel value corresponding to the candidate pixel point includes: the target luminance value and the target chrominance value corresponding to the candidate pixel point in the YUV color space, and the first target shadow corresponding to the object to be rendered is a shadow in the RGB color space; determining the first target shadow corresponding to the object to be rendered according to the target pixel values corresponding to all diffusion points includes: determining a second target shadow corresponding to the object to be rendered in the YUV color space according to the target pixel values corresponding to all diffusion points; performing gamut conversion on the second target shadow to determine the first target shadow.

[0011] According to another aspect of the present disclosure, there is provided a soft shadow rendering device, including: a diffusion determination module, configured to determine a diffusion analysis result corresponding to the candidate pixel point according to an initial shadow mask corresponding to the object to be rendered, a light direction, a position corresponding to the current diffusion starting point, and a position corresponding to the candidate pixel point, where the diffusion analysis result is used to indicate whether the candidate pixel point meets a preset shadow diffusion condition, and the current diffusion starting point is any pixel point that has been confirmed to meet the shadow diffusion condition, or a shadow starting point corresponding to the object to be rendered; a diffusion coefficient determination module, configured to determine a diffusion coefficient corresponding to the candidate pixel point according to the position of the candidate pixel point and the position of the shadow starting point when the diffusion analysis result indicates that the candidate pixel point meets the shadow diffusion condition; a pixel point traversal module, configured to determine a target pixel value corresponding to the candidate pixel point according to the diffusion coefficient and an initial pixel value corresponding to the candidate pixel point, determine the candidate pixel point as a new diffusion starting point, determine new candidate pixel points based on a breadth-first traversal algorithm, and iteratively execute the above steps until a preset termination condition is met; a shadow rendering module, configured to determine a first target shadow corresponding to the object to be rendered according to the target pixel values corresponding to all pixel points that meet the shadow diffusion condition.

[0012] According to another aspect of the present disclosure, there is provided a display chip, which is used to implement the above soft shadow rendering method, or includes at least one of the above soft shadow rendering devices.

[0013] According to another aspect of the present disclosure, there is provided an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein, the processor is configured to implement the above method when executing the instructions stored in the memory.

[0014] According to another aspect of the present disclosure, there is provided a non-volatile computer-readable storage medium, on which computer program instructions are stored, where the computer program instructions implement the above method when executed by a processor.

[0015] In an embodiment of the present disclosure, after determining any pixel point that has been confirmed to meet the shadow diffusion condition or the shadow starting point corresponding to the object to be rendered as the current diffusion starting point, the diffusion analysis result corresponding to the candidate pixel point can be determined based on the initial shadow mask corresponding to the object to be rendered, the light direction, the position corresponding to the current diffusion starting point, and the position corresponding to the candidate pixel point, so as to indicate whether the candidate pixel point meets the preset shadow diffusion condition, thereby determining whether it is necessary to diffuse and blur the initial shadow of the object to be rendered at the candidate pixel point. When the diffusion analysis result indicates that the candidate pixel point meets the shadow diffusion condition, the diffusion coefficient corresponding to the candidate pixel point can be determined based on the position of the candidate pixel point and the position of the shadow starting point, and the target pixel value corresponding to the candidate pixel point can be determined based on the diffusion coefficient and the initial pixel value corresponding to the candidate pixel point, so as to achieve inverse gradient growth of the hard shadow of the object to be rendered along the light direction. After determining the candidate pixel point as the new diffusion starting point, new candidate pixel points can be determined based on the breadth-first traversal algorithm, and the above steps can be iteratively executed until the preset termination condition is met, so as to determine the first target shadow corresponding to the object to be rendered according to the target pixel values corresponding to all pixel points that meet the shadow diffusion condition, realize the diffusion and blurring of the hard shadow, generate a gradient and soft shadow edge, obtain a light-tracing-like visual effect, and simulate the natural and real projection effect in the real world.

[0016] Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings included in and constituting a part of this specification, together with the specification, illustrate exemplary embodiments, features, and aspects of the present disclosure and are used to explain the principles of the present disclosure.

[0018] Figure 1 A flowchart showing a method for rendering soft shadows according to an embodiment of the present disclosure;

[0019] Figure 2 A schematic diagram showing a process of rendering soft shadows according to an embodiment of the present disclosure;

[0020] Figure 3 A block diagram showing a device for rendering soft shadows according to an embodiment of the present disclosure;

[0021] Figure 4 A block diagram showing an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0022] Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the drawings denote elements having the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0023] In the description of the present disclosure, it should be understood that the orientation or positional relationships indicated by the terms "length", "width", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. are based on the orientation or positional relationships 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 thus should not be construed as a limitation of the present disclosure.

[0024] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present disclosure, the meaning of "a plurality" is two or more unless otherwise specifically defined.

[0025] In the present disclosure, unless otherwise clearly specified and defined, the terms "mounted", "connected", "coupled", "fixed", etc. should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or integrated; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the internal communication of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.

[0026] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" in this article represents any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set composed of A, B, and C.

[0027] In the real world, a light source is usually not a point light source, but a surface light source or a volume light source with a certain area; the shadow edge generated by such a light source is gradual and soft, and is usually called a soft shadow. However, in the existing shadow rendering technology, the rendering result is usually a hard shadow with a sharp edge, which does not have the characteristics of being gradual and soft in the real world, resulting in the visual effect of the shadow not being natural and realistic enough.

[0028] In the prior art, methods such as ray tracing are usually used to perform real-time soft shadow rendering on the object to be rendered. However, the ray tracing method has high computing power requirements for hardware devices, resulting in limited application scenarios and extremely high usage costs.

[0029] In view of this, the embodiments of the present disclosure provide a soft shadow rendering method, which can perform inverse gradient growth on the hard shadow of the object to be rendered along the light direction, realize the diffusion and blurring of the hard shadow, generate a gradient and soft shadow edge, and obtain a light-tracing-like visual effect to simulate the natural and real projection effect in the real world. The soft shadow rendering method of the embodiments of the present disclosure is introduced in detail below.

[0030] Figure 1 The flowchart of a soft shadow rendering method according to an embodiment of the present disclosure is shown. As Figure 1 shown, the soft shadow rendering method can be executed by an electronic device such as a terminal device or a server. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The soft shadow rendering method can be implemented by a processor calling computer-readable instructions stored in a memory. Alternatively, the soft shadow rendering method can be executed by a server. As Figure 1 shown, the soft shadow rendering method includes:

[0031] In step S101, according to the initial shadow mask corresponding to the object to be rendered, the light direction, the position corresponding to the current diffusion starting point, and the position corresponding to the candidate pixel point, determine the diffusion analysis result corresponding to the candidate pixel point, where the diffusion analysis result is used to indicate whether the candidate pixel point meets the preset shadow diffusion condition, and the current diffusion starting point is any pixel point that has been confirmed to meet the shadow diffusion condition, or the shadow starting point corresponding to the object to be rendered.

[0032] The object to be rendered here can be any display object that needs to perform soft shadow rendering in a computer graphics display scene, and its specific form can be flexibly set according to actual usage requirements. For example, it can be any 3D model in a game, a virtual reality scene, etc. The present disclosure does not make specific limitations on this.

[0033] The initial shadow mask corresponding to the object to be rendered can represent the prior segmentation result of the area corresponding to the hard shadow of the object to be rendered, and can be used to indicate the hard shadow area of the object to be rendered as the basis for soft shadow rendering. The specific form of the initial shadow mask and the specific method for obtaining the initial shadow mask can refer to the implementation manners in the related art, and the present disclosure does not make specific limitations thereon.

[0034] In a possible implementation manner, the initial shadow mask is a shadow mask in the YUV color space; the method further includes: segmenting the initial shadow of the object to be rendered to determine a shadow mask in the RGB color space; performing a color gamut conversion on the shadow mask in the RGB color space to determine the initial shadow mask and the shadow starting point.

[0035] In order to reduce the amount of data to be processed during soft shadow rendering and improve the efficiency of soft shadow rendering, taking advantage of the characteristic that the YUV color space can effectively reduce the amount of data while maintaining the image quality, soft shadow rendering can be first performed in the YUV color space to obtain a soft shadow rendering result in the YUV color space, and then a color gamut conversion is performed on the shadow rendering result to obtain a soft shadow rendering result in the RGB color space. Therefore, the initial shadow mask can be set as a shadow mask in the YUV color space.

[0036] Specifically, in the RGB color space, the initial shadow (i.e., the hard shadow) of the object to be rendered can be segmented to determine a shadow mask in the RGB color space. The specific method for image segmentation can refer to the implementation manners in the related art. For example, image segmentation methods based on deep learning, threshold segmentation methods, etc., and the present disclosure does not make specific limitations thereon.

[0037] Furthermore, a color gamut conversion can be performed on the shadow mask in the RGB color space to obtain an initial shadow mask in the YUV color space, and a shadow starting point is determined in the initial shadow mask. The specific method for color gamut conversion can refer to the implementation manners in the related art. For example, a conversion method using a linear formula, or a conversion method based on deep learning, etc., and the present disclosure does not make specific limitations thereon. The selection of the shadow starting point can be flexibly set according to actual usage requirements, and the present disclosure does not make specific limitations thereon; preferably, the shadow starting point can be selected as the intersection point of the initial shadow mask and the object to be rendered.

[0038] The light direction corresponding to the object to be rendered can represent the direction from the light source set in the computer graphics display scene to the object to be rendered. Preferably, in order to reduce the amount of data to be processed during soft shadow rendering and improve the efficiency of soft shadow rendering, the light directions at different positions on the object to be rendered can be set to the same fixed direction.

[0039] The current diffusion starting point can be any pixel point that has been confirmed to meet the preset shadow diffusion conditions, or the shadow starting point corresponding to the object to be rendered. The candidate pixel point can be any pixel point in the computer graphics display scene. According to the initial shadow mask corresponding to the object to be rendered, the light direction, the position corresponding to the current diffusion starting point, and the position corresponding to the candidate pixel point, the diffusion analysis result corresponding to the candidate pixel point can be determined to judge whether the candidate pixel point meets the shadow diffusion conditions, and determine whether it is necessary to diffuse and blur the initial shadow of the object to be rendered at the candidate pixel point. Among them, the specific content of the shadow diffusion conditions can be flexibly set according to actual usage requirements, and the present disclosure does not make specific limitations thereon.

[0040] Figure 2 FIG. shows a schematic diagram of a soft shadow rendering process according to an embodiment of the present disclosure. As Figure 2 shown, taking the shadow starting point P0(x0, y0) as the first current diffusion starting point, the pixel point P1(x1, y1) can be determined as the candidate pixel point; in the case where it has been confirmed that the pixel point P1(x1, y1) meets the shadow diffusion conditions, the pixel point P2(x2, y2) can be determined as the candidate pixel point; in the case where it is confirmed that the pixel point P2(x2, y2) meets the shadow diffusion conditions, the pixel point P3(x3, y2) can be determined as the candidate pixel point.

[0041] The process of determining the diffusion analysis result corresponding to the candidate pixel point according to the initial shadow mask corresponding to the object to be rendered, the light direction, the position corresponding to the current diffusion starting point, and the position corresponding to the candidate pixel point will be described in detail later in combination with possible implementation manners of the present disclosure, and will not be elaborated here.

[0042] In step S102, when the diffusion analysis result indicates that the candidate pixel point meets the shadow diffusion conditions, according to the position of the candidate pixel point and the position of the shadow starting point, the diffusion coefficient corresponding to the candidate pixel point is determined.

[0043] When the diffusion analysis result indicates that the candidate pixel point meets the shadow diffusion conditions, it can be determined that it is necessary to diffuse and blur the hard shadow of the object to be rendered at the candidate pixel point. That is to say, the candidate pixel point is a pixel point located in the soft shadow area of the object to be rendered. Specifically, the diffusion coefficient corresponding to the candidate pixel point can be determined according to the position of the candidate pixel point and the position of the shadow starting point of the object to be rendered. Among them, the diffusion coefficient corresponding to the candidate pixel point is used to adjust the pixel value of the candidate pixel point. The specific form of the diffusion coefficient and the specific method for determining the diffusion coefficient can be flexibly set according to actual usage requirements, and the present disclosure does not make specific limitations thereon.

[0044] In a possible implementation, when the diffusion analysis result indicates that the candidate pixel satisfies the shadow diffusion condition, the diffusion coefficient corresponding to the candidate pixel is determined according to the position of the candidate pixel and the position of the shadow starting point, including: determining the diffusion distance corresponding to the candidate pixel according to the position of the candidate pixel and the position of the shadow starting point; and determining the diffusion coefficient according to the diffusion distance and a preset increasing function.

[0045] Specifically, the diffusion distance corresponding to the candidate pixel can be determined according to the position of the candidate pixel and the position of the shadow starting point; and the diffusion coefficient corresponding to the candidate pixel can be determined by inputting the diffusion distance into the preset increasing function.

[0046] Specifically, taking the above Figure 2 as an example, as Figure 2 shown, when the candidate pixel is pixel P1(x1, y1) and pixel P1(x1, y1) satisfies the shadow diffusion condition, the diffusion coefficient corresponding to pixel P1(x1, y1) can be expressed by formula (1):

[0047]

[0048] where α represents the diffusion coefficient corresponding to pixel P1(x1, y1); d represents the distance between pixel P1(x1, y1) and the shadow starting point P0(x0, y0); f(d) represents the increasing function, and its specific form can be flexibly set according to actual usage requirements. For example, the increasing function f(d) = d 2 can be set, or the increasing function f(d) = d 3 etc. The present disclosure does not make specific limitations in this regard.

[0049] In step S103, the target pixel value corresponding to the candidate pixel is determined according to the diffusion coefficient and the initial pixel value corresponding to the candidate pixel, and the candidate pixel is determined as the new diffusion starting point. Based on the breadth-first traversal algorithm, new candidate pixels are determined, and the above steps are iteratively executed until a preset termination condition is met.

[0050] According to the diffusion coefficient, the initial pixel value corresponding to the candidate pixel can be adjusted to determine the target pixel value corresponding to the candidate pixel, thereby realizing the diffusion and blurring of the hard shadow of the object to be rendered at the candidate pixel. Among them, the specific manner of adjusting the initial pixel value corresponding to the candidate pixel according to the diffusion coefficient can be flexibly set according to actual usage requirements, and the present disclosure does not make specific limitations in this regard.

[0051] In a possible implementation, the initial pixel value corresponding to the candidate pixel may include: the initial luminance value and the initial chrominance value corresponding to the candidate pixel in the YUV color space.

[0052] Based on the diffusion coefficient and the initial pixel value corresponding to the candidate pixel, determining the target pixel value corresponding to the candidate pixel may include: According to the diffusion coefficient and the target luminance value corresponding to the current diffusion starting point in the YUV color space, the initial luminance value corresponding to the candidate pixel can be adjusted in the Y channel to determine the target luminance value corresponding to the candidate pixel in the YUV color space; According to the diffusion coefficient and the target chrominance value corresponding to the current diffusion starting point in the YUV color space, the initial chrominance values corresponding to the candidate pixel are adjusted in the U channel and the V channel to determine the target chrominance value corresponding to the candidate pixel in the YUV color space.

[0053] Specifically, the target luminance value and the target chrominance value corresponding to the candidate pixel in the YUV color space can be expressed by formula (2):

[0054]

[0055] Wherein, α represents the diffusion coefficient corresponding to the candidate pixel P1(x1, y1); Y1(x1, y1) represents the target luminance value corresponding to the candidate pixel P1(x1, y1); U1(x1, y1) represents the target chrominance value corresponding to the candidate pixel P1(x1, y1) in the U channel; V1(x1, y1) represents the target chrominance value corresponding to the candidate pixel P1(x1, y1) in the V channel; Y(x0, y0) represents the target luminance value corresponding to the current diffusion starting point P0(x0, y0); U(x0, y0) represents the target chrominance value corresponding to the current diffusion starting point P0(x0, y0) in the U channel; V(x0, y0) represents the target chrominance value corresponding to the current diffusion starting point P0(x0, y0) in the V channel; Y0(x1, y1) represents the initial luminance value corresponding to the candidate pixel P1(x1, y1); U0(x1, y1) represents the initial chrominance value corresponding to the candidate pixel P1(x1, y1) in the U channel; V0(x1, y1) represents the initial chrominance value corresponding to the candidate pixel P1(x1, y1) in the V channel.

[0056] After determining the target pixel value corresponding to the candidate pixel, the candidate pixel can be determined as the new diffusion starting point, and new candidate pixels can be determined based on the breadth-first traversal algorithm, and the above steps are iteratively executed until a preset termination condition is met. Among them, for the specific form of implementing the breadth-first traversal algorithm, reference can be made to the implementation manners in related technologies, and the present disclosure does not make specific limitations thereto.

[0057] The specific content of the preset termination condition can be flexibly set according to actual usage requirements. For example, the preset termination condition can be set to traverse all pixel points in the computer graphics display scene where the object to be rendered is located, or the preset termination condition can be set to the number of pixel points that have been determined to meet the shadow diffusion condition meets a preset number, etc. The present disclosure does not make specific limitations on this.

[0058] In step S104, according to the target pixel values corresponding to all pixel points that meet the shadow diffusion condition, the first target shadow corresponding to the object to be rendered is determined.

[0059] After completing the breadth-first traversal, the first target shadow with a soft edge can be rendered according to the target pixel values corresponding to all pixel points that meet the shadow diffusion condition, achieving a soft shadow effect similar to ray tracing. Among them, the specific method for determining the first target shadow corresponding to the object to be rendered can be flexibly set according to actual usage requirements, and the present disclosure does not make specific limitations on this.

[0060] Subsequently, in combination with possible implementation manners of the present disclosure, the process of determining the first target shadow corresponding to the object to be rendered according to the target pixel values corresponding to all pixel points that meet the shadow diffusion condition will be described in detail.

[0061] In the embodiment of the present disclosure, after determining any pixel point that has been confirmed to meet the shadow diffusion condition or the shadow starting point corresponding to the object to be rendered as the current diffusion starting point, the diffusion analysis result corresponding to the candidate pixel point can be determined according to the initial shadow mask corresponding to the object to be rendered, the light direction, the position corresponding to the current diffusion starting point, and the position corresponding to the candidate pixel point, so as to indicate whether the candidate pixel point meets the preset shadow diffusion condition, thereby determining whether it is necessary to diffuse and blur the initial shadow of the object to be rendered at the candidate pixel point. When the diffusion analysis result indicates that the candidate pixel point meets the shadow diffusion condition, the diffusion coefficient corresponding to the candidate pixel point can be determined according to the position of the candidate pixel point and the position of the shadow starting point, and the target pixel value corresponding to the candidate pixel point can be determined according to the diffusion coefficient and the initial pixel value corresponding to the candidate pixel point, so as to realize the inverse gradient growth of the hard shadow of the object to be rendered along the light direction. After determining the candidate pixel point as the new diffusion starting point, new candidate pixel points can be determined based on the breadth-first traversal algorithm, and the above steps can be iteratively executed until the preset termination condition is met, thereby determining the first target shadow corresponding to the object to be rendered according to the target pixel values corresponding to all pixel points that meet the shadow diffusion condition, realizing the diffusion and blurring of the hard shadow, generating a gradient and soft shadow edge, and obtaining a visual effect similar to ray tracing to simulate the natural and real projection effect in the real world.

[0062] In a possible implementation, according to the initial shadow mask corresponding to the object to be rendered, the light direction, the position corresponding to the current diffusion starting point, and the position corresponding to the candidate pixel, determine the diffusion analysis result corresponding to the candidate pixel, including: determining the position analysis result corresponding to the candidate pixel according to the position corresponding to the current diffusion starting point, the position corresponding to the candidate pixel, and the light direction, where the position analysis result is used to indicate whether the candidate pixel is located within the diffusion region determined by the shadow starting point and the light direction; in the case where the position analysis result indicates that the candidate pixel is located within the diffusion region, determine the diffusion analysis result according to the initial shadow mask, the position corresponding to the candidate pixel, and the initial pixel value corresponding to the candidate pixel.

[0063] Specifically, according to the position corresponding to the current diffusion starting point, the position corresponding to the candidate pixel, and the light direction, the position analysis result corresponding to the candidate pixel can be determined to indicate whether the candidate pixel is located within the diffusion region determined by the shadow starting point and the light direction, so as to make a preliminary judgment on whether hard shadow diffusion needs to be performed on the candidate pixel in the position dimension. Among them, the specific form of the diffusion region can be flexibly set according to actual usage requirements, and the present disclosure does not make specific limitations on this.

[0064] Taking the above Figure 2 as an example, as Figure 2 shown, taking the shadow starting point P0(x0, y0) as the origin and the light direction as the normal, a semi-circular diffusion region can be determined. It should be noted that this diffusion region is not a region with a fixed size and can be extended in the computer graphics display scene where the object to be rendered is located according to actual usage requirements.

[0065] The specific method for determining the position analysis result corresponding to the candidate pixel can be flexibly set according to actual usage requirements, and the present disclosure does not make specific limitations on this.

[0066] In a possible implementation, according to the position corresponding to the current diffusion starting point, the position corresponding to the candidate pixel, and the light direction, determine the position analysis result corresponding to the candidate pixel, including: in the case where the candidate pixel is located within the screen space corresponding to the object to be rendered, determine the diffusion vector corresponding to the candidate pixel according to the position corresponding to the candidate pixel and the position corresponding to the current diffusion starting point; determine the position analysis result corresponding to the candidate pixel according to the diffusion vector corresponding to the candidate pixel and the light direction.

[0067] Among them, the screen space of the object to be rendered can represent the area that can currently be displayed on the display device in the computer graphics display scene where the object to be rendered is located, and its specific form can be flexibly set according to actual usage requirements, and the present disclosure does not make specific limitations on this.

[0068] In one example, when the computer graphics display scene where the object to be rendered is located is a game scene and the object to be rendered is an NPC in the game, the screen space of the object to be rendered can be the area where the player can see the NPC on the display device.

[0069] When the candidate pixel point is located within the screen space corresponding to the object to be rendered, the diffusion vector corresponding to the candidate pixel point can be determined according to the position corresponding to the candidate pixel point and the position corresponding to the current diffusion starting point. Furthermore, in combination with the light direction corresponding to the object to be rendered the position analysis result corresponding to the candidate pixel point is determined. Specifically, usually, the angle between the shadow projection direction (i.e., the direction from the object to be rendered to the shadow area) and the light direction corresponding to the object to be rendered is less than or equal to 90°, and this direction relationship can be expressed by the vector operation as formula (3):

[0070]

[0071] where, · represents the vector dot product operation.

[0072] Based on this principle, the diffusion vector corresponding to the candidate pixel point can be calculated and the dot product between the light direction corresponding to the object to be rendered is calculated. When the dot product result is greater than or equal to 0, it is determined that the position analysis result corresponding to the candidate pixel point indicates that the candidate pixel point is located within the diffusion area determined by the shadow starting point and the light direction.

[0073] When the position analysis result indicates that the candidate pixel point is located within the diffusion area, if the candidate pixel point is located within the shadow area of the initial shadow mask, there is no need to perform shadow diffusion at the candidate pixel point; if the candidate pixel point is located within the non-shadow area of the initial shadow mask, however, the pixel value corresponding to the candidate pixel point is close to the pixel value corresponding to the current diffusion starting point, based on the characteristic of the edge gradient of the soft shadow, it can be judged that both the candidate pixel point and the current pixel point are already located at the boundary of the soft shadow, and there is no need to perform shadow diffusion anymore.

[0074] Based on the above principle, according to the initial shadow mask, the position corresponding to the candidate pixel point, and the initial pixel value corresponding to the candidate pixel point, it can be comprehensively judged whether the candidate pixel point meets the shadow diffusion condition from the position dimension and the pixel value dimension, so as to determine the diffusion analysis result corresponding to the candidate pixel point; its specific process depends on the specific content of the shadow diffusion condition and can be flexibly set according to the actual usage requirements.

[0075] In a possible implementation, the initial pixel value corresponding to the candidate pixel includes: the initial luminance value corresponding to the candidate pixel in the YUV color space. The shadow diffusion condition includes: the difference between the initial luminance value corresponding to the candidate pixel and the luminance value corresponding to the current diffusion start point in the YUV color space is less than or equal to a preset threshold, and the candidate pixel is located in the non-shadow area of the initial shadow mask.

[0076] Since the luminance and chrominance in the YUV color space are completely decoupled, setting the initial pixel value corresponding to the candidate pixel to include its initial luminance value in the YUV color space can reduce the data processing complexity for determining the diffusion analysis result and improve the data processing efficiency. Correspondingly, the shadow diffusion condition can be set to include: the difference between the initial luminance value corresponding to the candidate pixel and the luminance value corresponding to the current diffusion start point in the YUV color space is less than or equal to a preset threshold, and the candidate pixel is located in the non-shadow area of the initial shadow mask.

[0077] In a possible implementation, the target pixel value corresponding to the candidate pixel includes: the target luminance value and the target chrominance value corresponding to the candidate pixel in the YUV color space. The first target shadow corresponding to the object to be rendered is a shadow in the RGB color space; determining the first target shadow corresponding to the object to be rendered according to the target pixel values corresponding to all diffusion points includes: determining the second target shadow corresponding to the object to be rendered in the YUV color space according to the target pixel values corresponding to all diffusion points; performing a color gamut conversion on the second target shadow to determine the first target shadow.

[0078] According to the target pixel values corresponding to all diffusion points, a preliminary shadow rendering of the object to be rendered can be performed in the YUV color space to determine the corresponding second target shadow, and then a color gamut conversion from the YUV color space to the RGB color space is performed on the second target shadow to obtain the first target shadow. Among them, the specific method of color gamut conversion can refer to the implementation in related technologies, and the present disclosure does not make specific limitations on this.

[0079] In an embodiment of the present disclosure, after determining any pixel point that has been confirmed to meet the shadow diffusion condition or the shadow starting point corresponding to the object to be rendered as the current diffusion starting point, the diffusion analysis result corresponding to the candidate pixel point can be determined according to the initial shadow mask corresponding to the object to be rendered, the light direction, the position corresponding to the current diffusion starting point, and the position corresponding to the candidate pixel point, so as to indicate whether the candidate pixel point meets the preset shadow diffusion condition, thereby determining whether it is necessary to diffuse and blur the initial shadow of the object to be rendered at the candidate pixel point. When the diffusion analysis result indicates that the candidate pixel point meets the shadow diffusion condition, the diffusion coefficient corresponding to the candidate pixel point can be determined according to the position of the candidate pixel point and the position of the shadow starting point, and the target pixel value corresponding to the candidate pixel point can be determined according to the diffusion coefficient and the initial pixel value corresponding to the candidate pixel point, so as to realize the inverse gradient growth of the hard shadow of the object to be rendered along the light direction. After determining the candidate pixel point as the new diffusion starting point, new candidate pixel points can be determined based on the breadth-first traversal algorithm, and the above steps can be iteratively executed until a preset termination condition is met. Thus, according to the target pixel values corresponding to all pixel points that meet the shadow diffusion condition, the first target shadow corresponding to the object to be rendered can be determined, realizing the diffusion and blurring of the hard shadow, generating a gradient and soft shadow edge, and obtaining a ray-tracing-like visual effect to simulate the natural and real projection effect in the real world.

[0080] It can be understood that the above-mentioned method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not elaborate further. Those skilled in the art can understand that in the above method of the specific implementation manner, the specific execution order of each step should be determined according to its function and possible internal logic.

[0081] In addition, the present disclosure also provides a soft shadow rendering device, an electronic device, a computer-readable storage medium, and a program, all of which can be used to implement any soft shadow rendering method provided by the present disclosure. The corresponding technical solutions and descriptions can be referred to the corresponding records in the method part and will not be elaborated further.

[0082] Figure 3 The block diagram of a soft shadow rendering device according to an embodiment of the present disclosure is shown. As Figure 3 shown, the device 300 includes:

[0083] A diffusion determination module 301, configured to determine a diffusion analysis result corresponding to a candidate pixel point according to an initial shadow mask corresponding to an object to be rendered, a light direction, a position corresponding to a current diffusion starting point, and a position corresponding to the candidate pixel point, where the diffusion analysis result is used to indicate whether the candidate pixel point meets a preset shadow diffusion condition, and the current diffusion starting point is any pixel point that has been confirmed to meet the shadow diffusion condition or the shadow starting point corresponding to the object to be rendered;

[0084] A diffusion coefficient determination module 302, configured to determine a diffusion coefficient corresponding to a candidate pixel point according to the position of the candidate pixel point and the position of the shadow starting point when the diffusion analysis result indicates that the candidate pixel point satisfies the shadow diffusion condition;

[0085] A pixel point traversal module 303, configured to determine a target pixel value corresponding to the candidate pixel point according to the diffusion coefficient and the initial pixel value corresponding to the candidate pixel point, determine the candidate pixel point as a new diffusion starting point, determine new candidate pixel points based on the breadth-first traversal algorithm, and iteratively execute the above steps until a preset termination condition is satisfied;

[0086] A shadow rendering module 304, configured to determine a first target shadow corresponding to the object to be rendered according to the target pixel values corresponding to all pixel points that satisfy the shadow diffusion condition.

[0087] In a possible implementation manner, the diffusion determination module 301 is specifically configured to: determine a position analysis result corresponding to the candidate pixel point according to the position corresponding to the current diffusion starting point, the position corresponding to the candidate pixel point, and the light direction, where the position analysis result is used to indicate whether the candidate pixel point is located in the diffusion region determined by the shadow starting point and the light direction; when the position analysis result indicates that the candidate pixel point is located in the diffusion region, determine the diffusion analysis result according to the initial shadow mask, the position corresponding to the candidate pixel point, and the initial pixel value corresponding to the candidate pixel point.

[0088] In a possible implementation manner, the diffusion determination module 301 is specifically configured to: when the candidate pixel point is located in the screen space corresponding to the object to be rendered, determine a diffusion vector corresponding to the candidate pixel point according to the position corresponding to the candidate pixel point and the position corresponding to the current diffusion starting point; determine a position analysis result corresponding to the candidate pixel point according to the diffusion vector corresponding to the candidate pixel point and the light direction.

[0089] In a possible implementation manner, the initial pixel value corresponding to the candidate pixel point includes: an initial luminance value corresponding to the candidate pixel point in the YUV color space, and the shadow diffusion condition includes: the difference between the initial luminance value corresponding to the candidate pixel point and the luminance value corresponding to the current diffusion starting point in the YUV color space is less than or equal to a preset threshold, and the candidate pixel point is located in the non-shadow region of the initial shadow mask.

[0090] In a possible implementation manner, the diffusion coefficient determination module 302 is specifically configured to: determine a diffusion distance corresponding to the candidate pixel point according to the position of the candidate pixel point and the position of the shadow starting point; determine the diffusion coefficient according to the diffusion distance and a preset increasing function.

[0091] In a possible implementation, the initial shadow mask is a shadow mask in the YUV color space; the device 300 further includes a shadow mask segmentation module for: segmenting the initial shadow of the object to be rendered to determine a shadow mask in the RGB color space; performing a color gamut conversion on the shadow mask in the RGB color space to determine the initial shadow mask and the shadow starting point.

[0092] In a possible implementation, the target pixel value corresponding to the candidate pixel point includes: the target luminance value and the target chrominance value corresponding to the candidate pixel point in the YUV color space, and the first target shadow corresponding to the object to be rendered is a shadow in the RGB color space; the shadow rendering module 304 is specifically configured to: determine a second target shadow corresponding to the object to be rendered in the YUV color space according to the target pixel values corresponding to all the diffusion points; perform a color gamut conversion on the second target shadow to determine the first target shadow.

[0093] In some embodiments, the functions or modules included in the device provided in the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments, and their specific implementations can refer to the descriptions of the above method embodiments. For the sake of brevity, they will not be elaborated here.

[0094] The embodiments of the present disclosure also propose a display chip, which is used to implement the above soft shadow rendering method, or includes at least one of the above soft shadow rendering devices.

[0095] The embodiments of the present disclosure also propose a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above method is implemented. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0096] The embodiments of the present disclosure also propose an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein, the processor is configured to implement the above method when executing the instructions stored in the memory.

[0097] Exemplarily, the electronic device in this embodiment includes, but is not limited to, a desktop computer, a television, a mobile device with a large screen such as a mobile phone, a tablet computer, and other common electronic devices that require multiple chip-level cascade connections to achieve driving.

[0098] Exemplarily, the electronic device may also be a user equipment (UE), a mobile device, a user terminal, a terminal, a handheld device, a computing device, or a vehicle-mounted device, etc. Exemplarily, some examples of terminals are: a display, a smart phone or a portable device, a mobile phone, a tablet computer, a laptop computer, a palmtop computer, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, a wireless terminal in vehicle-to-everything, etc. For example, the server may be a local server or a cloud server.

[0099] Figure 4 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. For example, the electronic device 1900 may be provided as a server or a terminal device. Referring to Figure 4 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by a memory 1932 for storing instructions executable by the processing component 1922, such as application programs. The application programs stored in the memory 1932 may include one or more modules each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0100] The electronic device 1900 may further include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.

[0101] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, and the computer program instructions can be executed by a processing component 1922 of the electronic device 1900 to complete the above method.

[0102] The above description is only an exemplary embodiment of the present invention and is not intended to limit the protection scope of the present invention. The protection scope of the present invention is determined by the appended claims.

[0103] The special term "exemplary" here means "serving as an example, embodiment, or illustration". Any embodiment described as "exemplary" here does not have to be construed as superior to or better than other embodiments.

[0104] It should be noted that in this article, the terms "including", "comprising", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the presence of additional identical elements in the process, method, article, or device including the element.

[0105] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to multiple embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of an instruction, and the module, segment of a program, or part of an instruction contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions marked in the block may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combinations of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0106] The embodiments of the present disclosure have been described above. The above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations are obvious to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, the practical application, or the improvement of technologies in the market, or to enable other ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A soft shadow rendering method, characterized in that: include: Determine, according to the initial shadow mask and light direction corresponding to the object to be rendered, the position corresponding to the current diffusion starting point and the position corresponding to the candidate pixel, the diffusion analysis result corresponding to the candidate pixel, wherein the diffusion analysis result is used to indicate whether the candidate pixel satisfies a preset shadow diffusion condition, and the current diffusion starting point is any pixel that has been confirmed to satisfy the shadow diffusion condition, or the shadow starting point corresponding to the object to be rendered; When the diffusion analysis result indicates that the candidate pixel satisfies the shadow diffusion condition, determining a diffusion coefficient corresponding to the candidate pixel according to a position of the candidate pixel and a position of the shadow starting point; Determine the target pixel value corresponding to the candidate pixel point according to the diffusion coefficient and the initial pixel value corresponding to the candidate pixel point, determine the candidate pixel point as a new diffusion starting point, determine a new candidate pixel point based on a breadth-first traversal algorithm, and iterate the above steps until a preset termination condition is met; A first target shadow corresponding to the object to be rendered is determined according to target pixel values ​​corresponding to all pixel points that meet the shadow diffusion condition.

2. The method according to claim 1, characterized in that The step of determining the diffusion analysis result corresponding to the candidate pixel point according to the initial shadow mask and the light direction corresponding to the object to be rendered, the position corresponding to the current diffusion starting point, and the position corresponding to the candidate pixel point includes: Determine a position analysis result corresponding to the candidate pixel point according to the position corresponding to the current diffusion starting point, the position corresponding to the candidate pixel point, and the light direction, wherein the position analysis result is used to indicate whether the candidate pixel point is located in the diffusion area determined by the shadow starting point and the light direction; When the position analysis result indicates that the candidate pixel is located within the diffusion area, the diffusion analysis result is determined according to the initial shadow mask, the position corresponding to the candidate pixel, and the initial pixel value corresponding to the candidate pixel.

3. The method according to claim 2, characterized in that The determining the position analysis result corresponding to the candidate pixel point according to the position corresponding to the current diffusion starting point, the position corresponding to the candidate pixel point, and the light direction includes: When the candidate pixel point is located in the screen space corresponding to the object to be rendered, determining a diffusion vector corresponding to the candidate pixel point according to a position corresponding to the candidate pixel point and a position corresponding to the current diffusion starting point; The position analysis result corresponding to the candidate pixel point is determined according to the diffusion vector corresponding to the candidate pixel point and the light direction.

4. The method according to any one of claims 1 to 3, characterized in that The initial pixel value corresponding to the candidate pixel point includes: the initial brightness value corresponding to the candidate pixel point in the YUV color space, and the shadow diffusion condition includes: the difference between the initial brightness value corresponding to the candidate pixel point and the brightness value corresponding to the current diffusion starting point in the YUV color space is less than or equal to a preset threshold, and the candidate pixel point is located in the non-shadow area of ​​the initial shadow mask.

5. The method according to any one of claims 1 to 3, characterized in that: When the diffusion analysis result indicates that the candidate pixel satisfies the shadow diffusion condition, determining the diffusion coefficient corresponding to the candidate pixel according to the position of the candidate pixel and the position of the shadow starting point includes: Determine the diffusion distance corresponding to the candidate pixel point according to the position of the candidate pixel point and the position of the shadow starting point; The diffusion coefficient is determined according to the diffusion distance and a preset increasing function.

6. The method according to any one of claims 1 to 3, characterized in that: The initial shadow mask is a shadow mask in a YUV color space; The method further comprises: Segmenting the initial shadow of the object to be rendered to determine a shadow mask in an RGB color space; Performing color gamut conversion on the shadow mask in the RGB color space, and determining the initial shadow mask and the shadow starting point.

7. The method according to any one of claims 1 to 3, characterized in that: The target pixel value corresponding to the candidate pixel point includes: a target brightness value and a target chromaticity value corresponding to the candidate pixel point in a YUV color space, and the first target shadow corresponding to the object to be rendered is a shadow in an RGB color space; The determining, according to the target pixel values ​​corresponding to all the diffusion points, a first target shadow corresponding to the object to be rendered includes: Determine, according to the target pixel values ​​corresponding to all the diffusion points, a second target shadow corresponding to the object to be rendered in the YUV color space; Performing color gamut conversion on the second target shadow to determine the first target shadow.

8. A soft shadow rendering device, characterized in that: include: a diffusion determination module, used to determine the diffusion analysis result corresponding to the candidate pixel point according to the initial shadow mask and light direction corresponding to the object to be rendered, the position corresponding to the current diffusion starting point and the position corresponding to the candidate pixel point, wherein the diffusion analysis result is used to indicate whether the candidate pixel point meets the preset shadow diffusion condition, and the current diffusion starting point is any pixel point that has been confirmed to meet the shadow diffusion condition, or the shadow starting point corresponding to the object to be rendered; a diffusion coefficient determination module, configured to determine the diffusion coefficient corresponding to the candidate pixel point according to the position of the candidate pixel point and the position of the shadow starting point when the diffusion analysis result indicates that the candidate pixel point satisfies the shadow diffusion condition; A pixel traversal module is used to determine the target pixel value corresponding to the candidate pixel according to the diffusion coefficient and the initial pixel value corresponding to the candidate pixel, determine the candidate pixel as a new diffusion starting point, determine a new candidate pixel based on a breadth-first traversal algorithm, and iterate the above steps until a preset termination condition is met; The shadow rendering module is used to determine a first target shadow corresponding to the object to be rendered according to target pixel values ​​corresponding to all pixel points that meet the shadow diffusion condition.

9. A display chip, characterized in that: The display chip is used to implement the soft shadow rendering method according to any one of claims 1 to 7, or includes at least one soft shadow rendering device according to claim 8.

10. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to implement the method described in any one of claims 1 to 7 when executing the instructions stored in the memory.

11. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.