Shadow rendering method and device, equipment and storage medium

By predicting the shadow intensity of the target point in the virtual scene, the problems of low shadow rendering efficiency and low quality are solved, and efficient and reliable shadow rendering effect is achieved.

CN119295361APending Publication Date: 2025-01-10SHENZHEN TENCENT FEITAI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411321996.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

In the prior art, shadow rendering efficiency is low and the quality is not high, mainly due to the low efficiency of manual analysis of shadow intensity and poor reliability of the result.

Method used

By obtaining the scene information of the virtual scene and the point information of the target point, predict the shadow intensity of the target point under the combined influence of light intensity and transmission degree, and directly obtain the shadow rendering results to avoid manual analysis.

Benefits of technology

Improves the efficiency and quality of shadow rendering, ensures the reliability of shadow intensity, and enhances the reliability and authenticity of shadow rendering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295361A_ABST
    Figure CN119295361A_ABST
Patent Text Reader

Abstract

The invention discloses a shadow rendering method and device, equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: acquiring scene information of a virtual scene and point information of a target point in the virtual scene; based on the scene information and the point information, the shadow intensity of the target point under the comprehensive influence of the light intensity and the transmission degree is predicted, the light intensity is the intensity of light with the irradiation direction pointing to the target point in the virtual scene, and the transmission degree is the transmission degree of the light on a path pointing to the target point; and obtaining a shadow rendering result of the virtual scene based on the shadow intensity of the target point. On the basis, the efficiency of obtaining the shadow intensity is relatively high, so that the shadow rendering efficiency is improved, the reliability of the determined shadow intensity can be ensured, and the shadow rendering quality is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a shadow rendering method, device, equipment and storage medium. Background Art

[0002] With the development of computer technology, in order to simulate more realistic virtual scenes, computer devices usually perform shadow rendering on virtual scenes in real time to obtain shadow rendering results of the virtual scenes. The shadow rendering results are used to indicate the distribution of shadows in the virtual scenes.

[0003] In the related art, in the process of shadow rendering of a virtual scene, a human analyzes whether an object in the virtual scene is in a shadow based on the scene information of the virtual scene, determines the shadow intensity of a point on the object based on the analysis result, and then obtains the shadow rendering result of the virtual scene based on the shadow intensity of the point on the object.

[0004] The shadow intensity is determined based on the results of manual analysis, which is inefficient and can easily reduce the efficiency of determining the shadow intensity, thereby reducing the efficiency of shadow rendering. In addition, the results of manual analysis are greatly affected by human subjective factors, making it difficult to ensure the reliability of the shadow intensity, thereby easily reducing the quality of shadow rendering. Summary of the invention

[0005] The embodiments of the present application provide a shadow rendering method, apparatus, device and storage medium, which can be used to improve the efficiency and quality of shadow rendering. The technical solution is as follows:

[0006] On the one hand, an embodiment of the present application provides a shadow rendering method, the method comprising:

[0007] Acquire scene information of a virtual scene and point information of a target point in the virtual scene, wherein the target point is a point in the virtual scene where a shadow is to be rendered;

[0008] Based on the scene information and the point information, predict the shadow intensity of the target point under the combined influence of light intensity and transmittance, wherein the light intensity is the intensity of the light in the virtual scene whose illumination direction points to the target point, and the transmittance is the transmittance of the light on the path pointing to the target point;

[0009] Based on the shadow intensity of the target point, a shadow rendering result of the virtual scene is obtained.

[0010] In another aspect, a shadow rendering device is provided, the device comprising:

[0011] A first acquisition module, used to acquire scene information of a virtual scene and point information of a target point in the virtual scene, wherein the target point is a point in the virtual scene where a shadow is to be rendered;

[0012] A second acquisition module is used to predict the shadow intensity of the target point under the combined influence of light intensity and transmittance based on the scene information and the point information, wherein the light intensity is the intensity of the light in the virtual scene whose illumination direction points to the target point, and the transmittance is the transmittance of the light on the path pointing to the target point;

[0013] The third acquisition module is used to acquire the shadow rendering result of the virtual scene based on the shadow intensity of the target point.

[0014] In a possible implementation, the first acquisition module is also used to determine the original grids used to construct the virtual scene; for any of the original grids, based on the curvature of the original grid, determine the target grid corresponding to the original grid; determine the target point in the grid vertices of the target grid corresponding to the original grid; wherein, when the difference between the curvature of the original grid and the curvature threshold is not greater than the difference threshold, the target grid corresponding to the original grid is the original grid; when the difference between the curvature of the original grid and the curvature threshold is greater than the difference threshold, the target grid corresponding to the original grid is determined based on the subdivided grid, and the subdivided grid is obtained by subdividing the original grid.

[0015] In one possible implementation, the first acquisition module is used to determine a plurality of shadow points relative to the light source in the mesh vertices based on a positional relationship between the mesh vertices and the light source in the virtual scene, and a normal vector corresponding to the mesh vertex, wherein the normal vector is used to indicate an orientation of the mesh vertex in the virtual scene; and determine the target point among the plurality of shadow points.

[0016] In one possible implementation, the first acquisition module is used to determine the shadow probability of the multiple shadow points, and the shadow probability of any shadow point is used to indicate the probability that any shadow point is located in the shadow; and the point among the multiple shadow points whose shadow probability is greater than a probability threshold is taken as the target point.

[0017] In one possible implementation, the first acquisition module is used to sample a first light ray from the light rays whose illumination direction points to any shadow point for any shadow point; determine a first shadow intensity based on a first light intensity of the first light ray and a first transmittance degree of the first light ray on a path pointing to any shadow point; and determine a shadow probability of any shadow point based on the first shadow intensity.

[0018] In one possible implementation, the third acquisition module is used to obtain the softness of the shadow to be rendered at the target point; update the shadow intensity of the target point based on the softness to obtain the updated shadow intensity of the target point; and obtain the shadow rendering result of the virtual scene based on the updated shadow intensity of the target point.

[0019] In one possible implementation, the third acquisition module is used to obtain target lighting information of the target point in the virtual scene and target depth information of the target point in the virtual scene; and call a softness prediction model to predict the softness based on the target lighting information and the target depth information; wherein the softness prediction model is trained based on sample lighting information of the sample point in the sample scene, sample depth information of the sample point in the sample scene, and a standard softness of the shadow to be rendered at the sample point.

[0020] In one possible implementation, the third acquisition module is used to determine the number of times the target point is irradiated by light, the initial sub-intensity of the target point each time it is irradiated by light, and the influencing parameters corresponding to the initial sub-intensity; based on the initial sub-intensity of the target point each time it is irradiated by light and the influencing parameters corresponding to the initial sub-intensity, determine the target sub-intensity each time the target point is irradiated by light; based on the target sub-intensity each time the target point is irradiated by light and the number of times the target point is irradiated by light, determine the target lighting information.

[0021] In one possible implementation, the third acquisition module is used to render a shadow image based on the shadow intensity of the target point, the shadow image including target pixels corresponding to the target point, and the pixel values ​​of the target pixels are determined based on the shadow intensity of the target point; based on the shadow image, a shadow rendering result of the virtual scene is obtained.

[0022] In one possible implementation, the third acquisition module is used to perform at least one of pixel value optimization or shadow edge optimization on the shadow image to obtain an optimized shadow image; the pixel value optimization is used to optimize the pixel values ​​of pixel points in the shadow image; the shadow edge optimization is used to identify the edges of shadows in the shadow image and connect the edges; and the optimized shadow image is used as the shadow rendering result of the virtual scene.

[0023] In one possible implementation, the pixel value optimization includes at least one of averaging, filtering or masking; wherein the averaging is used to replace the pixel value of any pixel in the shadow image with the average value of the pixel values ​​of each pixel in a first reference area where the pixel is located; the filtering is used to replace the pixel value of any pixel in the shadow image with a weighted value of the pixel values ​​of each pixel in a second reference area where the pixel is located; the masking is used to adjust the pixel value of any pixel in the shadow image using a masking coefficient, and the masking coefficient is used to indicate the degree of masking of any pixel by an object in the virtual scene.

[0024] In one possible implementation, the second acquisition module is used to input the scene information and the point information into a shadow intensity prediction model to obtain the shadow intensity of the target point output by the shadow intensity prediction model; the shadow intensity prediction model is used to predict the shadow intensity of the target point under the combined influence of the light intensity and the transmittance based on the scene information and the point information.

[0025] On the other hand, a computer device is provided, comprising a processor and a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the computer device implements any of the above-mentioned shadow rendering methods.

[0026] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor so that a computer implements any of the above-mentioned shadow rendering methods.

[0027] On the other hand, a computer program or a computer program product is also provided, wherein the computer program or the computer program product comprises computer instructions, and the computer instructions are loaded and executed by a processor so that a computer implements any of the above-mentioned shadow rendering methods.

[0028] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:

[0029] The technical solution provided in the embodiment of the present application directly predicts the shadow intensity of the target point based on the scene information and the point information after obtaining the scene information of the virtual scene and the point information of the target point to be rendered with a shadow, without the need for manual analysis, and the efficiency of obtaining the shadow intensity is high, which is conducive to improving the efficiency of shadow rendering. In addition, the shadow intensity of the target point is predicted by comprehensively considering the light intensity and the degree of transmission. The light intensity and the degree of transmission are the main factors affecting the shadow intensity of the target point. Based on this method, the reliability of the determined shadow intensity can be guaranteed, thereby improving the quality of shadow rendering. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0031] Figure 1 is a schematic diagram of the structure of a computer system provided in an embodiment of the present application;

[0032] Figure 2 is a flowchart of a shadow rendering method provided by an embodiment of the present application;

[0033] Figure 3 is a flowchart of another shadow rendering method provided by an embodiment of the present application;

[0034] Figure 4 is a flowchart of another shadow rendering method provided by an embodiment of the present application;

[0035] Figure 5 is a schematic diagram of a shadow rendering process provided by an embodiment of the present application;

[0036] Figure 6 is a flowchart of another shadow rendering method provided by an embodiment of the present application;

[0037] Figure 7 is a structural schematic diagram of a shadow rendering device provided in an embodiment of the present application;

[0038] Figure 8 It is a structural diagram of a server provided in an embodiment of the present application;

[0039] Fig. 9 It is a structural diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0041] Figure 1 The schematic diagram of the structure of the computer system provided in the embodiment of the present application is shown. The computer system may include: a computer device 11.

[0042] The computer device 11 can perform shadow rendering on the virtual scene according to the method provided in the embodiment of the present application to obtain the shadow rendering result of the virtual scene. In the process of performing shadow rendering on the virtual scene according to the method provided in the embodiment of the present application, the computer device 11 first determines the virtual scene to be shadow rendered, and then obtains the scene information of the virtual scene and the point information of the target point in the virtual scene. After obtaining the scene information and the point information, the shadow intensity of the target point under the combined influence of the light intensity and the degree of transmittance is predicted based on the scene information and the point information. After obtaining the shadow intensity of the target point, the shadow rendering result of the virtual scene is obtained based on the shadow intensity of the target point.

[0043] The computer device 11 may be a terminal or a server, which is not limited in the embodiments of the present application. When the computer device 11 is a terminal, after obtaining the shadow rendering result of the virtual scene, the computer device 11 may directly display the shadow rendering result of the virtual scene on the screen. When the computer device 11 is a server, after obtaining the shadow rendering result of the virtual scene, the computer device 11 may send the shadow rendering result of the virtual scene to the terminal, and the terminal may display the shadow rendering result of the virtual scene on the screen.

[0044] Exemplarily, the terminal can be any electronic product that can interact with the user through one or more methods such as keyboard, touchpad, touch screen, remote control, voice interaction or handwriting device, such as PC (Personal Computer), mobile phone, smart phone, PDA (Personal Digital Assistant), wearable device, PPC (Pocket PC), tablet computer, smart car machine, smart TV, smart speaker, car terminal, etc. The server can be a server, a server cluster composed of multiple servers, or a cloud computing service center. The terminal and the server can establish a communication connection through a wired or wireless network.

[0045] Those skilled in the art should understand that the above-mentioned computer device 11 is only an example, and other existing or future terminals or servers that are applicable to the present application should also be included in the protection scope of the present application and are included here by reference.

[0046] The present application embodiment provides a shadow rendering method, which can be applied to the above Figure 1 The computer system shown in FIG. 1 is taken as an example of the method being applied to a computer device. Figure 2 As shown, the shadow rendering method provided in the embodiment of the present application may include the following steps 201 to 203.

[0047] In step 201, scene information of a virtual scene and point information of a target point in the virtual scene are obtained, where the target point is a point in the virtual scene where a shadow is to be rendered.

[0048] The virtual scene is a scene to be rendered with shadows in the embodiment of the present application. The virtual scene can be a simulation of the real world, a semi-simulated and semi-fictitious three-dimensional world, or a purely fictitious three-dimensional world. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, and a three-dimensional virtual scene. The embodiment of the present application is described by taking the virtual scene as a three-dimensional virtual scene as an example. The three-dimensional virtual scene can be used to simulate a three-dimensional virtual space, and the three-dimensional virtual space can be an open space. The virtual scene can be used to simulate a real environment in reality. For example, the virtual scene may include the sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities.

[0049] The virtual scene may also include virtual objects, such as virtual objects, virtual throwing objects, virtual buildings, virtual vehicles, and props used by virtual objects in the virtual scene to arm themselves or fight with other virtual objects. The virtual scene may also be used to simulate real environments in different weather conditions, such as real environments in sunny, rainy, foggy or snowy weather conditions. Various scene elements enhance the diversity and authenticity of the virtual scene.

[0050] Exemplarily, the virtual scene can be the scene displayed by the terminal when the client is running. The embodiment of the present application does not limit the type of the client, as long as the client supports the virtual scene. Exemplarily, the client can include but is not limited to VR (Virtual Reality) client, AR (Augmented Reality) client, 3D map client, game client, social client, interactive entertainment client, etc.

[0051] In an embodiment of the present application, there are one or more light sources in the virtual scene. Under the influence of the one or more light sources, there will be shadows in the virtual scene. By rendering the shadows of the virtual scene, the distribution of the shadows in the virtual scene can be determined to improve the authenticity of the rendering results of the virtual scene.

[0052] The scene information of a virtual scene is information used to characterize the virtual scene. For example, the scene information of a virtual scene is used to describe information such as the distribution of light sources in the virtual scene, the distribution of virtual objects in the virtual scene, and the materials of virtual objects in the virtual scene. A virtual object refers to an object in a virtual scene that affects the light of a light source (e.g., transmission, reflection, refraction, etc.).

[0053] Exemplarily, a client supporting a virtual scene may provide a developer tool, through which scene information of the virtual scene may be extracted.

[0054] Exemplarily, the scene information of the virtual scene may be pre-stored as a kind of attribute information of the virtual scene. After the virtual scene to be rendered with shadows is determined, the scene information of the virtual scene may be extracted from the attribute information of the virtual scene.

[0055] In the embodiment of the present application, in addition to obtaining the scene information of the virtual scene, it is also necessary to obtain the point information of the target point in the virtual scene. The target point refers to the point in the virtual scene where the shadow is to be rendered. In other words, the process of shadow rendering the virtual scene is achieved by shadow rendering the target point in the virtual scene.

[0056] Before obtaining the point information of the target point in the virtual scene, the target point needs to be determined first. In one possible implementation, see Figure 3 Before executing step 201, the target point can be determined based on the following steps 301 to 303.

[0057] Step 301: Determine each original grid used to construct a virtual scene.

[0058] Each primitive grid is a grid based on which a virtual scene is constructed, and is used to represent the surface geometry of a virtual object in the virtual scene. The size, shape, position, and orientation of each primitive grid can be defined by the developer of the virtual scene during the construction of the virtual scene.

[0059] Exemplarily, the characterization information of each original grid in the virtual scene is a kind of attribute information of the virtual scene, and the characterization information of each original grid in the virtual scene can be extracted from the attribute information of the virtual scene, and each original grid is determined according to the characterization information of each original grid.

[0060] The characterization information of the original mesh is the information that characterizes the original mesh. Exemplarily, the characterization information of each original mesh may include a set of data sets, which include vertex information, edge information, and face information, wherein the vertex information is used to indicate the information of the vertices of the original mesh, the edge information is used to indicate the information of the edges of the original mesh, and the face information is used to indicate the information of the face on which the original mesh is located. For example, the characterization information of an original mesh can be expressed as M = (V, E, F), wherein V represents the information of the vertices of the original mesh, E represents the information of the edges of the original mesh, and F is used to represent the information of the face on which the original mesh is located. In one embodiment, an original mesh can also be referred to as a mesh model.

[0061] Step 302: for any original mesh among the original meshes, based on the curvature of any original mesh, determine a target mesh corresponding to any original mesh.

[0062] After determining each original mesh, each original mesh is processed to achieve modeling before shadow rendering (also referred to as shadow modeling), and shadow modeling is used to process each original mesh into a mesh suitable for the shadow rendering process. In an embodiment of the present application, the surface where the original mesh is located is a curved surface, and subdivision surfaces (Subdivision Surfaces) technology is used to process each original mesh to improve the quality of shadow modeling. Subdivision surface technology can generate a smooth surface by iteratively subdividing the original mesh. For example, the basic formula of subdivision surface technology can be expressed using the following formula 1:

[0063] S n+1 =Loop(S n )(Formula 1)

[0064] Among them, Loop represents the subdivision rule, S n represents the surface obtained after the nth iteration of subdivision, S n+1 Represents the surface obtained after the n+1th iterative subdivision, where n is a positive integer.

[0065] The principle of using subdivision surface technology to process each original mesh is the same. The embodiment of the present application takes the process of using subdivision surface technology to process any original mesh to obtain a target mesh corresponding to any original mesh as an example to illustrate.

[0066] In the process of processing any original mesh using the subdivision surface technology, the target mesh corresponding to any original mesh is determined based on the curvature of any original mesh. Wherein, when the difference between the curvature of any original mesh and the curvature threshold is not greater than the difference threshold, the target mesh corresponding to any original mesh is any original mesh; when the difference between the curvature of any original mesh and the curvature threshold is greater than the difference threshold, the target mesh corresponding to any original mesh is determined based on the subdivided mesh, and the subdivided mesh is obtained by subdividing any original mesh.

[0067] That is to say, in the process of processing any original mesh using the subdivision surface technology, it is first determined whether the difference between the curvature of any original mesh and the curvature threshold is greater than the difference threshold. The curvature of any original mesh is used to measure the curvature of the surface on which any original mesh is located. The embodiment of the present application does not limit the method for determining the curvature of any original mesh. The curvature threshold is a curvature representing a smaller degree of curvature. The curvature threshold and the difference threshold can be set based on experience, and can also be flexibly adjusted according to the application scenario, which is not limited in the embodiment of the present application.

[0068] Exemplarily, the difference between the curvature of any original grid and the curvature threshold may refer to the absolute value of the difference between the curvature of any original grid and the curvature threshold, or may refer to the difference between the curvature of any original grid and the curvature threshold, or may refer to the difference between the curvature threshold and the curvature of any original grid.

[0069] When the difference between the curvature of any original mesh and the curvature threshold is not greater than the difference threshold, it means that the difference between the curvature of any original mesh and the curvature threshold is small. Since the curvature threshold is a curvature representing a smaller degree of curvature, it means that the curvature of the surface where any original mesh is located is smaller, that is, the surface where any original mesh is located is relatively smooth. At this time, any original mesh is not subdivided, and any original mesh is directly used as the target mesh corresponding to the any original mesh.

[0070] When the difference between the curvature of any original mesh and the curvature threshold is greater than the difference threshold, it means that the difference between the curvature of any original mesh and the curvature threshold is large, which means that the curvature of the surface where any original mesh is located is large, and the surface where any original mesh is located needs to be subdivided to improve the smoothness. At this time, subdivide any original mesh to obtain a subdivided mesh, and then determine the target mesh corresponding to any original mesh based on the subdivided mesh. The embodiment of the present application does not limit the method of subdividing any original mesh, and any subdivision rule can be used to implement it. Exemplarily, the subdivision rule may include but is not limited to the Loop subdivision rule, the Catmull-Clark subdivision rule (a subdivision surface rule), etc.

[0071] Exemplarily, the process of determining the target mesh corresponding to any original mesh based on the subdivided mesh includes: determining whether the difference between the curvature of the subdivided mesh and the curvature threshold is greater than the difference threshold. In the case where the difference between the curvature of the subdivided mesh and the curvature threshold is not greater than the difference threshold, there is no need to further subdivide any subdivided mesh, and the subdivided mesh is directly used as the target mesh corresponding to any original mesh. It should be noted that since the subdivided mesh is obtained by subdividing any original mesh, the number of subdivided meshes is at least two, and the difference between the curvature of the subdivided mesh and the curvature threshold is not greater than the difference threshold, which means that the difference between the curvature of at least two subdivided meshes and the curvature threshold is not greater than the difference threshold.

[0072] Exemplarily, among at least two subdivided grids, there may be one or more subdivided grids whose curvature difference with the curvature threshold is greater than the difference threshold. In this case, the subdivided grids whose curvature difference with the curvature threshold is greater than the difference threshold are further subdivided until the curvature of all subdivided grids differs from the curvature threshold by no more than the difference threshold, and all subdivided grids are used as target grids for any original grid.

[0073] For example, the subdivision surface technology used in the embodiment of the present application can be called an adaptive subdivision surface technology based on error metric. i ), calculate its curvature (K i ) and the defined curvature threshold ∈. If the difference between the curvature and the curvature threshold is greater than the difference threshold δ, that is, |K i -∈|>δ, the original grid needs to be subdivided, and the process can be expressed as “if|K i -∈∣>δ,then refine Fi”.

[0074] Through this error metric-based adaptive subdivision surface technology, on the one hand, the mesh can be subdivided to increase the details of shadow modeling, and on the other hand, by subdividing only the meshes with a large difference between the curvature and the curvature threshold, it can avoid too much computational effort in the shadow modeling process due to too many meshes. In other words, the number of meshes can be reduced without sacrificing details, so that the shadow modeling process takes into account both details and computational effort, so that the shadow rendering quality is guaranteed while avoiding too much computational effort.

[0075] Step 303: Determine the target point among the mesh vertices of the target mesh corresponding to each original mesh.

[0076] According to the method introduced in step 302, the target mesh corresponding to each original mesh can be obtained, and then the target point is determined in the mesh vertices of the target mesh corresponding to each original mesh. The target mesh corresponding to each original mesh is determined based on the adaptive subdivision surface technology of error metric. Compared with the original mesh, the target mesh can represent more details, and the number is not too large. Determining the target point in the mesh vertices of the target mesh is conducive to ensuring the comprehensiveness of the target point and avoiding the excessive number of target points, thereby ensuring the quality of shadow rendering while avoiding increasing too much calculation.

[0077] In an exemplary embodiment, the target point can be determined in the mesh vertices of the target mesh corresponding to each original mesh by using the mesh vertices of the target mesh corresponding to each original mesh as the target point. This method can ensure the comprehensiveness of the target point and fully improve the quality of shadow rendering.

[0078] In an exemplary embodiment, a method of determining a target point in mesh vertices of a target mesh corresponding to each original mesh may include the following steps 3031 and 3032 .

[0079] Step 3031: Based on the positional relationship between the mesh vertex and the light source in the virtual scene, and the normal vector corresponding to the mesh vertex, multiple shadow points relative to the light source are determined in the mesh vertex, and the normal vector is used to indicate the orientation of the mesh vertex in the virtual scene.

[0080] The number of light sources in the virtual scene may be one or more. The process of determining multiple shadow points is described by taking the number of light sources in the virtual scene as one as an example.

[0081] The normal vector corresponding to the mesh vertex is used to indicate the orientation of the mesh vertex in the virtual scene. For example, the normal vector corresponding to the mesh vertex can be automatically generated and saved by the computer device while the mesh vertex is generated, so that the normal vector corresponding to the mesh vertex can be directly extracted and used.

[0082] Exemplarily, the normal vectors corresponding to the mesh vertices are obtained by transforming the initial normal vectors corresponding to the mesh vertices using a transformation matrix, and the initial normal vectors corresponding to the mesh vertices can be automatically generated and saved by a computer device while generating the mesh vertices. The initial normal vectors corresponding to the mesh vertices are the normal vectors corresponding to the mesh vertices in the tangent space, and the normal vectors can simulate more complex surface details of the target mesh. The transformation matrix is ​​a transformation matrix that transforms from the tangent space to the model space, and the model space refers to the space where the virtual scene is located. The transformation matrix can be determined and saved by the computer device in the process of generating the initial normal vectors corresponding to the mesh vertices.

[0083] After the initial normal vector corresponding to the mesh vertex is transformed by the transformation matrix, the normal vector corresponding to the mesh vertex in the model space can be obtained, which is the normal vector based on which the shadow point is determined. For example, the normal vector corresponding to the mesh vertex can be calculated according to the following formula 2:

[0084] N=N′M t (Formula 2)

[0085] Where N represents the normal vector corresponding to the mesh vertex; N′ represents the initial normal vector corresponding to the mesh vertex; M t Represents the transformation matrix from tangent space to model space. For example, the process of determining the normal vector through the above formula 2 can be called the normal mapping process. Through normal mapping, the initial normal vector that simulates more complex surface details can be transformed into the normal vector based on which the shadow point is determined, ensuring the reliability of the normal vector in representing the orientation of the mesh vertex and improving the reliability of the shadow point.

[0086] Exemplarily, the positional relationship between a mesh vertex and a light source in a virtual scene can be represented by a first vector corresponding to the mesh vertex, where the direction of the first vector corresponding to the mesh vertex is the direction from the mesh vertex to the light source, and the length of the first vector corresponding to the mesh vertex is the distance from the mesh vertex to the light source.

[0087] Exemplarily, there are multiple mesh vertices. Based on the positional relationship between the mesh vertices and the light source in the virtual scene, and the normal vectors corresponding to the mesh vertices, the process of determining multiple shadow points relative to the light source in the mesh vertices may include: for any mesh vertex, calculating the dot product result of the first vector corresponding to the any mesh vertex and the normal vector corresponding to the any mesh vertex; if the dot product result is less than 0, treating the any mesh vertex as a shadow point.

[0088] If the dot product result is less than 0, it means that the angle between the first vector corresponding to any mesh vertex and the normal vector corresponding to any mesh vertex is greater than 90 degrees. Since the normal vector corresponding to any mesh vertex is used to indicate the orientation of any mesh vertex in the virtual scene, if the angle between the first vector corresponding to any mesh vertex and the normal vector corresponding to any mesh vertex is greater than 90 degrees, it means that the light source cannot illuminate any mesh vertex, so any mesh vertex is regarded as a shadow point. If the dot product result is greater than or equal to 0, it means that the angle between the first vector corresponding to any mesh vertex and the normal vector corresponding to any mesh vertex is less than or equal to 90 degrees, which also means that the light source can illuminate any mesh vertex, so it is considered that any mesh vertex is not a shadow point. In this way, the shadow point can be determined more accurately to ensure the reliability of the shadow point. In addition, the process of determining the shadow point only needs to consider the normal vector of the mesh vertex and the positional relationship between the mesh vertex and the light source, and the amount of calculation is small, which is conducive to improving the efficiency of determining the shadow point.

[0089] Exemplarily, the process of determining the shadow point can be expressed using Formula 3:

[0090] V s ={p∈M|(pL)N<0}(Formula 3)

[0091] Among them, V s represents the set of shadow points finally determined; p represents the mesh vertex; M represents the target mesh corresponding to each original mesh; (pL) represents the first vector corresponding to the mesh vertex; N represents the normal vector corresponding to the mesh vertex.

[0092] For example, the method for determining shadow points provided in the embodiments of the present application can be considered as an improved shadow point determination technology, which determines shadow points by calculating the relationship between light sources and mesh vertices, which is conducive to improving the efficiency of determining shadow points and ensuring the reliability of shadow points. In some embodiments, shadow points can also be called shadow diffusion points.

[0093] The number of light sources in the virtual scene may also be multiple. In this case, the shadow points relative to each light source are determined respectively, and the set of shadow points relative to each light source is taken as multiple shadow points.

[0094] For example, the process from determining the original mesh in the virtual scene to determining the shadow points can be considered as the whole process of mesh modeling. This mesh modeling process can be regarded as a process of creating a three-dimensional model of the virtual scene using advanced modeling technology, and these models contain enough details to support complex lighting and shadow effects.

[0095] Step 3032: Determine a target point among multiple shadow points.

[0096] The number of shadow points is less than that of mesh vertices. Determining the target point among the shadow points is conducive to reducing the number of target points and improving the efficiency of shadow rendering. In addition, the shadow point is the point where the shadow should be rendered relative to the light source, which is preliminarily determined based on the normal vector of the mesh vertex. Determining the target point among the shadow points can ensure that the determined target point is the point where the shadow should be rendered in theory, ensure the reliability of the target point, and ensure the quality of shadow rendering.

[0097] In an exemplary embodiment, the method of determining the target point from the multiple shadow points may be: all the multiple shadow points are used as the target point. This method can fully ensure the comprehensiveness of the target point and the quality of the target shadow rendering.

[0098] In an exemplary embodiment, a target point may be determined from multiple shadow points by: determining the shadow probabilities of multiple shadow points, where the shadow probability of any shadow point is used to indicate the probability that any shadow point is located in a shadow; and taking a point from among the multiple shadow points whose shadow probability is greater than a probability threshold as the target point. The probability threshold may be set based on experience or may be flexibly adjusted based on the application scenario, and this is not limited in the embodiments of the present application.

[0099] The shadow probability of any shadow point is positively correlated with the probability of any shadow point being in the shadow, that is, the greater the shadow probability of any shadow point, the more likely it is that the shadow point is in the shadow, that is, there is a greater demand for rendering the shadow for any shadow point.

[0100] When determining the target point among the shadow points, only the points whose shadow probability is greater than the probability threshold are used as target points. This can avoid using points with lower shadow probability (i.e., points with lower demand for rendering shadows) as target points, and further reduce the number of target points on the basis of ensuring the reliability of the target points. This can reduce the amount of calculation in the shadow rendering process on the basis of ensuring the reliability of the shadow rendering, thereby improving the efficiency of the shadow rendering.

[0101] The principle of determining the shadow probabilities of multiple shadow points is the same, and the following is explained by taking the process of determining the shadow probability of any shadow point as an example.

[0102] In an exemplary embodiment, the process of determining the shadow probability of any shadow point among multiple shadow points may include: for any shadow point, sampling a first light ray in the light ray whose illumination direction points to any shadow point; determining a first shadow intensity based on a first light intensity of the first light ray and a first transmittance degree of the first light ray on a path pointing to any shadow point; and determining the shadow probability of any shadow point based on the first shadow intensity.

[0103] The shadow probability of a shadow point is determined according to the shadow intensity of the shadow point under the influence of the first light. The first light is sampled from the light pointing to the shadow point in the illumination direction. Based on this, the correlation between the shadow probability of a shadow point and the influence of the light pointing to the shadow point on the shadow point can be ensured, thereby improving the reliability of the shadow probability of the shadow point, and then improving the reliability of the target point and the reliability of shadow rendering.

[0104] The embodiment of the present application does not limit the method of sampling the first light from the light whose illumination direction points to any shadow point. Exemplarily, the method of sampling the first light from the light whose illumination direction points to any shadow point may refer to randomly sampling one or more light as the first light.

[0105] Exemplarily, the number of first rays is at least one, and based on the first ray intensity of the first ray and the first transmittance of the first ray on the path pointing to any shadow point, the process of determining the first shadow intensity may be: for any first ray among the at least one first ray, based on the first ray intensity of any first ray and the first transmittance of any first ray on the path pointing to any shadow point, determine the sub-shadow intensity corresponding to any first ray; and take the sum of the sub-shadow intensities corresponding to at least one first ray as the first shadow intensity.

[0106] The first light intensity of any first light is used to indicate the illumination intensity of any first light in the illumination direction, and the first transmittance of any first light is used to indicate the transmission of any first light when propagating on a path pointing to any shadow point. Exemplarily, the first transmittance of any first light can be determined based on the material of a virtual object that exists on the path where any first light points to any shadow point. There may be one or more virtual objects on the path where any first light points to any shadow point. A transmittance can be determined based on the material of each virtual object, and the product of the determined transmittances can be used as the first transmittance. Exemplarily, a correspondence between material and transmittance can be stored in a computer device, and the transmittance corresponding to the material of the virtual object can be determined based on the material of the virtual object and the correspondence.

[0107] Exemplarily, based on the first light intensity of any first light and the first transmission degree of any first light on the path pointing to any shadow point, the implementation method of determining the sub-shadow intensity corresponding to any first light is: determining the product of the first light intensity of any first light and the first transmission degree of any first light on the path pointing to any shadow point, and determining the sub-shadow intensity corresponding to any first light based on the product. Exemplarily, the product is used to indicate the illumination intensity of any first light on any shadow point, and the illumination intensity refers to the remaining intensity of the first light intensity of any first light when it reaches any shadow point after being transmitted through a virtual object on the path pointing to any shadow point.

[0108] In some embodiments, the degree of transmittance can be expressed by a numerical value, for example, the degree of transmittance can be expressed by a percentage value, for example, if the degree of transmittance is 0%, it means that no light can be transmitted through; if the degree of transmittance is 100%, it means that light can be completely transmitted through. The degree of transmittance expressed by a numerical value can also be called transmittance.

[0109] In some embodiments, the intensity of the sub-shadow corresponding to any first ray may be positively correlated with the product. In this case, the greater the illumination intensity of any first ray on any shadow point, the greater the intensity of the sub-shadow corresponding to any first ray. In other embodiments, the intensity of the sub-shadow corresponding to any first ray may be negatively correlated with the product. In this case, the greater the illumination intensity of any first ray on any shadow point, the smaller the intensity of the sub-shadow corresponding to any first ray. The method of determining the intensity of the sub-shadow corresponding to any first ray based on the product can be determined according to the correlation between the intensity of the sub-shadow corresponding to any first ray and the product, which is not limited in the embodiments of the present application.

[0110] For example, the process of determining the first shadow intensity may be implemented based on Formula 4:

[0111] S MC ′(p)=∑ i=1 N L(p,ω i )T′(p,ω i )(Formula 4)

[0112] Among them, S MC ′(p) represents the first shadow intensity; N represents the number of first rays; L(p,ω i ) represents the first light intensity corresponding to the i-th first light, T′(p,ω i) represents the first transmission degree corresponding to the i-th first light. i is an integer not less than 1 and not greater than N. The process of determining the first shadow intensity based on Formula 4 can be called the shadow intensity generated according to the Monte Carlo algorithm. The process of generating the shadow intensity according to the Monte Carlo algorithm is a process of estimating the integral of the light on different paths by using random sampling and considering the details of the model obtained by mesh modeling, and using the integral as the shadow intensity.

[0113] After the first shadow intensity is determined, the shadow probability of any shadow point is determined according to the first shadow intensity.

[0114] Exemplarily, when the sub-shadow intensity corresponding to any first light is positively correlated with the product, that is, the greater the illumination intensity of any first light on any shadow point, the greater the sub-shadow intensity corresponding to any first light, the process of determining the shadow probability of any shadow point according to the first shadow intensity can be: if the first shadow intensity is greater than the first threshold, the first probability is used as the shadow probability of any shadow point; if the first shadow intensity is not greater than the first threshold, the second probability is used as the shadow probability of any shadow point. The first threshold can be set based on experience, and can also be flexibly adjusted according to the number of first rays.

[0115] Exemplarily, when the sub-shadow intensity corresponding to any first light is negatively correlated with the product, that is, the greater the illumination intensity of any first light on any shadow point, the smaller the sub-shadow intensity corresponding to any first light, the process of determining the shadow probability of any shadow point according to the first shadow intensity can be: if the first shadow intensity is less than the second threshold, the first probability is used as the shadow probability of any shadow point; if the first shadow intensity is not less than the second threshold, the second probability is used as the shadow probability of any shadow point. The second threshold can be set based on experience, or can be flexibly adjusted based on the number of first rays.

[0116] Among them, the first probability is used to indicate that any shadow point is not in the shadow, and the second probability is used to indicate that any shadow point is in the shadow. The first probability is less than the probability threshold, and the second probability is greater than the probability threshold. Determining the shadow probability by the above-mentioned method can ensure that in the process of determining the target point, the shadow points with greater intensity of light are eliminated, thereby ensuring the reliability of the target point.

[0117] In an exemplary embodiment, the process of determining the shadow probability of any shadow point among a plurality of shadow points may further include: inputting the point information of any shadow point and the scene information of the virtual scene into a shadow probability prediction model, and obtaining the shadow probability of any shadow point output by the shadow probability prediction model. The shadow probability prediction model is a model that can predict the probability of a point being in a shadow based on the point information of the input point and the scene information of the virtual scene. The shadow probability prediction model can be any neural network model, which is not limited in the embodiments of the present application. Exemplarily, this method of determining the shadow probability can be considered as a method of determining the shadow probability based on machine learning. This method of determining the shadow probability based on machine learning can reduce the process of determining the first shadow intensity, reduce the amount of calculation, thereby optimizing the shadow rendering process, reducing the amount of calculation in real-time rendering, and improving the efficiency of real-time rendering.

[0118] The shadow probability prediction model can be trained using the point information of the sample point, the scene information of the sample scene, and the standard shadow probability of the sample point. The standard shadow probability of the sample point can be obtained by professionals through professional analysis of the sample point and the sample scene.

[0119] Exemplarily, the process of training to obtain a shadow probability prediction model may include: inputting point information of a sample point and scene information of a sample scene into an initial shadow probability prediction model, obtaining a predicted shadow probability of the sample point output by the initial shadow probability prediction model; determining a training loss based on the difference between the predicted shadow probability and the standard shadow probability; updating the parameters of the initial shadow probability prediction model using the training loss to obtain a shadow probability prediction model after parameter update; if the training process of the shadow probability prediction model satisfies a training termination condition, using the shadow probability prediction model after parameter update as a trained shadow probability prediction model. If the training process of the shadow probability prediction model does not satisfy the training termination condition, continuing to iteratively update the parameters of the shadow probability prediction model until the training process of the shadow probability prediction model satisfies the training termination condition, and using the shadow probability prediction model obtained when the training termination condition is satisfied as a trained shadow probability prediction model.

[0120] Exemplarily, the training process of the shadow probability prediction model satisfies the training termination condition, which may refer to the number of parameter updates reaching a threshold, the training loss converges, the training loss is less than a loss threshold, etc.

[0121] After determining the target point, the point information of the target point is obtained. The point information of the target point is information used to characterize the target point. The embodiment of the present application does not limit the type of the point information of the target point, as long as the point information of a target point can uniquely identify the target point. Exemplarily, the point information of the target point may include but is not limited to the position of the target point in the virtual scene, the normal vector corresponding to the target point, the mesh identifier of the mesh where the target point is located, the material of the target point, and other information.

[0122] Exemplarily, the point information of all points in the virtual scene can be pre-stored as a kind of attribute information of the virtual scene, and the computer device can extract the point information of the target point from the point information of all points in the virtual scene. Exemplarily, the point information of the target point can be obtained by the computer device analyzing and identifying the target point.

[0123] In step 202, based on the scene information and point information, the shadow intensity of the target point under the combined influence of light intensity and transmittance is predicted, where the light intensity is the intensity of the light in the virtual scene pointing to the target point, and the transmittance is the transmittance of the light on the path pointing to the target point.

[0124] The shadow intensity corresponding to the target point is used to indicate the intensity of the shadow to be rendered at the target point. The shadow intensity corresponding to the target point may be positively correlated with the intensity of the shadow to be rendered at the target point, or may be negatively correlated with the intensity of the shadow to be rendered at the target point, which is not limited in the embodiments of the present application.

[0125] Since light intensity and transmittance are the key factors affecting shadow intensity, predicting the shadow intensity of the target point by comprehensively considering light intensity and transmittance is conducive to improving the reliability of the shadow intensity of the target point, thereby ensuring the quality of shadow rendering.

[0126] In an exemplary embodiment, a computer program is stored in a computer device for predicting the intensity of a shadow of a target point under the combined influence of light intensity and transmittance based on scene information and point information. The computer device can implement a process of predicting the intensity of a shadow of a target point under the combined influence of light intensity and transmittance based on scene information and point information by running the computer program.

[0127] In an exemplary embodiment, the process of predicting the shadow intensity of a target point under the combined influence of light intensity and transmittance based on scene information and point information includes: inputting the scene information and point information into a shadow intensity prediction model, and obtaining the shadow intensity of the target point output by the shadow intensity prediction model, wherein the shadow intensity prediction model is used to predict the shadow intensity of the target point under the combined influence of light intensity and transmittance based on the scene information and point information. That is, the process of predicting the shadow intensity of a target point under the combined influence of light intensity and transmittance based on scene information and point information can be implemented by calling the shadow intensity prediction model. The shadow intensity prediction model is a model specifically used to predict shadow intensity, and the process of predicting the shadow intensity of a target point under the combined influence of light intensity and transmittance based on scene information and point information is implemented by calling the shadow intensity prediction model, which is conducive to improving the standardization of the process of predicting shadow intensity.

[0128] Exemplarily, the shadow intensity prediction model is based on scene information and point information, and the process of predicting the shadow intensity of the target point under the combined influence of light intensity and transmittance can be an integration process. The basic formula of the shadow intensity prediction model can be shown as the following formula 5:

[0129] S′(p,ω)=∫ Ω L(p,ω)T′(p,ω)dω(Formula 5)

[0130] Where p represents the target point; ω represents the light irradiating the target point; S′(p,ω) represents the shadow intensity of the target point; L(p,ω) represents the light intensity; T′(p,ω) represents the degree of transmission; Ω Represents the space where the entire virtual environment is located. According to Formula 5, the shadow intensity prediction model can predict the light whose illumination direction points to the target point in the space where the entire virtual environment is located, and then predict the shadow intensity of the target point according to the light intensity and transmittance related to the light whose illumination direction points to the target point in the space where the entire virtual environment is located, so as to fully ensure the reliability of the shadow intensity of the target point. Among them, the light intensity and transmittance related to the light can be predicted by the shadow intensity prediction model according to the input scene information.

[0131] For example, when the target point is determined among multiple shadow points, T′(p,ω) in Formula 5 can be considered as a degree of transmittance that takes into account the details and structure of mesh modeling. T′(p,ω) can be expressed using the following Formula 6:

[0132] T′(p,ω)=T(p,ω)V s (p,ω)(Formula 6)

[0133] Where T(p,ω) represents the transmittance of all points in the virtual scene; V s (p,ω) represents the set of shadow points determined in the mesh modeling process. The physical meaning of the above formula 6 is: in the process of shadow rendering, only the transmittance related to the shadow point is retained to reduce the amount of calculation in the shadow rendering process and improve the efficiency of shadow rendering.

[0134] For example, in the case where a point among multiple shadow points whose shadow probability is greater than a probability threshold is taken as a target point, p in Formula 5 can also be expressed as p(S MC ′), p(S MC ′) represents the first shadow intensity S MC ′ Determine the shadow probability, the point whose shadow probability is greater than the probability threshold. The number of target points is multiple, if p is represented by p(S MC ′), the shadow intensity of all target points can be expressed by the following formula 7:

[0135] S d ′=S′(p(S MC ′),ω)(Formula 7)

[0136] Among them, S d ′ represents the shadow intensity of all target points, which can also be called shadow distribution; S′(p(S MC ′),ω) represents the shadow intensity of each point among multiple shadow points whose shadow probability is greater than the probability threshold.

[0137] In some embodiments, the shadow intensity prediction model can be trained by supervised training. The method of training the shadow intensity prediction model may include: obtaining sample scene information of the sample scene and point information of the reference point with rendered shadows in the sample scene, inputting the sample scene information and the point information of the reference point into the initial shadow intensity prediction model, and obtaining the predicted shadow intensity of the reference point output by the initial shadow intensity prediction model; determining the target loss based on the difference between the predicted shadow intensity of the reference point and the standard shadow intensity of the reference point; using the target loss to update the parameters of the initial shadow intensity prediction model to obtain the shadow intensity prediction model after parameter update; if the training process of the shadow intensity prediction model meets the training termination condition, the shadow intensity prediction model after parameter update is used as the trained shadow intensity prediction model. If the training process of the shadow intensity prediction model does not meet the training termination condition, continue to iteratively update the parameters of the shadow intensity prediction model until the training process of the shadow intensity prediction model meets the training termination condition, and the shadow intensity prediction model obtained when the training termination condition is met is used as the trained shadow intensity prediction model.

[0138] Exemplarily, the training process of the shadow intensity prediction model satisfies the training termination conditions, which may refer to the number of parameter updates reaching a threshold, the target loss converges, the target loss is less than a loss threshold, etc.

[0139] For example, the number of rays pointing to the target point in the space where the entire virtual environment is located may be large, and the rays pointing to the target point in the space where the entire virtual environment is located may refer to the rays predicted by the shadow intensity prediction model according to the stochastic differential diffusion method, and the shadow intensity prediction model may be called a SDSM (Stochastic Differential Shadow Diffuson) model or SDSM network. The SDSM network can be regarded as an advanced shadow intensity prediction network that combines mesh modeling and deep learning technology. The SDSM network can render shadows more realistically and efficiently by combining the fine structure of mesh modeling and the prediction ability of deep learning.

[0140] Based on the SDSM network, it can generate natural shadow effects under different engine lighting conditions, integrating shadow mapping and shadow volume technologies.

[0141] In step 203, based on the shadow intensity of the target point, a shadow rendering result of the virtual scene is obtained.

[0142] The shadow rendering result of the virtual scene is used to indicate the distribution of the shadow in the virtual scene. The embodiment of the present application does not limit the form of the shadow rendering result of the virtual scene. In some embodiments, the shadow rendering result of the virtual scene can be in the form of an image, and the pixel value of the pixel point in the image is determined according to the shadow intensity of the target point. In other embodiments, the shadow rendering result of the virtual scene can also be in the form of an array, which can indicate the correspondence between the pixel coordinates and the pixel value, and the pixel value is determined according to the shadow intensity of the target point.

[0143] In a possible implementation, obtaining the shadow rendering result of the virtual scene based on the shadow intensity of the target point may refer to obtaining the shadow rendering result of the virtual scene directly based on the shadow intensity of the target point. In this way, only the shadow intensity of the target point needs to be obtained to obtain the shadow rendering result of the virtual scene, and other information of the target point does not need to be obtained, which is conducive to reducing the amount of calculation in the process of obtaining the shadow rendering result and improving the efficiency of obtaining the shadow rendering result.

[0144] In an exemplary embodiment, the process of directly acquiring the shadow rendering result of the virtual scene based on the shadow intensity of the target point may include the following steps 203a and 203b.

[0145] Step 203a: Rendering a shadow image based on the shadow intensity of the target point, where the shadow image includes a target pixel point corresponding to the target point, and a pixel value of the target pixel point is determined based on the shadow intensity of the target point.

[0146] The shadow image is a two-dimensional image directly rendered based on the shadow intensity of the target point. In the process of rendering the shadow image based on the shadow intensity of the target point, the pixel value of the target pixel point is first determined according to the shadow intensity of the target point, and then the shadow image is rendered based on the pixel value of the target pixel point. Among them, the target pixel point refers to the point obtained after rendering the target point into the two-dimensional image, that is, the target pixel point refers to the pixel point corresponding to the target point in the shadow image.

[0147] The pixel value of the target pixel is used to determine the color of the target pixel in the shadow image. In an exemplary embodiment, the computer device records the corresponding relationship between the shadow intensity and the pixel value, and determines the pixel value corresponding to the shadow intensity of the target point according to the corresponding relationship, and uses the pixel value as the pixel value of the target pixel. The corresponding relationship between the shadow intensity and the pixel value can be set based on experience or flexibly adjusted according to actual conditions, and the embodiments of the present application do not limit this.

[0148] Exemplarily, in the case where the shadow intensity of a target point is positively correlated with the strength of the shadow to be rendered at the target point, the principle for setting the correspondence between shadow intensity and pixel value may be: the greater the shadow intensity, the darker the color represented by the pixel value corresponding to the shadow intensity; the smaller the shadow intensity, the brighter the color represented by the pixel value corresponding to the shadow intensity.

[0149] Exemplarily, in the case where the shadow intensity of the target point is negatively correlated with the strength of the shadow to be rendered at the target point, the principle for setting the correspondence between the shadow intensity and the pixel value can be: the smaller the shadow intensity, the darker the color represented by the pixel value corresponding to the shadow intensity; the larger the shadow intensity, the brighter the color represented by the pixel value corresponding to the shadow intensity.

[0150] Exemplarily, the method of rendering a shadow image based on the pixel value of a target pixel point may be: setting the pixel values ​​of other pixels except the target pixel point as reference pixel values, and using the image presented by the pixel value of the target pixel point and the pixel values ​​of other pixels as the shadow image. The reference pixel value may refer to the pixel value corresponding to the pixel point that does not need to render the shadow, and the reference pixel value may be set according to the application, or may be flexibly adjusted according to the application scenario. For example, the reference pixel value is the pixel value at which the brightness of the corresponding color is the maximum brightness.

[0151] Step 203b: Based on the shadow image, obtain the shadow rendering result of the virtual scene.

[0152] Obtaining the shadow rendering result of the virtual scene based on the shadow image can ensure that the shadow rendering result is a result in the form of an image, and the shadow rendering result has a high degree of visualization. In addition, the shadow rendering result in the form of an image can be directly used in the subsequent rendering of the virtual scene (for example, superimposing the shadow rendering result in the form of an image on the virtual scene), which is conducive to improving the convenience of using the shadow rendering result.

[0153] In an exemplary embodiment, the process of obtaining the shadow rendering result of the virtual scene based on the shadow image may refer to using the shadow image as the shadow rendering result of the virtual scene. This method is conducive to improving the efficiency of obtaining the shadow rendering result of the virtual scene based on the shadow image.

[0154] In an exemplary embodiment, based on a shadow image, a process for obtaining a shadow rendering result of a virtual scene includes: performing at least one of pixel value optimization or shadow edge optimization on the shadow image to obtain an optimized shadow image; pixel value optimization is used to optimize the pixel values ​​of pixel points in the shadow image; shadow edge optimization is used to identify the edges of shadows in the shadow image and connect the edges; and the optimized shadow image is used as the shadow rendering result of the virtual scene.

[0155] Using an image obtained after performing at least one of pixel value optimization and shadow edge optimization on the shadow image as the shadow rendering result is beneficial to improving the reliability of the shadow rendering result in terms of pixel value and / or shadow edge, thereby improving the quality of shadow rendering.

[0156] In an exemplary embodiment, pixel value optimization includes at least one of averaging, filtering or masking; wherein, averaging is used to replace the pixel value of any pixel in the shadow image with the average value of the pixel values ​​of each pixel in a first reference area where the pixel is located; filtering is used to replace the pixel value of any pixel in the shadow image with the weighted value of the pixel values ​​of each pixel in a second reference area where the pixel is located; masking is used to adjust the pixel value of any pixel in the shadow image using a masking coefficient, and the masking coefficient is used to indicate the degree of masking of any pixel by an object in the virtual scene.

[0157] Optimizing the pixel values ​​of target points in the shadow image by at least one of averaging, filtering or masking processing is helpful to fully ensure the optimization effect of the pixel values ​​of the target points, improve the reliability of the optimized image, and further fully improve the reliability of the shadow rendering results and improve the shadow rendering quality.

[0158] The averaging process is used to replace the pixel value of any pixel in the shadow image with the average value of the pixel values ​​of each pixel in the first reference area where any pixel is located. The first reference area where any pixel is located may refer to the area covered by the first sampling window with any pixel as the center point. The shape and size of the first sampling window can be set based on experience, or can be flexibly adjusted according to the application scenario, which is not limited in the embodiments of the present application. For example, the shape of the first sampling window can be a rectangle, or a square, etc.

[0159] Exemplarily, taking the first sampling window as a square window with a side length of k (k is an odd number) as an example, the averaging process can be expressed based on the following formula 8:

[0160] S pcf (u,v)=1 / k 2 ∑ k i=1 ∑ k j=1 S m (i,j)(Formula 8)

[0161] Where (u, v) represents the two-dimensional coordinates of any pixel in the shadow image; S pcf (u, v) represents the pixel value of any pixel point obtained after averaging; S m (i, j) represents the pixel value of the pixel point in the i-th row and j-th column in the first reference area where any pixel point is located, where the value of i is an integer not less than 1 and not greater than k, and the value of j is an integer not less than 1 and not greater than k.

[0162] The shadow image can be considered as an image obtained by mapping points in the virtual scene onto a two-dimensional plane by considering the depth information from the perspective of the light source. Through averaging processing, the pixel values ​​of multiple adjacent pixels can be sampled and averaged to optimize the pixel values. Through this processing, the pixel values ​​of the pixels can be optimized to a certain extent by considering the occlusion relationship between the corresponding points of adjacent pixels in the virtual scene, thereby improving the shadow effect of the shadow image.

[0163] The filtering process is used to replace the pixel value of any pixel in the shadow image with the weighted value of the pixel values ​​of each pixel in the second reference area where any pixel is located. The second reference area where any pixel is located may refer to the area covered by the second sampling window with any pixel as the center point. The shape and size of the second sampling window can be set based on experience, or can be flexibly adjusted according to the application scenario, which is not limited in the embodiments of the present application. For example, the shape of the second sampling window can be a rectangle, or a square, etc. Exemplarily, the second sampling window can be the same as the first sampling window, or it can be different from the first sampling window, which is not limited in the embodiments of the present application.

[0164] The process of determining the weighted values ​​of the pixel values ​​of each pixel point in the second reference area where any pixel point is located includes: determining the weight of each pixel point in the second reference area where any pixel point is located; calculating the product of the weight of each pixel point and the pixel value of each pixel point; and determining the weighted value based on the sum of the calculated products. The method for determining the weight of each pixel point in the second reference area is related to the filtering method used in the filtering process, which is not limited in the embodiments of the present application. Exemplarily, the filtering method may include but is not limited to Gaussian filtering and bilateral filtering.

[0165] When the filtering method is Gaussian filtering, the weight of each pixel point in the second reference area is determined according to the Gaussian distribution function and the distance between each pixel point and any pixel point.

[0166] When the filtering method is double wave filtering, the weight of each pixel in the second reference area can be determined according to the distance between each pixel and any other pixel, and the difference between the pixel value of each pixel and the pixel value of any other pixel. By determining the weight in this way, bilateral filtering can consider the difference between the pixel values ​​of pixels during the filtering process, thereby retaining edge information and avoiding blurring of important edges.

[0167] For example, based on the calculated sum of the products, the weighted value may be determined by using the calculated sum of the products as the weighted value, or by using the ratio of the sum of the calculated sum of the products to a normalization factor as the weighted value. The normalization factor is used to normalize the sum of the products to avoid changes in the magnitude of the pixel values.

[0168] For example, taking the filtering method used in the filtering process as bilateral filtering as an example, the filtering process can be expressed based on the following formula 9:

[0169]

[0170] Wherein, (u, v) represents the two-dimensional coordinates of any pixel point in the shadow image; (u′, v′) represents the two-dimensional coordinates of each pixel point in the second reference area in the shadow image; S bf (u,v) represents the pixel value of any pixel point obtained after filtering; S(u,v) represents the pixel value of any pixel point; S(u′,v′) represents the pixel value of each pixel point in the second reference area; (uu′) 2 +(vv′) 2 Represents the distance between each pixel and any other pixel; ||S(u,v)-S(u′,v′)|| 2 Indicates the difference between the pixel value of each pixel and the pixel value of any other pixel; σd and σ r Represent the standard deviation of the spatial domain and the range respectively; represents the weight of each pixel in the second reference area; W represents the normalization factor.

[0171] The occlusion processing is used to adjust the pixel value of any pixel in the shadow image using the occlusion coefficient. The occlusion coefficient is used to indicate the degree of occlusion of any pixel by an object in the virtual scene. When performing occlusion processing, it is necessary to determine the occlusion coefficient corresponding to each pixel in the shadow image, and then adjust the pixel value of any pixel using the occlusion coefficient corresponding to any pixel. The occlusion coefficients corresponding to different pixels may be the same or different.

[0172] Exemplarily, the shielding coefficient corresponding to any pixel point may be positively correlated with the shielding degree of the object in the virtual scene to the pixel point, or may be negatively correlated with the shielding degree of the object in the virtual scene to the pixel point.

[0173] The method of adjusting the pixel value of any pixel using the masking coefficient corresponding to any pixel is related to the relationship between the masking coefficient of any pixel and the degree of masking of the pixel by an object in the virtual scene, the representation method of the masking coefficient of any pixel, and the association between the pixel value of any pixel and the brightness of any pixel. The principle of adjusting the pixel value of any pixel using the masking coefficient corresponding to any pixel is that the greater the degree of masking of any pixel by an object in the virtual scene, the greater the decrease in the brightness of any pixel after adjusting the pixel value of any pixel using the masking coefficient corresponding to the pixel.

[0174] For example, taking the example that the shielding coefficient of any pixel point is negatively correlated with the degree of shielding of the object in the virtual scene to the any pixel point, the shielding coefficient of any pixel point is a value within the range of 0-1, and the pixel value of any pixel point is positively correlated with the brightness of any pixel point, the method of adjusting the pixel value of any pixel point using the shielding coefficient corresponding to any pixel point can refer to taking the product of the shielding coefficient corresponding to any pixel point and the pixel value of any pixel point as the pixel value obtained after the shielding processing of the any pixel point.

[0175] Exemplarily, the process of determining the shielding coefficient corresponding to any pixel point may be: determining the shielding parameter corresponding to any pixel point, and determining the shielding coefficient corresponding to any pixel point based on the shielding parameter corresponding to any pixel point and the correspondence between the shielding parameter and the shielding coefficient.

[0176] Exemplarily, the shielding parameter corresponding to any pixel point can be determined according to the following formula 10:

[0177] A ao (u,v)=1 / t∑i=1 t max(0,N·L i )(Formula 10)

[0178] Where (u, v) represents the two-dimensional coordinates of any pixel in the shadow image; A ao (u,v) represents the occlusion parameter corresponding to any pixel; t is the number of light sources sampled in the virtual scene, and t is an integer not less than 1; N represents the normal vector of the point corresponding to any pixel in the virtual scene; L i Represents the vector from the point corresponding to any pixel in the virtual scene to the sampled i-th light source. For example, the process of calculating the occlusion parameter according to Formula 10 can be considered as the process of introducing ambient occlusion (AO) technology to simulate microscopic shadow effects to adaptively adjust the shadow intensity. The occlusion processing can be considered as an advanced process of adaptively adjusting the shadow intensity.

[0179] For example, the correspondence between the shielding parameter and the shielding coefficient can be set based on experience, or can be flexibly adjusted according to the application scenario, and the embodiments of the present application do not limit this. For example, taking the shielding parameter calculated based on formula 10 as an example, the setting principle of the correspondence between the shielding parameter and the shielding coefficient is: the larger the shielding parameter, the smaller the shielding degree indicated by the corresponding shielding coefficient.

[0180] In some embodiments, the filtering process may also be referred to as a shadow blur process. When the filtering method is Gaussian filtering, the shadow blur process may also be referred to as a Gaussian blur process. When the filtering method is bilateral filtering, the shadow blur process may also be referred to as a bilateral blur process.

[0181] It should be noted that when the pixel value optimization includes at least two of averaging, filtering or masking, multiple processes are performed in sequence. The execution order of the multiple processes can be set based on experience and can also be flexibly adjusted according to the application scenario. The embodiments of the present application do not limit this.

[0182] Shadow edge optimization is used to identify the edges of shadows in the shadow image and connect the edges. Shadow edge optimization can be implemented based on any edge detection algorithm, which is not limited in the embodiments of the present application.

[0183] For example, shadow edge optimization can be implemented based on the Canny edge detection algorithm to more accurately identify edges. The Canny edge detection algorithm can be expressed using the following formula 11:

[0184] S canny (u,v)=Non-Maximum-Suppression(Gradient(S b (u,v))) (Formula 11)

[0185] In the Canny edge detection algorithm shown in Formula 11, the gradient (Gradient (S b (u,v))), apply non-maximum suppression (Non-Maximum-Suppression(Gradient(S b (u,v)))) and double threshold detection to determine and connect edges.

[0186] It should be noted that when performing the two optimization processes of pixel value optimization and shadow edge optimization on the shadow image, the pixel value optimization and shadow edge optimization are performed sequentially. The execution order of pixel value optimization and shadow edge optimization can be set according to experience, and can also be flexibly adjusted according to the application scenario. The embodiments of the present application do not limit this.

[0187] By optimizing the shadow image, the performance of the shadow rendering algorithm can be further improved, making the shadows rendered more adaptable to complex and changeable virtual scenes (such as game scenes).

[0188] In another possible implementation, obtaining the shadow rendering result of the virtual scene based on the shadow intensity of the target point may refer to obtaining the shadow rendering result of the virtual scene based on the shadow intensity of the target point and the softness of the shadow to be rendered at the target point. Figure 4 Based on the shadow intensity of the target point and the softness of the shadow to be rendered at the target point, the process of obtaining the shadow rendering result of the virtual scene includes the following steps 2031 to 2033.

[0189] Step 2031: Get the softness of the shadow to be rendered at the target point.

[0190] The softness of the shadow to be rendered at the target point is used to indicate the degree to which the intensity of the shadow to be rendered at the target point needs to be reduced. The softness of the shadow to be rendered at the target point is positively correlated with the degree to which the intensity of the shadow to be rendered at the target point needs to be reduced. That is, the softer the shadow to be rendered at the target point, the greater the degree to which the intensity of the shadow to be rendered at the target point needs to be reduced. Exemplarily, the softness can be represented by a numerical value, for example, the softness can be represented by a numerical value within 0-1. In some embodiments, the softness can also be referred to as the degree of shadow softening.

[0191] In an exemplary embodiment, the process of obtaining the softness of the shadow to be rendered at the target point includes: obtaining target illumination information of the target point in the virtual scene and target depth information of the target point in the virtual scene; calling a softness prediction model to predict the softness based on the target illumination information and the target depth information. The softness prediction model is trained based on sample illumination information of the sample point in the sample scene, sample depth information of the sample point in the sample scene, and the standard softness of the shadow to be rendered at the sample point.

[0192] By calling the trained softness prediction model to predict the softness to be rendered at the target point, it is helpful to ensure the reliability of the softness, improve the reliability of the shadow rendering result finally obtained, and improve the shadow rendering quality.

[0193] Exemplarily, the process of obtaining the softness level can be expressed based on the following formula 12:

[0194] E(p)=N(V s (p),D(p),L(p))(Formula 12)

[0195] Where E(p) represents the softness of rendering at the target point; N() represents the softness prediction model; V s (p) represents the set of target points; D(p) represents the target depth information; L(p) represents the target illumination information.

[0196] The softness prediction model can be any neural network model. By using the neural network model to predict the softness, it is helpful to improve the quality and calculation efficiency of shadow rendering.

[0197] Exemplarily, the process of obtaining target lighting information of a target point in a virtual scene includes: determining the number of times the target point is illuminated by light, the initial sub-intensity of the target point each time it is illuminated by light, and an influencing parameter corresponding to the initial sub-intensity; determining the target sub-intensity of the target point each time it is illuminated by light based on the initial sub-intensity of the target point each time it is illuminated by light and the influencing parameter corresponding to the initial sub-intensity; determining the target lighting information based on the target sub-intensity of the target point each time it is illuminated by light and the number of times the target point is illuminated by light.

[0198] The influencing parameter corresponding to the initial sub-intensity refers to a parameter that affects the initial sub-intensity. For example, the type of the influencing parameter corresponding to the initial sub-intensity may include but is not limited to reflectivity, refractive index, and the like.

[0199] The target lighting information is determined by comprehensively considering the number of times the target point is illuminated by light, the initial sub-intensity of the target point each time it is illuminated by light, and the influencing parameters corresponding to the initial sub-intensity. The process of determining the target lighting information considers relatively rich information, which is conducive to improving the reliability of determining the target lighting information, and then improving the reliability of the subsequent acquired softness, improving the reliability of the final shadow rendering result, and improving the shadow rendering quality.

[0200] Exemplarily, the process of obtaining target illumination information of a target point in a virtual scene can be expressed based on the following formula 13:

[0201] L(p)=1 / h∑ i=1 h L i (p)R i (p)V s (p)(Formula 13)

[0202] Where L(p) represents the target illumination information; h represents the number of times the target point is illuminated by light, and h is an integer not less than 1; L i (p) represents the initial sub-intensity of the target point when it is illuminated by light for the i-th time, i is an integer not less than 1 and not greater than h; R i (p) represents the influencing parameter (e.g., refractive index or reflectivity) corresponding to the initial sub-intensity of the target point when it is illuminated by light for the i-th time; V s (p) represents the set of target points.

[0203] Exemplarily, the process of determining target lighting information based on Formula 13 can be referred to as a process of determining lighting information based on an improved ray following technique, which can generate more realistic shadows by combining details of a mesh model.

[0204] Exemplarily, the target depth information of the target point in the virtual scene is used to indicate the depth information of the position of the target point in the virtual scene under the observation angle of the virtual camera based on which the shadow rendering of the virtual scene is performed. Exemplarily, the target depth information of the target point in the virtual scene may refer to the distance between the position of the target point in the virtual scene and the virtual camera.

[0205] Exemplarily, the process of training to obtain a softness prediction model can be: calling the initial softness prediction model to predict the sample softness of the shadow to be rendered at the sample point based on the sample illumination information and the sample depth information; determining the reference loss based on the difference between the sample softness and the standard softness; using the reference loss to update the parameters of the initial softness prediction model to obtain the softness prediction model after the parameter update; if the training process of the softness prediction model meets the training termination condition, the softness prediction model after the parameter update is used as the trained softness prediction model. If the training process of the softness prediction model does not meet the training termination condition, continue to iteratively update the parameters of the softness prediction model until the training process of the softness prediction model meets the training termination condition, and the softness prediction model obtained when the training termination condition is met is used as the trained softness prediction model. The standard softness can be obtained by professionals through professional analysis based on the specific conditions of the sample scene and the sample point.

[0206] Exemplarily, the training process of the softness prediction model satisfies the training termination condition, which may refer to the number of parameter updates reaching a threshold, the reference loss converges, the reference loss is less than a loss threshold, etc.

[0207] Step 2032: Update the shadow intensity of the target point based on the softness to obtain an updated shadow intensity of the target point.

[0208] The method of updating the shadow intensity of the target point based on the softness is related to the method of expressing the softness, and the correlation between the shadow intensity of the target point and the strength of the shadow to be rendered at the target point. The principle of updating the shadow intensity of the target point based on the softness is that the softer the shadow to be rendered at the target point is, the greater the degree of reduction in the strength of the shadow indicated by the updated shadow intensity of the target point after the shadow intensity of the target point is updated based on the softness.

[0209] For example, taking the example that the softness is represented by a value within a range of 0-1 and that the shadow intensity of the target point is positively correlated with the strength of the shadow to be rendered at the target point, the shadow intensity of the target point is updated based on the softness. The updated shadow intensity of the target point can be obtained by taking the product of the softness and the shadow intensity of the target point as the first intensity, and taking the difference between the shadow intensity of the target point and the first intensity as the updated shadow intensity of the target point.

[0210] It should be noted that there are multiple target points. Based on step 2031, the softness corresponding to each target point can be determined. In step 2032, the shadow intensity of each target point is updated based on the softness corresponding to each target point to obtain the updated shadow intensity of each target point.

[0211] Step 2033: Based on the updated shadow intensity of the target point, obtain the shadow rendering result of the virtual scene.

[0212] Exemplarily, the process of obtaining the shadow rendering result of the virtual scene based on the updated shadow intensity of the target point includes: rendering a shadow image based on the updated shadow intensity of the target point, the shadow image including a target pixel corresponding to the target point, and the pixel value of the target pixel in the shadow image is determined based on the updated shadow intensity of the target point; and obtaining the shadow rendering result of the virtual scene based on the shadow image. The principle of obtaining the shadow rendering result of the virtual scene based on the updated shadow intensity of the target point is the same as the principle of obtaining the shadow rendering result of the virtual scene directly based on the shadow intensity of the target point, and will not be repeated here.

[0213] In the process of obtaining the shadow rendering results of the virtual scene based on the above steps 2031 to 2033, not only the shadow intensity of the target point is considered, but also the softness of the shadow to be rendered at the target point is considered. The considered information is relatively rich, which is conducive to improving the quality of the obtained shadow rendering results and improving the realism of the shadow rendering results.

[0214] Exemplarily, the shadow rendering process can be as follows Figure 5 As shown. Perform mesh modeling on the virtual scene and determine the target point. Input the scene information of the virtual scene and the point information of the target point into the shadow intensity prediction model to obtain the shadow intensity of the target point output by the shadow intensity prediction model. Render the shadow image based on the shadow intensity of the target point, perform pixel value optimization and shadow edge optimization on the shadow image to repair and enhance the shadow image and solve the rough edge problem of the shadow image, and use the optimized shadow image as the shadow rendering result. The shadow rendering result is used to indicate the distribution of shadows in the virtual scene.

[0215] The shadow rendering method provided in the embodiment of the present application can be regarded as a soft shadow recovery technology for the lack of shadow effects of model lighting in the game. Based on shadow modeling and SDSM network diffusion soft shadow generation technology, this technology uses advanced modeling technology to create a three-dimensional game scene model with rich details to support complex lighting and shadow effects, thereby improving the clarity and realism of the game screen, and also provides a basis for subsequent soft shadow generation. The shadow rendering method provided in the embodiment of the present application is capable of processing large-size real images and achieves excellent results in a variety of image restoration tasks. The innovative points of the shadow rendering method provided in the embodiment of the present application are mainly the following aspects:

[0216] Adaptive mesh subdivision: By introducing an adaptive subdivision strategy based on error metrics, the number of meshes can be reduced without sacrificing details, improving the efficiency and quality of shadow rendering. This strategy makes mesh modeling more intelligent and can dynamically adjust the level of detail according to the needs of the scene.

[0217] SDSM network: Combining the fine structure of mesh modeling and the predictive power of deep learning, the SDSM network can generate more realistic and efficient soft shadows, providing a method to achieve high-quality graphics rendering without sacrificing performance.

[0218] Based on the shadow rendering method provided in the embodiment of the present application, a realistic soft shadow effect can be generated, thereby enhancing the light and shadow effects and atmosphere of the game scene, while also improving the playability and immersion of the game. Based on the shadow rendering method provided in the embodiment of the present application, soft shadow simulation re-rendering is performed. When some rigid material projections produce shadows or no shadows, this method can be used to efficiently produce high-quality soft shadows. The shadow rendering method provided in the embodiment of the present application can not only provide high-quality rendering effects, but also provide a more realistic and immersive interactive experience for interactive objects while ensuring efficiency.

[0219] In the embodiment of the present application, after obtaining the scene information of the virtual scene and the point information of the target point that needs to render the shadow, the shadow intensity of the target point is predicted directly based on the scene information and the point information, without the need for manual analysis, and the efficiency of obtaining the shadow intensity is high, which is conducive to improving the efficiency of shadow rendering. In addition, the shadow intensity of the target point is predicted by comprehensively considering the light intensity and the degree of transmission. The light intensity and the degree of transmission are the main factors affecting the shadow intensity of the target point. Based on this method, the reliability of the determined shadow intensity can be guaranteed, thereby improving the quality of shadow rendering.

[0220] For example, the computer device may be based on Figure 6 Steps 601 to 612 are shown to execute the shadow rendering method.

[0221] Step 601: Determine each original grid used to construct a virtual scene.

[0222] Step 602: for any original mesh among the original meshes, based on the curvature of any original mesh, determine a target mesh corresponding to any original mesh.

[0223] Among them, when the difference between the curvature of any original mesh and the curvature threshold is not greater than the difference threshold, the target mesh corresponding to any original mesh is any original mesh; when the difference between the curvature of any original mesh and the curvature threshold is greater than the difference threshold, the target mesh corresponding to any original mesh is determined based on the subdivided mesh, and the subdivided mesh is obtained by subdividing any original mesh.

[0224] Step 603: Based on the positional relationship between the mesh vertices of the target mesh corresponding to each original mesh and the light source in the virtual scene, and the normal vectors corresponding to the mesh vertices, a plurality of shadow points relative to the light source are determined in the mesh vertices.

[0225] Step 604: determine the shadow probabilities of the multiple shadow points, and take the points among the multiple shadow points whose shadow probabilities are greater than a probability threshold as target points.

[0226] Exemplarily, the process of determining the shadow probability of any shadow point includes: sampling a first light ray in the light ray whose illumination direction points to any shadow point; determining a first shadow intensity based on a first light intensity of the first light ray and a first transmittance degree of the first light ray on a path pointing to any shadow point; and determining the shadow probability of any shadow point based on the first shadow intensity.

[0227] Step 605: Acquire scene information of the virtual scene and point information of the target point in the virtual scene.

[0228] For the implementation process of the above steps 601 to 605, see Figure 2 The relevant steps in step 201 in the illustrated embodiment will not be described in detail here.

[0229] Step 606: Input the scene information and point information into the shadow intensity prediction model to obtain the shadow intensity of the target point output by the shadow intensity prediction model; the shadow intensity prediction model is used to predict the shadow intensity of the target point under the combined influence of light intensity and transmittance based on the scene information and point information.

[0230] For the implementation process of step 606, see Figure 2 The relevant steps in step 202 in the illustrated embodiment will not be described in detail here.

[0231] Step 607: Determine the target sub-intensity each time the target point is irradiated with light based on the initial sub-intensity each time the target point is irradiated with light and the influencing parameter corresponding to the initial sub-intensity; determine the target lighting information of the target point in the virtual scene based on the target sub-intensity each time the target point is irradiated with light and the number of times the target point is irradiated with light.

[0232] Step 608: Obtain target depth information of the target point in the virtual scene.

[0233] Step 609: Calling the softness prediction model to predict the softness of the shadow to be rendered at the target point based on the target illumination information and the target depth information.

[0234] The softness prediction model is trained based on sample illumination information of the sample point in the sample scene, sample depth information of the sample point in the sample scene, and standard softness of the shadow to be rendered at the sample point.

[0235] Step 610: Update the shadow intensity of the target point based on the softness level to obtain an updated shadow intensity of the target point.

[0236] Step 611: based on the updated shadow intensity of the target point, render a shadow image, the shadow image includes a target pixel point corresponding to the target point, and the pixel value of the target pixel point is determined based on the updated shadow intensity of the target point.

[0237] Step 612: performing at least one of pixel value optimization and shadow edge optimization on the shadow image to obtain an optimized shadow image; and using the optimized shadow image as the shadow rendering result of the virtual scene.

[0238] Exemplarily, pixel value optimization includes at least one of averaging, filtering or masking; wherein, averaging is used to replace the pixel value of any pixel in the shadow image with the average value of the pixel values ​​of each pixel in the first reference area where the pixel is located; filtering is used to replace the pixel value of any pixel in the shadow image with the weighted value of the pixel values ​​of each pixel in the second reference area where the pixel is located; masking is used to adjust the pixel value of any pixel in the shadow image using a masking coefficient, and the masking coefficient is used to indicate the degree of masking of any pixel by an object in the virtual scene.

[0239] For the implementation process of the above steps 607 to 612, see Figure 2 The relevant steps in step 203 in the illustrated embodiment will not be described in detail here.

[0240] See also Figure 7 , an embodiment of the present application provides a shadow rendering device, the device comprising:

[0241] A first acquisition module 701 is used to acquire scene information of a virtual scene and point information of a target point in the virtual scene, where the target point is a point in the virtual scene where a shadow is to be rendered;

[0242] The second acquisition module 702 is used to predict the shadow intensity of the target point under the combined influence of light intensity and transmittance based on the scene information and the point information, where the light intensity is the intensity of the light in the virtual scene pointing to the target point, and the transmittance is the transmittance of the light on the path pointing to the target point;

[0243] The third acquisition module 703 is used to acquire the shadow rendering result of the virtual scene based on the shadow intensity of the target point.

[0244] In a possible implementation, the first acquisition module 701 is also used to determine each original grid used to construct a virtual scene; for any original grid among the original grids, based on the curvature of any original grid, determine the target grid corresponding to any original grid; determine the target point in the grid vertices of the target grid corresponding to each original grid; wherein, when the difference between the curvature of any original grid and the curvature threshold is not greater than the difference threshold, the target grid corresponding to any original grid is any original grid; when the difference between the curvature of any original grid and the curvature threshold is greater than the difference threshold, the target grid corresponding to any original grid is determined based on the subdivided grid, and the subdivided grid is obtained by subdividing any original grid.

[0245] In one possible implementation, the first acquisition module 701 is used to determine multiple shadow points relative to the light source in the mesh vertices based on the positional relationship between the mesh vertices and the light source in the virtual scene, and the normal vectors corresponding to the mesh vertices, where the normal vectors are used to indicate the orientation of the mesh vertex in the virtual scene; and determine the target point among the multiple shadow points.

[0246] In one possible implementation, the first acquisition module 701 is used to determine the shadow probability of multiple shadow points, and the shadow probability of any shadow point is used to indicate the probability that any shadow point is located in the shadow; and the point among the multiple shadow points whose shadow probability is greater than the probability threshold is taken as the target point.

[0247] In one possible implementation, the first acquisition module 701 is used to sample a first light ray from the light rays whose illumination direction points to any shadow point for any shadow point; determine a first shadow intensity based on a first light intensity of the first light ray and a first transmittance degree of the first light ray on a path pointing to any shadow point; and determine a shadow probability of any shadow point based on the first shadow intensity.

[0248] In one possible implementation, the third acquisition module 703 is used to obtain the softness of the shadow to be rendered at the target point; update the shadow intensity of the target point based on the softness to obtain the updated shadow intensity of the target point; and obtain the shadow rendering result of the virtual scene based on the updated shadow intensity of the target point.

[0249] In one possible implementation, the third acquisition module 703 is used to obtain target lighting information of the target point in the virtual scene and target depth information of the target point in the virtual scene; the softness prediction model is called to predict the softness based on the target lighting information and the target depth information; wherein the softness prediction model is trained based on sample lighting information of the sample point in the sample scene, sample depth information of the sample point in the sample scene, and the standard softness of the shadow to be rendered at the sample point.

[0250] In one possible implementation, the third acquisition module 703 is used to determine the number of times the target point is irradiated with light, the initial sub-intensity of the target point each time it is irradiated with light, and the influencing parameters corresponding to the initial sub-intensity; based on the initial sub-intensity of the target point each time it is irradiated with light and the influencing parameters corresponding to the initial sub-intensity, determine the target sub-intensity each time the target point is irradiated with light; based on the target sub-intensity each time the target point is irradiated with light and the number of times the target point is irradiated with light, determine the target lighting information.

[0251] In one possible implementation, the third acquisition module 703 is used to render a shadow image based on the shadow intensity of the target point, where the shadow image includes target pixels corresponding to the target point, and the pixel value of the target pixel is determined based on the shadow intensity of the target point; based on the shadow image, the shadow rendering result of the virtual scene is obtained.

[0252] In one possible implementation, the third acquisition module 703 is used to perform at least one of pixel value optimization or shadow edge optimization on the shadow image to obtain an optimized shadow image; the pixel value optimization is used to optimize the pixel values ​​of the pixel points in the shadow image; the shadow edge optimization is used to identify the edges of the shadows in the shadow image and connect the edges; and the optimized shadow image is used as the shadow rendering result of the virtual scene.

[0253] In one possible implementation, pixel value optimization includes at least one of averaging, filtering or masking; wherein, averaging is used to replace the pixel value of any pixel in the shadow image with the average value of the pixel values ​​of each pixel in a first reference area where the pixel is located; filtering is used to replace the pixel value of any pixel in the shadow image with a weighted value of the pixel values ​​of each pixel in a second reference area where the pixel is located; masking is used to adjust the pixel value of any pixel in the shadow image using a masking coefficient, and the masking coefficient is used to indicate the degree of masking of any pixel by an object in the virtual scene.

[0254] In one possible implementation, the second acquisition module 702 is used to input scene information and point information into a shadow intensity prediction model to obtain the shadow intensity of the target point output by the shadow intensity prediction model; the shadow intensity prediction model is used to predict the shadow intensity of the target point under the combined influence of light intensity and transmittance based on the scene information and point information.

[0255] It should be noted that the device provided in the above embodiment only uses the division of the above functional modules as an example to implement its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and their specific implementation process and beneficial effects are detailed in the method embodiment, which will not be repeated here.

[0256] In an exemplary embodiment, a computer device is also provided, the computer device includes a processor and a memory, and at least one computer program is stored in the memory. The at least one computer program is loaded and executed by one or more processors, so that the computer device implements any of the above shadow rendering methods. The computer device can be a server or a terminal. Next, the structures of the server and the terminal are introduced respectively.

[0257] Figure 8 It is a structural diagram of a server provided in an embodiment of the present application. The server may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 801 and one or more memories 802, wherein the one or more memories 802 store at least one computer program, and the at least one computer program is loaded and executed by the one or more processors 801, so that the server implements the shadow rendering method provided in the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the server may also include other components for implementing device functions, which will not be repeated here.

[0258] Fig. 9 1 is a schematic diagram of a device structure of a terminal provided in an embodiment of the present application. The terminal may be: a PC, a mobile phone, a smart phone, a PDA, a wearable device, a PPC, a tablet computer, a smart car machine, a smart TV, a smart speaker, or a vehicle-mounted terminal. The terminal may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal, or other names.

[0259] Typically, the terminal includes: a processor 1501 and a memory 1502 .

[0260] The processor 1501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 1501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1501 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0261] The memory 1502 may include one or more computer-readable storage media, which may be non-transitory. The memory 1502 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1502 is used to store at least one instruction, which is used to be executed by the processor 1501 so that the terminal implements the shadow rendering method provided in the method embodiment of the present application.

[0262] In some embodiments, the terminal may further optionally include: a peripheral device interface 1503 and at least one peripheral device. The processor 1501, the memory 1502 and the peripheral device interface 1503 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1503 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1504, a display screen 1505, a camera assembly 1506, an audio circuit 1507 and a power supply 1508.

[0263] The peripheral device interface 1503 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1501 and the memory 1502. In some embodiments, the processor 1501, the memory 1502, and the peripheral device interface 1503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1501, the memory 1502, and the peripheral device interface 1503 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0264] The radio frequency circuit 1504 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1504 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1504 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 1504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 1504 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1504 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.

[0265] The display screen 1505 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1505 is a touch display screen, the display screen 1505 also has the ability to collect touch signals on the surface or above the surface of the display screen 1505. The touch signal can be input to the processor 1501 as a control signal for processing. At this time, the display screen 1505 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1505 can be one, which is set on the front panel of the terminal; in other embodiments, the display screen 1505 can be at least two, which are respectively set on different surfaces of the terminal or are folded; in other embodiments, the display screen 1505 can be a flexible display screen, which is set on the curved surface or folded surface of the terminal. Even, the display screen 1505 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1505 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).

[0266] The camera assembly 1506 is used to capture images or videos. Optionally, the camera assembly 1506 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1506 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.

[0267] The audio circuit 1507 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 1501 for processing, or input them into the RF circuit 1504 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 1501 or the RF circuit 1504 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1507 may also include a headphone jack.

[0268] The power supply 1508 is used to power various components in the terminal. The power supply 1508 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1508 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0269] In some embodiments, the terminal further includes one or more sensors 1509 , including but not limited to: an acceleration sensor 1510 , a gyroscope sensor 1511 , a pressure sensor 1512 , an optical sensor 1513 , and a proximity sensor 1514 .

[0270] The acceleration sensor 1510 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal. For example, the acceleration sensor 1510 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 1501 can control the display screen 1505 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 1510. The acceleration sensor 1510 can also be used for collecting game or user motion data.

[0271] The gyro sensor 1511 can detect the body direction and rotation angle of the terminal, and the gyro sensor 1511 can cooperate with the acceleration sensor 1510 to collect the user's 3D actions on the terminal. The processor 1501 can implement the following functions based on the data collected by the gyro sensor 1511: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.

[0272] The pressure sensor 1512 can be set in the side frame of the terminal and / or the lower layer of the display screen 1505. When the pressure sensor 1512 is set in the side frame of the terminal, it can detect the user's holding signal of the terminal, and the processor 1501 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 1512. When the pressure sensor 1512 is set in the lower layer of the display screen 1505, the processor 1501 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 1505. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0273] The optical sensor 1513 is used to collect the ambient light intensity. In one embodiment, the processor 1501 can control the display brightness of the display screen 1505 according to the ambient light intensity collected by the optical sensor 1513. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1505 is increased; when the ambient light intensity is low, the display brightness of the display screen 1505 is reduced. In another embodiment, the processor 1501 can also dynamically adjust the shooting parameters of the camera component 1506 according to the ambient light intensity collected by the optical sensor 1513.

[0274] The proximity sensor 1514, also known as a distance sensor, is usually arranged on the front panel of the terminal. The proximity sensor 1514 is used to collect the distance between the user and the front of the terminal. In one embodiment, when the proximity sensor 1514 detects that the distance between the user and the front of the terminal is gradually decreasing, the processor 1501 controls the display screen 1505 to switch from the screen-on state to the screen-off state; when the proximity sensor 1514 detects that the distance between the user and the front of the terminal is gradually increasing, the processor 1501 controls the display screen 1505 to switch from the screen-off state to the screen-on state.

[0275] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.

[0276] In an exemplary embodiment, a computer-readable storage medium is further provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor of a computer device to enable the computer to implement any of the above-mentioned shadow rendering methods.

[0277] In one possible implementation, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0278] In an exemplary embodiment, a computer program or a computer program product is further provided. The computer program or the computer program product includes computer instructions. The computer instructions are loaded and executed by a processor to enable a computer to implement any one of the above shadow rendering methods.

[0279] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the scene information of the virtual scene and the point information of the target point involved in this application are all obtained with full authorization.

[0280] The terms "first", "second", etc. in this application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the application described here can be implemented in an order other than those illustrated or described here. The embodiments described in the above exemplary embodiments do not represent all embodiments consistent with the application. On the contrary, they are only examples of devices and methods consistent with some aspects of the application.

[0281] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0282] A person of ordinary skill in the art will understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by instructing related hardware through a program. Optionally, the program is stored in a computer-readable storage medium. Optionally, the above-mentioned storage medium is a read-only memory, a disk or an optical disk, etc.

[0283] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A shadow rendering method, characterized in that: The method comprises: Acquire scene information of a virtual scene and point information of a target point in the virtual scene, wherein the target point is a point in the virtual scene where a shadow is to be rendered; Based on the scene information and the point information, predict the shadow intensity of the target point under the combined influence of light intensity and transmittance, wherein the light intensity is the intensity of the light in the virtual scene whose illumination direction points to the target point, and the transmittance is the transmittance of the light on the path pointing to the target point; Based on the shadow intensity of the target point, a shadow rendering result of the virtual scene is obtained.

2. The method according to claim 1, characterized in that The method further comprises: Determining each original grid used to construct the virtual scene; For any original grid among the original grids, determining a target grid corresponding to the original grid based on the curvature of the original grid; Determine the target point among the mesh vertices of the target mesh corresponding to each of the original meshes; Among them, when the difference between the curvature of any original grid and the curvature threshold is not greater than the difference threshold, the target grid corresponding to any original grid is the any original grid; when the difference between the curvature of any original grid and the curvature threshold is greater than the difference threshold, the target grid corresponding to any original grid is determined based on the subdivided grid, and the subdivided grid is obtained by subdividing any original grid.

3. The method according to claim 2, characterized in that The step of determining the target point among mesh vertices of the target mesh corresponding to each of the original meshes includes: Determining a plurality of shadow points relative to the light source in the mesh vertex based on a positional relationship between the mesh vertex and a light source in the virtual scene, and a normal vector corresponding to the mesh vertex, wherein the normal vector is used to indicate a direction of the mesh vertex in the virtual scene; The target point is determined among the plurality of shadow points.

4. The method according to claim 3, characterized in that The step of determining the target point among the plurality of shadow points comprises: Determine shadow probabilities of the plurality of shadow points, wherein the shadow probability of any shadow point is used to indicate a probability that the any shadow point is located in a shadow; A point among the multiple shadow points whose shadow probability is greater than a probability threshold is taken as the target point.

5. The method according to claim 4, characterized in that Determining the shadow probabilities of the plurality of shadow points comprises: For any shadow point, sampling a first light ray from the light rays whose illumination direction points to the any shadow point; determining a first shadow intensity based on a first light intensity of the first light and a first transmittance degree of the first light on a path pointing to any one of the shadow points; Based on the first shadow intensity, a shadow probability of any shadow point is determined.

6. The method according to any one of claims 1 to 5, characterized in that: The obtaining the shadow rendering result of the virtual scene based on the shadow intensity of the target point includes: Obtaining the softness of the shadow to be rendered at the target point; updating the shadow intensity of the target point based on the softness to obtain an updated shadow intensity of the target point; Based on the updated shadow intensity of the target point, a shadow rendering result of the virtual scene is obtained.

7. The method according to claim 6, characterized in that The obtaining the softness of the shadow to be rendered at the target point comprises: Acquire target illumination information of the target point in the virtual scene and target depth information of the target point in the virtual scene; Calling a softness prediction model to predict the softness based on the target illumination information and the target depth information; The softness prediction model is trained based on sample illumination information of a sample point in a sample scene, sample depth information of the sample point in the sample scene, and a standard softness of a shadow to be rendered at the sample point.

8. The method according to claim 7, characterized in that The obtaining target lighting information of the target point in the virtual scene includes: Determine the number of times the target point is irradiated by the light, the initial sub-intensity of the target point each time the light is irradiated by the light, and the influencing parameter corresponding to the initial sub-intensity; Determining a target sub-intensity each time the target point is irradiated with light based on an initial sub-intensity each time the target point is irradiated with light and an influencing parameter corresponding to the initial sub-intensity; The target illumination information is determined based on the target sub-intensity each time the target point is illuminated by the light and the number of times the target point is illuminated by the light.

9. The method according to any one of claims 1 to 5, characterized in that: The obtaining the shadow rendering result of the virtual scene based on the shadow intensity of the target point includes: Rendering a shadow image based on the shadow intensity of the target point, wherein the shadow image includes a target pixel point corresponding to the target point, and a pixel value of the target pixel point is determined based on the shadow intensity of the target point; Based on the shadow image, a shadow rendering result of the virtual scene is obtained.

10. The method according to claim 9, characterized in that The step of obtaining a shadow rendering result of the virtual scene based on the shadow image includes: Performing at least one of pixel value optimization or shadow edge optimization on the shadow image to obtain an optimized shadow image; the pixel value optimization is used to optimize the pixel values ​​of the pixels in the shadow image; the shadow edge optimization is used to identify the edges of the shadows in the shadow image and connect the edges; The optimized shadow image is used as the shadow rendering result of the virtual scene.

11. The method according to claim 10, characterized in that The pixel value optimization includes at least one of averaging, filtering or masking; The averaging process is used to replace the pixel value of any pixel point in the shadow image with the average value of the pixel values ​​of each pixel point in the first reference area where the pixel point is located; The filtering process is used to replace the pixel value of any pixel point in the shadow image with the weighted value of the pixel values ​​of each pixel point in the second reference area where the pixel point is located; The occlusion processing is used to adjust the pixel value of any pixel point in the shadow image by using an occlusion coefficient, and the occlusion coefficient is used to indicate the occlusion degree of any pixel point by an object in the virtual scene.

12. The method according to any one of claims 1-5, 7-8, 10-11, characterized in that: The predicting, based on the scene information and the point information, the shadow intensity of the target point under the combined influence of light intensity and transmittance, comprises: The scene information and the point information are input into a shadow intensity prediction model to obtain the shadow intensity of the target point output by the shadow intensity prediction model; the shadow intensity prediction model is used to predict the shadow intensity of the target point under the combined influence of the light intensity and the transmittance based on the scene information and the point information.

13. A shadow rendering device, characterized in that: The device comprises: A first acquisition module, used to acquire scene information of a virtual scene and point information of a target point in the virtual scene, wherein the target point is a point in the virtual scene where a shadow is to be rendered; A second acquisition module is used to predict the shadow intensity of the target point under the combined influence of light intensity and transmittance based on the scene information and the point information, wherein the light intensity is the intensity of the light in the virtual scene whose illumination direction points to the target point, and the transmittance is the transmittance of the light on the path pointing to the target point; The third acquisition module is used to acquire the shadow rendering result of the virtual scene based on the shadow intensity of the target point.

14. A computer device, characterized in that: The computer device includes a processor and a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor, so that the computer device implements the shadow rendering method according to any one of claims 1 to 12.

15. A computer-readable storage medium, characterized in that: At least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by the processor to enable the computer to implement the shadow rendering method according to any one of claims 1 to 12.

16. A computer program product, characterized in that The computer program product comprises computer instructions, which are loaded and executed by a processor so as to enable a computer to implement the shadow rendering method according to any one of claims 1 to 12.