Compression storage method and device of shadow depth map, electronic equipment and program product
By dividing the shadow depth map into sub-images and using quadtree compression and storage, the problem of high computing resource consumption and large data volume when the terminal renders shadows in real time is solved, and the shadow rendering efficiency and user experience are improved.
Patent Information
- Application Number
- CN202410841709.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-24
AI Technical Summary
When rendering a virtual scene, the terminal consumes a lot of computing resources during real-time rendering of shadows. Especially on low-performance terminals, it may cause the frame rate to drop and affect the user experience. Moreover, when the lighting coverage is large, the amount of pre-calculated shadow depth map data is huge. , resulting in long rendering time and low efficiency.
By dividing the target bounding box into multiple sub-bounding boxes, and dividing the shadow depth map of each sub-bounding box into a shadow depth sub-map, a quadtree is used to compress and store the plane equation fitting parameters in the shadow depth sub-map, and store the corresponding shadow data and other data required for real-time rendering.
It significantly reduces the amount of data stored in the terminal, improves shadow rendering efficiency, shortens shadow rendering time, and improves user experience.
Smart Images

Figure CN118690032A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and program product for compressing and storing a shadow depth map. Background Art
[0002] In the process of rendering virtual scenes, the terminal can not only display the position of the light source, the shape of the object, and the state of motion through shadow rendering, but also enhance the realism and sense of space of the picture. However, the consumption of computing resources when the terminal renders shadows in real time is very high. Real-time rendering of shadows in low-performance terminals may cause the frame rate to drop, affecting the user experience. Therefore, how to improve the ability of terminals to render shadows in real time is a problem that needs to be solved.
[0003] Currently, terminals usually use shadow baking to pre-calculate and store the shadow depth map of the virtual scene before real-time shadow rendering, and directly sample the pre-calculated shadow depth map and generate the shadow of the virtual object during real-time shadow rendering. This method significantly reduces the amount of calculation in the process of real-time shadow rendering by the terminal and improves the terminal's ability to render shadows in real time.
[0004] However, when the lighting coverage in the virtual scene is large, the amount of data of the shadow depth map of the virtual scene pre-calculated by the terminal is very large, resulting in a long rendering time and low rendering efficiency in the process of real-time rendering of shadows. Summary of the invention
[0005] The embodiments of the present application provide a method, device, electronic device and program product for compressing and storing a shadow depth map. The terminal can compress and store multiple shadow depth sub-maps corresponding to each sub-bounding box through a quadtree, so that the amount of data stored by the terminal is greatly reduced, the shadow rendering efficiency is improved, and the shadow rendering time is shortened. The technical solution is as follows:
[0006] In one aspect, a method for compressing and storing a shadow depth map is provided, the method comprising:
[0007] For any sub-bounding box of the target bounding box, based on a first preset resolution, a shadow depth map of the sub-bounding box is divided into a plurality of shadow depth sub-maps, the target bounding box being a minimum bounding box that encloses a plurality of target virtual objects in the virtual scene, the sub-bounding boxes being obtained by evenly dividing the target bounding box, and the target virtual object being a virtual object to be rendered with a shadow among the plurality of virtual objects in the virtual scene;
[0008] For any shadow depth sub-image, compress and store the shadow depth sub-image in the form of a quadtree to obtain shadow data of the shadow depth sub-image, nodes at different levels in the quadtree are used to store plane equation fitting parameters of different image areas in the shadow depth sub-image, and the plane equation fitting parameters are used to fit a partial image area of the shadow depth sub-image through a plane equation, and any parent node in the quadtree corresponds to four child nodes, and the image area corresponding to the parent node is a square area range formed by the image areas corresponding to the four child nodes;
[0009] The shadow data of the multiple shadow depth sub-maps corresponding to the sub-bounding boxes, the camera parameters of the orthogonal camera corresponding to the sub-bounding boxes, the parameters of the target bounding box, and the lighting direction in the virtual scene are stored.
[0010] On the other hand, a compression storage device for a shadow depth map is provided, the device comprising:
[0011] A first division module is used for dividing the shadow depth map of any sub-bounding box of a target bounding box into a plurality of shadow depth sub-maps based on a first preset resolution, wherein the target bounding box is a minimum bounding box that encloses a plurality of target virtual objects in a virtual scene, and the sub-bounding boxes are obtained by evenly dividing the target bounding box, and the target virtual object refers to a virtual object to be rendered with a shadow among the plurality of virtual objects in the virtual scene;
[0012] A compression module, for compressing and storing any shadow depth sub-image in the form of a quadtree to obtain shadow data of the shadow depth sub-image, wherein nodes at different levels in the quadtree are used to store plane equation fitting parameters of different image areas in the shadow depth sub-image, and the plane equation fitting parameters are used to fit a partial image area of the shadow depth sub-image through a plane equation, wherein any parent node in the quadtree corresponds to four child nodes, and the image area corresponding to the parent node is a square area range formed by the image areas corresponding to the four child nodes;
[0013] A storage module is used to store shadow data of multiple shadow depth sub-maps corresponding to the sub-bounding boxes, camera parameters of the orthogonal camera corresponding to the sub-bounding boxes, parameters of the target bounding box, and the lighting direction in the virtual scene.
[0014] In some embodiments, the compression module comprises:
[0015] A division unit, used for dividing the shadow depth sub-image into four equal parts layer by layer to obtain image areas of different levels, wherein the image area of the next level is obtained by dividing the image area of the previous level into four equal parts;
[0016] A construction unit, used to construct nodes of each level in the quadtree in sequence from the top level to the bottom level based on the plane equation fitting parameters of the image area in each level, and the four image areas of any level correspond to the four nodes of the level in one-to-one correspondence;
[0017] The construction unit is further used to determine the constructed quadtree as the shadow data of the shadow depth sub-map.
[0018] In some embodiments, the construction unit is used to fit any image area at any level through a plane equation to obtain a fitting plane of the image area and plane equation fitting parameters of the image area; when the fitting plane of the image area meets a preset error condition, the plane equation fitting parameters of the image area are stored in a corresponding node of the level, and the step of dividing the image area into the next level is canceled; when the fitting plane of the image area does not meet the preset error condition, the image area is divided into four image areas of the next level; when the plane equation fitting parameters of all image areas in the shadow depth submap are stored in the nodes of the quadtree, the construction of the nodes of the quadtree is stopped.
[0019] In some embodiments, the construction unit is also used to fit any image area of the target level through a plane equation to obtain a fitting plane of the image area and plane equation fitting parameters of the image area, and the target level is used to indicate that the resolution of the image area is a second preset resolution, and the second preset resolution is smaller than the first preset resolution; when the fitting plane of the image area satisfies the preset error condition, the plane equation fitting parameters of the image area are stored in a corresponding node of the target level; when the fitting plane of the image area does not satisfy the preset error condition, the depth value of the pixel point in the image area is stored in the corresponding node of the target level.
[0020] In some embodiments, the apparatus further comprises:
[0021] A first rendering module, used for performing a first rendering on any sub-bounding box to obtain a first shadow depth map of the sub-bounding box;
[0022] A first determining module, configured to determine a maximum depth value and a minimum depth value in the first shadow depth map;
[0023] A second rendering module is used to render the sub-bounding box for a second time based on the maximum depth value and the minimum depth value to obtain a second shadow depth map of the sub-bounding box, wherein the depth value of any pixel point in the second shadow depth map is used to indicate whether the light passing through the corresponding position of the pixel point intersects with the target virtual object in the sub-bounding box, and the second shadow depth map is used to determine the multiple shadow depth sub-maps.
[0024] In some embodiments, the first rendering module is used to determine, for any sub-bounding box, camera parameters of a first orthogonal camera corresponding to the sub-bounding box, the viewing angle range of the first orthogonal camera encloses the sub-bounding box, and the camera parameters include a near section of the first orthogonal camera and a far section of the first orthogonal camera; and determine the first shadow depth map based on the distance between the target virtual object in the sub-bounding box and the first orthogonal camera.
[0025] In some embodiments, the second rendering module includes:
[0026] A first determining unit, configured to determine a first position and a second position in the virtual scene based on the maximum depth value and the minimum depth value, wherein the first position is a corresponding position of a pixel point of the maximum depth value in the virtual scene, and the second position is a corresponding position of a pixel point of the minimum depth value in the virtual scene;
[0027] The first determining unit is further used to determine a third position and a fourth position in the virtual scene based on the first position, the second position, the first dilation coefficient, and the second dilation coefficient, wherein the distance between the third position and the first orthogonal camera is obtained by multiplying the distance between the first position and the first orthogonal camera by the first dilation coefficient, and the distance between the fourth position and the first orthogonal camera is obtained by multiplying the distance between the second position and the first orthogonal camera by the second dilation coefficient, the viewing angle range of the first orthogonal camera surrounds the sub-bounding box, the first dilation coefficient is greater than 1, and the second dilation coefficient is less than 1;
[0028] a replacement unit, configured to replace the far cross section of the first orthogonal camera with a virtual plane passing through the third position and perpendicular to the illumination direction, and replace the near cross section of the first orthogonal camera with a virtual plane passing through the fourth position and perpendicular to the illumination direction, to obtain a second orthogonal camera;
[0029] The second determining unit is configured to determine the second shadow depth map based on the distance between the target virtual object in the sub-bounding box and the second orthogonal camera.
[0030] In some embodiments, the second determination unit is used to initialize the depth values of multiple pixels in the first shadow depth map to 1; for any pixel in the first shadow depth map, when a ray passing through the corresponding position of the pixel intersects with a target virtual object within the viewing angle of the second orthogonal camera, determine the distance between the intersection point and the second orthogonal camera; use the normalized distance as an updated depth value of the pixel, and the updated depth value is a value greater than 0 and less than 1; when the ray passing through the corresponding position of the pixel does not intersect with the target virtual object within the viewing angle of the second orthogonal camera, keep the depth value of the pixel as 1; and obtain the second shadow depth map when the depth values of the multiple pixels have been updated.
[0031] In some embodiments, the apparatus further comprises:
[0032] A second determination module is used to determine the position information of the target bounding box based on the light source coordinate system in the virtual scene, wherein a coordinate axis of the light source coordinate system is parallel to the illumination direction of the directional light in the virtual scene, and three sides on any vertex of the target bounding box are respectively parallel to the three coordinate axes of the light source coordinate system;
[0033] The second division module is used to evenly divide the target bounding box into multiple sub-bounding boxes based on preset volume parameters of the sub-bounding boxes, and the three sides on any vertex of the multiple sub-bounding boxes are respectively parallel to the three coordinate axes of the light source coordinate system.
[0034] In some embodiments, the second division module is used to evenly divide the surface of the target bounding box perpendicular to the illumination direction along the illumination direction based on the preset volume parameters of the sub-bounding boxes to obtain the multiple sub-bounding boxes, and the surface of each sub-bounding box perpendicular to the illumination direction is a square.
[0035] On the other hand, an electronic device is provided, comprising a processor and a memory, wherein the memory is used to store at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the compression storage method of the shadow depth map in the embodiment of the present application.
[0036] 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 to implement the compression storage method of the shadow depth map in the embodiment of the present application.
[0037] On the other hand, a computer program product is provided, including a computer program, wherein the computer program is executed by a processor to implement the method for compressing and storing a shadow depth map in an embodiment of the present application.
[0038] The present application provides a method for compressing and storing a shadow depth map. The terminal divides the target bounding box into multiple sub-bounding boxes, and divides the shadow depth map of each sub-bounding box into shadow depth sub-maps. Then, the plane equation fitting parameters corresponding to each shadow depth sub-map are stored in a quadtree to obtain the corresponding shadow data, and the shadow data is stored together with other data required in the process of real-time rendering of shadows. Compared with directly storing the shadow depth map of the entire virtual scene, this method uses a quadtree to store the plane equation fitting parameters of multiple shadow depth sub-maps corresponding to each sub-bounding box, which greatly reduces the amount of data stored in the terminal, improves the shadow rendering efficiency, and shortens the shadow rendering time. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] 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.
[0040] Figure 1 It is a schematic diagram of an implementation environment of a compression storage method of a shadow depth map provided in an embodiment of the present application;
[0041] Figure 2 is a flowchart of a method for compressing and storing a shadow depth map provided in an embodiment of the present application;
[0042] Figure 3 is a flowchart of another method for compressing and storing a shadow depth map provided in an embodiment of the present application;
[0043] Figure 4 is a schematic diagram of dividing a target bounding box according to an embodiment of the present application;
[0044] Figure 5 is a schematic diagram of drawing a shadow depth map according to an embodiment of the present application;
[0045] Figure 6 is a schematic diagram of dividing a shadow depth map according to an embodiment of the present application;
[0046] Figure 7 is a block diagram of a compression storage device for a shadow depth map provided according to an embodiment of the present application;
[0047] Figure 8is a block diagram of another shadow depth map compression storage device provided according to an embodiment of the present application;
[0048] Fig. 9 is a schematic diagram of the structure of a terminal provided according to an embodiment of the present application;
[0049] Fig.10 It is a structural diagram of a server provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0050] 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.
[0051] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with basically the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on quantity and execution order.
[0052] In the present application, the term "at least one" means one or more, and the term "plurality" means two or more.
[0053] 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 relevant countries and regions. For example, the virtual scenes and virtual objects involved in this application are all obtained with full authorization.
[0054] Figure 1 is a schematic diagram of an implementation environment of a compression storage method for a shadow depth map provided in an embodiment of the present application. Figure 1 The implementation environment includes a terminal 101 and a server 102. The terminal 101 and the server 102 can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0055] In some embodiments, the terminal 101 is a mobile phone, a desktop computer, a laptop computer, a tablet computer, a smart watch, a vehicle-mounted terminal, and other types of terminals. An application can be installed and run on the terminal 101. The application stores multiple shadow depth sub-maps corresponding to each sub-bounding box through quadtree compression, which greatly reduces the amount of data stored in the terminal and improves the shadow rendering efficiency. The application is associated with the server 102, and the server 102 provides background services to the terminal 101.
[0056] In some embodiments, server 102 is an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0057] In some embodiments, the server 102 undertakes the main computing work and the terminal 101 undertakes the secondary computing work; or, the server 102 undertakes the secondary computing work and the terminal 101 undertakes the main computing work; or, the server 102 and the terminal 101 adopt a distributed computing architecture to perform collaborative computing.
[0058] Figure 2 is a flowchart of a method for compressing and storing a shadow depth map according to an embodiment of the present application, the method being executed by a terminal, see Figure 2 , the method comprises the following steps:
[0059] 201. For any sub-bounding box of a target bounding box, based on a first preset resolution, divide the shadow depth map of the sub-bounding box into multiple shadow depth sub-maps, the target bounding box is a minimum bounding box that encloses multiple target virtual objects in a virtual scene, and the sub-bounding boxes are obtained by evenly dividing the target bounding box.
[0060] In an embodiment of the present application, the target virtual object refers to a virtual object whose shadow is to be rendered among multiple virtual objects in a virtual scene. The first preset resolution is used to indicate the size of each shadow depth sub-map. Typically, the shadow depth sub-map is set to a resolution that is an integer power of two. For example, a sub-bounding box corresponds to a shadow depth map with a resolution of 2048*2048, and the first preset resolution is 128*128. At this time, the terminal evenly divides the shadow depth map into 256 shadow depth sub-maps based on the first preset resolution.
[0061] 202. For any shadow depth sub-image, compress and store the shadow depth sub-image in the form of a quadtree to obtain shadow data of the shadow depth sub-image, and nodes at different levels in the quadtree are used to store plane equation fitting parameters of different image areas in the shadow depth sub-image.
[0062] In an embodiment of the present application, the plane equation fitting parameters are used to fit a partial image area of a shadow depth sub-map through a plane equation. There are four child nodes corresponding to any parent node in the quadtree, and the image area corresponding to the parent node is a square area range composed of the image areas corresponding to the four child nodes. The quadtree has the characteristics of clear structure and easy understanding. The shadow depth sub-map is efficiently represented in a hierarchical manner through the quadtree structure, which can reduce data storage costs and improve data reading efficiency. Compared with the amount of data corresponding to the depth values of all pixels in the image area, the amount of data of the plane equation fitting parameters corresponding to the image area is smaller. Therefore, compared with directly storing the depth value, the storage space occupied by storing the plane equation fitting parameters in this way is smaller, which is conducive to the subsequent reading and application of the shadow depth sub-map, and improves the rendering efficiency of real-time rendering.
[0063] 203. Store shadow data of multiple shadow depth sub-maps corresponding to the sub-bounding boxes, camera parameters of the orthogonal camera corresponding to the sub-bounding boxes, parameters of the target bounding box, and the lighting direction in the virtual scene.
[0064] In the embodiment of the present application, the camera parameters of the orthogonal camera may include parameters such as near section, far section, position, orientation, etc. The parameters of the target bounding box may be vertex coordinates. The illumination direction in the virtual scene is used to determine the light source coordinate system.
[0065] The embodiment of the present application provides a method for compressing and storing a shadow depth map, in which the terminal divides the target bounding box into multiple sub-bounding boxes, and divides the shadow depth map of each sub-bounding box into shadow depth sub-maps, and then stores the plane equation fitting parameters corresponding to each shadow depth sub-map in a quadtree to obtain the corresponding shadow data, and stores the shadow data together with other data required in the process of real-time rendering of shadows. Compared with directly storing the shadow depth map of the entire virtual scene, this method uses a quadtree to store the plane equation fitting parameters of multiple shadow depth sub-maps corresponding to each sub-bounding box, which greatly reduces the amount of data stored in the terminal, improves the shadow rendering efficiency, and shortens the shadow rendering time.
[0066] Figure 3 is a flowchart of another method for compressing and storing a shadow depth map according to an embodiment of the present application, the method being executed by a terminal, see Figure 3 , the method comprises the following steps:
[0067] 301. Based on the light source coordinate system in the virtual scene, determine the position information of a target bounding box, where the target bounding box is a minimum bounding box that encloses multiple target virtual objects in the virtual scene, and the target virtual object refers to a virtual object whose shadow is to be rendered among the multiple virtual objects in the virtual scene.
[0068] In an embodiment of the present application, a coordinate axis of the light source coordinate system is parallel to the illumination direction of the directional light in the virtual scene. Directional light refers to multiple rays of light parallel to each other, and directional light is usually used to simulate the illumination effect of sunlight. Normally, the terminal can use a direction vector to represent the illumination direction of the directional light in the virtual scene. The terminal uses the illumination direction of the directional light to form the Z axis of the light source coordinate system, selects a pair of mutually perpendicular orthogonal axes on a plane perpendicular to the illumination direction as the X axis and Y axis of the light source coordinate system, and uses the formed Cartesian coordinate system as the light source coordinate system.
[0069] Among them, the three edges on any vertex of the target bounding box are parallel to the three coordinate axes of the light source coordinate system. Usually, the target bounding box is a cuboid. Two surfaces of the target bounding box are perpendicular to the illumination direction, and the remaining four surfaces of the target bounding box are parallel to the illumination direction. For ease of description, the target bounding box may also be referred to as LWB (Light World Bounding). The user can configure the illumination direction of the directional light in the virtual scene by himself to obtain the target bounding box under different directional lights. It should be noted that the position information of the target bounding box may include the coordinates of each vertex of the target bounding box, the center coordinates of the target bounding box, etc., which is not limited in the embodiments of the present application.
[0070] In some embodiments, the user can determine the target virtual object by configuring the area range of the shadow to be rendered in the virtual scene and selecting the type of virtual object for the shadow to be rendered. The target virtual object can be single or multiple. Optionally, the user sets the area range to the entire virtual scene, and the user sets the virtual object type to a static virtual object, a virtual terrain object, and a partial virtual vegetation object. Normally, due to the large number of mesh faces and high complexity on the three-dimensional model of the virtual vegetation object, the rendering efficiency will be greatly reduced during real-time rendering. Therefore, the shadow of the virtual vegetation object is usually configured as static. At this time, the terminal can determine the shadow data of the virtual vegetation object by the method in the embodiment of the present application. For virtual vegetation objects with large deformation amplitude or large impact on the picture, the terminal can obtain its shadow data by real-time rendering, which will not be repeated here.
[0071] 302. Based on preset volume parameters of the sub-bounding boxes, evenly divide the target bounding box into a plurality of sub-bounding boxes.
[0072] In an embodiment of the present application, the three edges on any vertex of the sub-bounding box are parallel to the three coordinate axes of the light source coordinate system. Usually, the sub-bounding box is a cuboid. Two surfaces of the sub-bounding box are perpendicular to the illumination direction, and the remaining four surfaces of the sub-bounding box are parallel to the illumination direction. A sub-bounding box refers to an independent unit for rendering a shadow depth map, and each sub-bounding box has its own associated orthogonal camera's camera parameters. Usually, the camera parameters of orthogonal cameras associated with different sub-bounding boxes are different. For ease of description, the sub-bounding box may also be referred to as LWC (Light World Cell). The user can divide the target bounding box in a diversified manner by configuring the size of the preset volume parameters by himself, and obtain sub-bounding boxes of different sizes and numbers. It should be noted that the preset volume parameters of the sub-bounding box may include the size of each side length of the sub-bounding box, the area of each surface, etc., and the embodiment of the present application does not limit this.
[0073] It should be noted that the area of the shadow to be rendered corresponding to the directional light in the virtual scene is large, and the inclination angle of the directional light may be large, for example, the directional light in the sunset. At this time, after the terminal directly draws the shadow depth map for the target bounding box corresponding to the entire virtual scene, the distance difference between the position corresponding to the minimum depth value and the position corresponding to the maximum depth value in the shadow depth map will be very large. When the terminal uses floating-point numbers to represent the numerical range with very large differences, the problem of insufficient precision of the floating-point numbers may occur, which in turn leads to striped shadow defects in the process of real-time rendering of shadows, which greatly reduces the performance of the shadow rendering picture. Among them, floating-point numbers are computer data formats for representing real numbers. Compared with the method of directly drawing a shadow depth map for the target bounding box corresponding to the entire virtual scene, this method divides the target bounding box into sub-bounding boxes evenly in the light source coordinate system, and then draws a shadow depth map for each sub-bounding box, which can not only obtain shadow data with higher distribution accuracy of floating-point numbers, but also avoid the problem of striped shadow defects caused by floating-point errors in the process of real-time rendering of shadows. At the same time, since the terminal can draw the shadow depth map for each sub-bounding box independently, the above parallel processing method not only improves the drawing efficiency of the shadow depth map, but also reduces the calculation complexity.
[0074] In some embodiments, the target bounding box can be divided as follows. Accordingly, the terminal evenly divides the surface of the target bounding box perpendicular to the illumination direction along the illumination direction based on the preset volume parameters of the sub-bounding boxes to obtain multiple sub-bounding boxes, and the surface of each sub-bounding box perpendicular to the illumination direction is a square. It should be noted that the above method is only an exemplary division method, and the application embodiment does not limit this.
[0075] See also Figure 4 As shown, Figure 4401 is a schematic diagram of dividing a target bounding box according to an embodiment of the present application, wherein 401 indicates a directional light in a virtual scene. Figure 4 402 in (a) is the target bounding box before segmentation. Figure 4 403 in (b) is a sub-bounding box obtained by evenly dividing the target bounding box.
[0076] It should be noted that by evenly dividing the target bounding box, the terminal can obtain multiple sub-bounding boxes of regular shape and uniform size. The terminal can independently draw a shadow depth map for each sub-bounding box. The above parallel processing method not only improves the efficiency of drawing the shadow depth map, but also reduces the computational complexity. In addition, since the shape of the sub-bounding box is regular, the terminal can simplify the algorithm for shadow calculation and further reduce the amount of calculation.
[0077] 303. Perform a first rendering on any sub-bounding box to obtain a first shadow depth map of the sub-bounding box.
[0078] In an embodiment of the present application, the terminal renders the sub-bounding box twice to obtain the shadow depth map of the bounding box to be stored. For ease of description, the process of the terminal rendering the sub-bounding box twice is called a double-pass rendering method. The terminal can process multiple sub-bounding boxes in parallel at the same time, or it can process multiple sub-bounding boxes in sequence. Optionally, for any sub-bounding box, the terminal determines the position of the orthogonal camera, and then stores the distance between the target virtual object in the sub-bounding box and the orthogonal camera in the shadow depth map. Correspondingly, the depth value of each pixel in the shadow depth map is used to represent the distance from the orthogonal camera to the nearest visible surface in the corresponding virtual scene. Among them, the orthogonal camera uses the orthogonal projection mode to render the scene. Orthogonal projection is a parallel projection. When an object is projected onto a projection plane, no matter how far or close the object is from the projection plane, the size on the projection plane is always unchanged, that is, the orthogonal projection has no perspective effect.
[0079] In some embodiments, the terminal determines the camera parameters of the orthogonal camera corresponding to the sub-bounding box for different sub-bounding boxes. Accordingly, for any sub-bounding box, the terminal determines the camera parameters of the first orthogonal camera corresponding to the sub-bounding box, the viewing angle range of the first orthogonal camera encloses the sub-bounding box, and the camera parameters include the near section of the first orthogonal camera and the far section of the first orthogonal camera; the terminal determines the first shadow depth map based on the distance between the target virtual object in the sub-bounding box and the first orthogonal camera. Among them, the parameters of the first orthogonal camera generally also include position, orientation, aspect ratio, zoom factor, etc., which are not described in detail here.
[0080] It should be noted that compared with the method in which the terminal draws the shadow depth map for the entire virtual scene, in this method, the terminal determines the orthogonal camera for each sub-bounding box separately and draws the shadow depth map for each sub-bounding box separately, which is more flexible and controllable. In addition, since the terminal only draws the shadow depth map for the target virtual object in the sub-bounding box, the rendering of the area outside the sub-bounding box can be reduced, thereby saving computing resources and improving rendering efficiency.
[0081] 304. Determine a maximum depth value and a minimum depth value in the first shadow depth map.
[0082] In an embodiment of the present application, the depth value of the pixel in the first shadow depth map is used to indicate the distance from the first orthogonal camera to the nearest visible surface in the sub-bounding box. Typically, the depth value of the pixel in the shadow depth map is a normalized value. Optionally, the depth value is limited to the range of [0, 1]. Among them, 0 usually corresponds to the closest distance to the orthogonal camera, and 1 usually corresponds to the farthest distance from the orthogonal camera. For example, the closest distance corresponding to 0 is 100 meters, and the farthest distance corresponding to 1 is 200 meters.
[0083] To facilitate the description of the relationship between the sub-bounding box and the shadow depth map, see Figure 5 As shown, Figure 5 is a schematic diagram of drawing a shadow depth map according to an embodiment of the present application. Figure 5 As shown in (a), 501 is used to indicate the illumination direction of the directional light in the virtual scene. 502 is a projection plane, and the projection plane is perpendicular to the illumination direction of the directional light. Optionally, the first orthogonal camera is located at 502. The cuboid shown in 503 is the viewing angle range of the first orthogonal camera corresponding to any sub-bounding box. The viewing angle range can completely surround the sub-bounding box. 504 is the target virtual object in the viewing angle range. 505 is used to indicate the closest distance between the target virtual object in the sub-bounding box and the first orthogonal camera. At this time, the closest distance is 100 meters, and the normalized depth value of the closest distance is 0; 506 is used to indicate the farthest distance between the target virtual object in the sub-bounding box and the first orthogonal camera. At this time, the farthest distance is 200 meters, and the normalized depth value of the farthest distance is 1; 507 is used to indicate the situation where there is no target virtual object at the corresponding position in the sub-bounding box. At this time, the depth value is the default depth value of 1.
[0084] It should be noted that, since the light can directly pass through a certain position in the sub-bounding box when there is no target virtual object, the terminal determines that there is no nearest visible surface at the position and sets the depth value corresponding to the position to the default depth value. For example, the terminal sets the default depth value to 1. At this time, when the depth value of a pixel point in the shadow depth map is 1, the corresponding position of the pixel point may not have a target virtual object, or it may correspond to the situation where the visible surface of the target virtual object is the farthest from the orthogonal camera, which will interfere with the subsequent process of determining the shadow of the target virtual object through the shadow depth map.
[0085] 305. Based on the maximum depth value and the minimum depth value, render the sub-bounding box for the second time to obtain a second shadow depth map of the sub-bounding box, where the depth value of any pixel point in the second shadow depth map is used to indicate whether the light passing through the corresponding position of the pixel point intersects with the target virtual object in the sub-bounding box.
[0086] In an embodiment of the present application, the terminal redetermines the camera parameters of the orthogonal camera based on the maximum depth value and the minimum depth value, and re-renders the sub-bounding box to obtain a second shadow map of the sub-bounding box. It should be noted that by rendering the sub-bounding box multiple times, the terminal can obtain a second shadow depth map with higher precision and accuracy. Accordingly, the terminal can distinguish whether there is a target virtual object at a specific position in the virtual scene based on the depth value of the pixel point in the second shadow depth map, thereby avoiding the problem of miscalculating shadows in the process of real-time rendering shadows.
[0087] In some embodiments, the terminal re-determines the near section and the far section of the orthographic camera according to the maximum depth value and the minimum depth value, as shown in the following steps A to D.
[0088] Step A: The terminal determines a first position and a second position in the virtual scene based on the maximum depth value and the minimum depth value. The first position is the corresponding position of the pixel point with the minimum depth value in the virtual scene, and the second position is the corresponding position of the pixel point with the maximum depth value in the virtual scene. To facilitate the description of the process of the terminal re-determining the near section and the far section of the orthogonal camera, see Figure 5 As shown, Figure 5 is a schematic diagram of drawing a shadow depth map according to an embodiment of the present application. Figure 5 (b), 510 is used to indicate the first position, and Figure 5 520 is used to indicate the second position, which corresponds to 505 in (a). Figure 5 This corresponds to the situation 506 in (a).
[0089] Step B: The terminal determines a third position and a fourth position in the virtual scene based on the first position, the second position, the first expansion coefficient, and the second expansion coefficient. The distance between the third position and the first orthogonal camera is obtained by multiplying the distance between the first position and the first orthogonal camera by the first expansion coefficient, the distance between the fourth position and the first orthogonal camera is obtained by multiplying the distance between the second position and the first orthogonal camera by the second expansion coefficient, the viewing range of the first orthogonal camera encloses the sub-bounding box, the first expansion coefficient is less than 1, and the second expansion coefficient is greater than 1. See Figure 5 As shown in (b), 530 is used to indicate the third position, and 540 is used to indicate the fourth position. Optionally, the straight line passing through 510 and 530 is perpendicular to the projection plane, and the straight line passing through 520 and 540 is perpendicular to the projection plane.
[0090] Step C: The terminal replaces the far section of the first orthogonal camera with a virtual plane passing through the third position and perpendicular to the illumination direction, and replaces the near section of the first orthogonal camera with a virtual plane passing through the fourth position and perpendicular to the illumination direction, to obtain a second orthogonal camera. Figure 5 As shown in (b), the virtual plane passing through 530 and perpendicular to the illumination direction is the near cross section of the second orthogonal camera, and the virtual plane passing through 540 and perpendicular to the illumination direction is the far cross section of the second orthogonal camera.
[0091] In some embodiments, the second orthogonal camera has a viewing angle range that is smaller than the viewing angle range of the first orthogonal camera. Figure 5 As shown in (a), 508 is used to indicate the near section of the first orthogonal camera, and 509 is used to indicate the far section of the first orthogonal camera. The viewing angle range indicated by 530 and 540 is smaller than the viewing angle range indicated by 508 and 509. At this time, after the terminal re-determines the near section and the far section of the orthogonal camera according to the maximum depth value and the minimum depth value, the viewing angle range of the orthogonal camera is reduced.
[0092] Step D: The terminal determines a second shadow depth map based on the distance between the target virtual object in the sub-bounding box and the second orthogonal camera.
[0093] It should be noted that the terminal determines the third position and the fourth position by the first expansion coefficient and the second expansion coefficient, and then updates the near section and the far section of the orthogonal camera, which is only an exemplary way to expand the viewing angle range of the orthogonal camera. Optionally, the terminal can directly calculate the distance between the updated near section and the orthogonal camera and the distance between the updated far section and the orthogonal camera based on the expansion parameters, or the terminal can directly determine the position of the updated near section and the position of the updated far section based on the expansion parameters.
[0094] For example, the expansion parameter is 1%, the closest distance is 100 meters, and the farthest distance is 200 meters. At this time, the terminal determines that the near section is expanded by 1 meter relative to the closest distance, and the far section is expanded by 1 meter relative to the farthest distance. Correspondingly, the terminal determines that the near section of the second orthogonal camera is located at 99 meters from the second orthogonal camera, and the terminal determines that the near section of the second orthogonal camera is located at 201 meters from the second orthogonal camera. It should be noted that since the distance range between the closest distance and the farthest distance after expansion is smaller than the distance range between the near section and the far section, after the distance is normalized, the depth value corresponding to the closest distance is greater than 0, and the depth value corresponding to the farthest distance is less than 1. In other words, at this time, the terminal can set the depth value to 1 or the depth value to 0 to indicate that there is no virtual object at the corresponding position.
[0095] It should be noted that by adjusting the far section and near section of the orthogonal camera according to the maximum depth value and the minimum depth value, it can be ensured that the viewing angle of the orthogonal camera more accurately surrounds the target virtual object in the sub-bounding box, and the rendering of the area outside the area where the target virtual object in the sub-bounding box is located can be avoided, thereby saving computing resources and improving rendering efficiency. In addition, the terminal can distinguish whether there is a target virtual object at a specific position in the virtual scene based on the depth value of the pixel point in the second shadow depth map, thereby avoiding the problem of miscalculating shadows in the process of real-time rendering shadows.
[0096] In some embodiments, the terminal sets the depth value of the corresponding position where there is no virtual object to 1. Accordingly, the terminal initializes the depth values of multiple pixels in the first shadow depth map to 1; for any pixel in the first shadow depth map, the terminal determines the distance between the intersection point and the second orthogonal camera when the light passing through the corresponding position of the pixel intersects with the target virtual object within the viewing angle of the second orthogonal camera; the terminal uses the normalized distance as the updated depth value of the pixel, and the updated depth value is a value greater than 0 and less than 1; the terminal maintains the depth value of the pixel as 1 when the light passing through the corresponding position of the pixel does not intersect with the target virtual object within the viewing angle of the second orthogonal camera; the terminal obtains the second shadow depth map when the depth values of multiple pixels have been updated.
[0097] It should be noted that by initializing the depth values of all pixels in the first shadow depth map to 1, a unified and clear starting point can be provided for subsequent processing. By determining whether the light passing through the corresponding position of each pixel intersects with the target virtual object, the terminal can accurately determine the depth value of the pixel in the shadow depth map. In the case of an intersection, the terminal updates the depth value of the pixel; in the case of no intersection, the terminal maintains the depth value of the pixel as the default depth value 1. At this time, the terminal determines that there is no target virtual object at the corresponding position in the virtual scene. The above method makes it easy for the terminal to distinguish whether there is a target virtual object at a certain position in the virtual space. It can also be said to facilitate the terminal to distinguish between shadow areas and non-shadow areas, making the shadow depth map clearer and easier to understand.
[0098] 306. Divide the second shadow depth map of the sub-bounding box into a plurality of shadow depth sub-maps based on a first preset resolution.
[0099] In an embodiment of the present application, the first preset resolution is used to indicate the size of each shadow depth sub-map. To facilitate the subsequent compression and storage of the shadow depth sub-map by a quadtree, the shadow depth sub-map is usually set to a square whose resolution satisfies an integer power of two. For ease of description, the shadow depth sub-map may also be referred to as a square tile. For example, a sub-bounding box corresponds to a second shadow depth map with a resolution of 2048*2048, and the first preset resolution is 128*128. At this time, the terminal evenly divides the second shadow depth map into 256 shadow depth sub-maps based on the first preset resolution.
[0100] 307. For any shadow depth sub-image, compress and store the shadow depth sub-image in the form of a quadtree to obtain shadow data of the shadow depth sub-image, and nodes at different levels in the quadtree are used to store plane equation fitting parameters of different image areas in the shadow depth sub-image.
[0101] In an embodiment of the present application, the plane equation fitting parameters are used to fit a partial image area of the shadow depth sub-map through a plane equation. The plane equation fitting method is used to determine the optimal fitting plane. Optionally, the fitting plane passes through a set of reference points in a three-dimensional space. The plane equation of the fitting plane can be expressed as Ax+By+Cz+D=0. Among them, A, B, and C are the normal vectors of the plane, and D is the distance from the origin of the coordinate system to the fitting plane along the normal direction. In an embodiment of the present application, the terminal determines the corresponding positions of multiple pixel points in the image area to be fitted in the sub-bounding box, and determines the multiple corresponding positions as multiple reference points. At this time, the terminal can determine the depth values of the multiple pixel points based on the correspondence between the multiple reference points and the multiple pixel points; the terminal can also calculate the depth values of the multiple reference points based on the distance between the multiple reference points and the orthogonal camera. Then, the terminal determines the fitting plane based on the coordinates of the multiple reference points, and determines the parameters such as A, B, C, and D in the plane equation of the fitting plane as the plane equation fitting parameters. It should be noted that the coordinates of multiple reference points may refer to coordinates in a light source coordinate system or coordinates in a world coordinate system, and the embodiments of the present application do not limit this.
[0102] In some embodiments, the terminal constructs a quadtree from the top level to the bottom level by dividing the shadow depth sub-map into four equal parts layer by layer. There are four child nodes corresponding to any parent node in the quadtree, and the image area corresponding to the parent node is a square area range formed by the image areas corresponding to the four child nodes. Accordingly, the terminal divides the shadow depth sub-map into four equal parts layer by layer to obtain image areas of different levels, and the image area of the next level is obtained by dividing the image area of the previous level into four equal parts; the terminal constructs the nodes of each level in the quadtree from the top level to the bottom level based on the plane equation fitting parameters of the image area in each level, and the four image areas of any level correspond one-to-one to the four nodes of the level; the constructed quadtree is determined as the shadow data of the shadow depth sub-map.
[0103] To facilitate the description of the correspondence between the image area in the shadow depth submap and the nodes in the quadtree, see Figure 6 As shown, Figure 6 is a schematic diagram of dividing a shadow depth map according to an embodiment of the present application. Figure 6 (a) is a shadow depth sub-image, Figure 6(b) is the quadtree corresponding to the shadow depth sub-image. The entire shadow depth sub-image corresponding to the parent node 0-1 is composed of the image areas corresponding to the child nodes 1-1 to 1-4. Among them, the plane equation fitting parameters corresponding to the image area 1-1 are stored in the node 1-1, and the plane equation fitting parameters corresponding to the image area 1-4 are stored in the node 1-4. The plane equation fitting parameters are not stored in the nodes 1-2 and 1-3. The image area corresponding to the parent node 1-2 is composed of the image areas corresponding to the child nodes 2-1 to 2-4. The image area corresponding to the parent node 1-3 is composed of the image areas corresponding to the child nodes 2-5 to 2-8. The plane equation fitting parameters are not stored in the node 2-3. The image area corresponding to the parent node 2-3 is composed of the image areas corresponding to the child nodes 3-1 to 3-4.
[0104] It should be noted that by using a quadtree to store the plane equation fitting parameters of multiple image areas in the shadow depth submap, efficient compression storage of the shadow depth submap is achieved. The quadtree has the characteristics of clear structure and easy to understand. The shadow depth submap is efficiently represented in a hierarchical manner through the quadtree structure, which not only facilitates subsequent data processing and data query steps, but also reduces data storage costs and improves data reading efficiency. Accordingly, in the process of real-time rendering of shadows, when it is necessary to sample the shadow depth submap, the terminal can quickly locate the corresponding node in the quadtree according to the information of the sampling point, and read the depth value corresponding to the sampling point.
[0105] In some embodiments, the terminal determines whether to continue to divide the image area to the next level by the relationship between the fitting plane and the preset error condition. Accordingly, for any image area at any level, the terminal fits the image area by the plane equation to obtain the fitting plane of the image area and the plane equation fitting parameters of the image area; when the fitting plane of the image area meets the preset error condition, the terminal stores the plane equation fitting parameters of the image area in the corresponding node of the level and cancels the step of dividing the image area into the next level; when the fitting plane of the image area does not meet the preset error condition, the terminal divides the image area into four image areas of the next level; when the plane equation fitting parameters of all image areas in the shadow depth submap are stored in the nodes of the quadtree, the terminal stops constructing the nodes of the quadtree.
[0106] Optionally, after determining the fitting plane, the terminal randomly selects multiple prediction points in the fitting plane, and projects the multiple prediction points into the shadow depth submap, thereby determining the depth values of the multiple pixels based on the correspondence between the multiple prediction points and the multiple pixels in the shadow depth submap. Then, the terminal determines whether the fitting plane meets the preset error condition by comparing the gap between the calculated depth values of the multiple prediction points and the depth values of the multiple pixels. It should be noted that the above method is only an exemplary method for determining whether the fitting plane meets the preset error condition, and the embodiments of the present application are not limited to this.
[0107] For ease of description, the correspondence between the image area in the shadow depth submap and the nodes in the quadtree is shown in Figure 6 As shown, Figure 6 It is a schematic diagram of dividing a shadow depth map according to an embodiment of the present application. The terminal first fits the entire shadow depth sub-image 0-1 through a plane equation to obtain the fitting plane of the entire shadow depth sub-image 0-1 and the plane equation fitting parameters of the image area. Since the fitting plane of the entire shadow depth sub-image 0-1 does not meet the preset error condition, the terminal does not store the plane equation fitting parameters of the entire shadow depth sub-image 0-1 in node 0-1, but divides the entire shadow depth sub-image 0-1 equally into four image areas 1-1 to 1-4 of the next level. Then, since the fitting planes corresponding to image area 1-1 and image area 1-4 respectively meet the preset error conditions, the plane equation fitting parameters are stored in nodes 1-1 and 1-4 respectively. Since the fitting planes corresponding to image area 1-2 and image area 1-3 respectively do not meet the preset error conditions, the terminal divides image area 1-2 equally into four image areas 2-1 to 2-4 of the next level, and divides image area 1-3 equally into four image areas 2-5 to 2-8 of the next level. Then, the terminal continues to repeat the above steps according to the relationship between the fitting plane corresponding to the image area and the preset error condition, so as to sequentially construct the nodes of each level in the quadtree. When the plane equation fitting parameters of all image areas in the shadow depth sub-image are stored in the nodes of the quadtree, for example, when the fitting planes corresponding to image areas 3-1 to 3-4 respectively meet the preset error conditions, the terminal stops constructing the nodes of the quadtree.
[0108] It should be noted that when fitting each image area through a plane equation, fewer levels and nodes can be used for image areas with smooth depth value changes, while areas with complex depth value changes can be further subdivided to obtain a more accurate fitting plane. Compared with directly storing depth values, this method can not only reflect the changing trend and overall characteristics of depth values in different image areas through fitting planes, but also realize flexible data storage under the premise of ensuring data accuracy. At the same time, when the fitting plane of the image area meets the preset error condition, the plane equation fitting parameters of the image area are stored in the corresponding nodes, and further division is cancelled, which not only significantly reduces unnecessary nodes and levels, but also avoids the waste of storage space. In addition, since the data volume of the plane equation fitting parameters corresponding to the image area is smaller than the data volume of the depth values of all pixels in the image area, the storage space occupied by storing the plane equation fitting parameters in this way is smaller than that of directly storing the depth values, which is conducive to the subsequent reading and application of the shadow depth sub-map, and improves the rendering efficiency of real-time rendering.
[0109] In some embodiments, after the terminal divides the shadow depth submap into the target level, it will no longer continue to divide into the next level. Accordingly, for any image area of the target level, the terminal fits the image area through the plane equation to obtain the fitting plane of the image area and the plane equation fitting parameters of the image area. The target level is used to indicate that the resolution of the image area is a second preset resolution, and the second preset resolution is less than the first preset resolution; when the fitting plane of the image area meets the preset error condition, the terminal stores the plane equation fitting parameters of the image area in the corresponding node of the target level; when the fitting plane of the image area does not meet the preset error condition, the terminal stores the depth value of the pixel point in the image area in the corresponding node of the target level. Usually, the terminal sets the second preset resolution to a smaller resolution to facilitate the conversion of more image areas in the shadow depth submap into fitting planes. For example, the second preset resolution is 4*4.
[0110] It should be noted that by setting different second preset resolutions and preset error conditions, the accuracy of shadow data can be flexibly adjusted. When the user needs to store shadow data with higher accuracy, the user can set a higher second preset resolution and a stricter preset error condition, so that more depth values are stored in the quadtree; correspondingly, when the user needs to store shadow data with a smaller amount of data, the user can set a lower second preset resolution and a looser preset error condition, so that more plane equation fitting parameters are stored in the quadtree. In the above manner, the user can select an appropriate second preset resolution and preset error condition according to actual application requirements, thereby balancing the relationship between the accuracy and data volume of shadow data, and optimizing the use of storage and computing resources while ensuring data accuracy.
[0111] 308. Store shadow data of multiple shadow depth sub-maps corresponding to the sub-bounding boxes, camera parameters of the orthogonal camera corresponding to the sub-bounding boxes, parameters of the target bounding box, and the lighting direction in the virtual scene.
[0112] In an embodiment of the present application, after the shadow depth sub-map of the sub-bounding box is stored by quadtree compression, the terminal obtains the compressed shadow data and stores it in a preset storage space, thereby greatly reducing the required storage space. For example, in the traditional way, for a virtual scene of 1000 meters * 1000 meters in size, when each area of 1 meter * 1 meter in size is stored using a shadow depth map of 100 * 100 resolution, and a single pixel is stored as a 4-byte (32-bit) floating point number, then the storage required for the shadow depth map corresponding to the entire virtual scene is about 37.25GB. However, the method provided by the embodiment of the present application can compress the storage required for the shadow depth map corresponding to the virtual scene to the order of magnitude below 100MB. Optionally, the terminal can also store the camera parameters of the second orthogonal camera, the vertex coordinates of the target bounding box, and the parameters related to the light source coordinate system. Optionally, the terminal stores the above data in a local storage space, and in the subsequent real-time rendering of the shadow, the above data is transferred to the video memory on the graphics card at one time, so that it can be used in real time in the shader program of the graphics card.
[0113] The embodiment of the present application provides a method for compressing and storing a shadow depth map, in which the terminal divides the target bounding box into multiple sub-bounding boxes, and divides the shadow depth map of each sub-bounding box into shadow depth sub-maps, and then stores the plane equation fitting parameters corresponding to each shadow depth sub-map in a quadtree to obtain the corresponding shadow data, and stores the shadow data together with other data required in the process of real-time rendering of shadows. Compared with directly storing the shadow depth map of the entire virtual scene, this method uses a quadtree to store the plane equation fitting parameters of multiple shadow depth sub-maps corresponding to each sub-bounding box, which greatly reduces the amount of data stored in the terminal, improves the shadow rendering efficiency, and shortens the shadow rendering time.
[0114] Figure 7 is a block diagram of a shadow depth map compression storage device provided according to an embodiment of the present application. The device is used to execute the steps of the shadow depth map compression storage method described above, see Figure 7 The compression storage device of the shadow depth map includes: a first division module 701, a compression module 702 and a storage module 703.
[0115] A first division module 701 is used for dividing the shadow depth map of any sub-bounding box of the target bounding box into multiple shadow depth sub-maps based on a first preset resolution, wherein the target bounding box is a minimum bounding box that encloses multiple target virtual objects in the virtual scene, and the sub-bounding boxes are obtained by evenly dividing the target bounding box. The target virtual object refers to a virtual object to be rendered shadow among multiple virtual objects in the virtual scene;
[0116] A compression module 702 is used to compress and store any shadow depth sub-image in the form of a quadtree to obtain shadow data of the shadow depth sub-image. Nodes at different levels in the quadtree are used to store plane equation fitting parameters of different image areas in the shadow depth sub-image. The plane equation fitting parameters are used to fit a partial image area of the shadow depth sub-image through a plane equation. Any parent node in the quadtree corresponds to four child nodes, and the image area corresponding to the parent node is a square area range formed by the image areas corresponding to the four child nodes.
[0117] The storage module 703 is used to store the shadow data of multiple shadow depth sub-maps corresponding to the sub-bounding boxes, the camera parameters of the orthogonal camera corresponding to the sub-bounding boxes, the parameters of the target bounding box, and the lighting direction in the virtual scene.
[0118] In some embodiments, Figure 8 702 is a block diagram of another shadow depth map compression storage device provided according to an embodiment of the present application. The compression module 702 includes:
[0119] A division unit 7021 is used to divide the shadow depth sub-image into four equal parts layer by layer to obtain image regions of different levels, where the image region of the next level is obtained by dividing the image region of the previous level into four equal parts;
[0120] A construction unit 7022 is used to construct nodes of each level in the quadtree from the top level to the bottom level, based on the plane equation fitting parameters of the image area in each level, and the four image areas of any level correspond to the four nodes of the level one by one;
[0121] The construction unit 7022 is further configured to determine the constructed quadtree as shadow data of the shadow depth sub-map.
[0122] In some embodiments, the construction unit 7022 is used to fit the image area at any level by plane equation to obtain the fitting plane of the image area and the plane equation fitting parameters of the image area; when the fitting plane of the image area meets the preset error condition, the plane equation fitting parameters of the image area are stored in the corresponding node of the level, and the step of dividing the image area into the next level is canceled; when the fitting plane of the image area does not meet the preset error condition, the image area is divided into four image areas of the next level; when the plane equation fitting parameters of all image areas in the shadow depth submap are stored in the nodes of the quadtree, the construction of the nodes of the quadtree is stopped.
[0123] In some embodiments, the construction unit 7022 is also used to fit the image area of any image area at the target level through a plane equation to obtain a fitting plane of the image area and plane equation fitting parameters of the image area, and the target level is used to indicate that the resolution of the image area is a second preset resolution, and the second preset resolution is less than the first preset resolution; when the fitting plane of the image area satisfies a preset error condition, the plane equation fitting parameters of the image area are stored in a corresponding node of the target level; when the fitting plane of the image area does not satisfy the preset error condition, the depth value of the pixel point in the image area is stored in the corresponding node of the target level.
[0124] In some embodiments, the apparatus further comprises:
[0125] A first rendering module 801 is used to perform a first rendering on any sub-bounding box to obtain a first shadow depth map of the sub-bounding box;
[0126] A first determination module 802 is used to determine a maximum depth value and a minimum depth value in a first shadow depth map;
[0127] The second rendering module 803 is used to perform a second rendering on the sub-bounding box based on the maximum depth value and the minimum depth value to obtain a second shadow depth map of the sub-bounding box. The depth value of any pixel point in the second shadow depth map is used to indicate whether the light passing through the corresponding position of the pixel point intersects with the target virtual object in the sub-bounding box. The second shadow depth map is used to determine multiple shadow depth sub-maps.
[0128] In some embodiments, the first rendering module 801 is used to determine, for any sub-bounding box, the camera parameters of the first orthogonal camera corresponding to the sub-bounding box, the viewing range of the first orthogonal camera encloses the sub-bounding box, and the camera parameters include the near section of the first orthogonal camera and the far section of the first orthogonal camera; based on the distance between the target virtual object in the sub-bounding box and the first orthogonal camera, determine the first shadow depth map.
[0129] In some embodiments, the second rendering module 803 includes:
[0130] A first determining unit 8031 is used to determine a first position and a second position in the virtual scene based on the maximum depth value and the minimum depth value, the first position being a corresponding position of a pixel point storing the maximum depth value in the virtual scene, and the second position being a corresponding position of a pixel point storing the minimum depth value in the virtual scene;
[0131] The first determining unit 8031 is further used to determine a third position and a fourth position in the virtual scene based on the first position, the second position, the first dilation coefficient, and the second dilation coefficient, the distance between the third position and the first orthogonal camera is obtained by multiplying the distance between the first position and the first orthogonal camera by the first dilation coefficient, the distance between the fourth position and the first orthogonal camera is obtained by multiplying the distance between the second position and the first orthogonal camera by the second dilation coefficient, the viewing angle range of the first orthogonal camera encloses the sub-bounding box, the first dilation coefficient is greater than 1, and the second dilation coefficient is less than 1;
[0132] a replacement unit 8032, configured to replace the far cross section of the first orthogonal camera with a virtual plane passing through the third position and perpendicular to the illumination direction, and replace the near cross section of the first orthogonal camera with a virtual plane passing through the fourth position and perpendicular to the illumination direction, to obtain a second orthogonal camera;
[0133] The second determining unit 8033 is configured to determine a second shadow depth map based on the distance between the target virtual object in the sub-bounding box and the second orthogonal camera.
[0134] In some embodiments, the second determination unit 8033 is used to initialize the depth values of multiple pixels in the first shadow depth map to 1; for any pixel in the first shadow depth map, when the light passing through the corresponding position of the pixel intersects with the target virtual object within the viewing angle of the second orthogonal camera, determine the distance between the intersection point and the second orthogonal camera; use the normalized distance as the updated depth value of the pixel, and the updated depth value is a value greater than 0 and less than 1; when the light passing through the corresponding position of the pixel does not intersect with the target virtual object within the viewing angle of the second orthogonal camera, keep the depth value of the pixel at 1; when the depth values of multiple pixels have been updated, obtain the second shadow depth map.
[0135] In some embodiments, the apparatus further comprises:
[0136] The second determination module 804 is used to determine the position information of the target bounding box based on the light source coordinate system in the virtual scene, wherein a coordinate axis of the light source coordinate system is parallel to the illumination direction of the directional light in the virtual scene, and three sides on any vertex of the target bounding box are respectively parallel to the three coordinate axes of the light source coordinate system;
[0137] The second division module 805 is used to evenly divide the target bounding box into multiple sub-bounding boxes based on preset volume parameters of the sub-bounding boxes, and the three sides on any vertex of the multiple sub-bounding boxes are parallel to the three coordinate axes of the light source coordinate system.
[0138] In some embodiments, the second division module 805 is used to evenly divide the surface of the target bounding box perpendicular to the illumination direction along the illumination direction based on the preset volume parameters of the sub-bounding boxes to obtain multiple sub-bounding boxes, and the surface of each sub-bounding box perpendicular to the illumination direction is a square.
[0139] The present application provides a compression storage device for a shadow depth map, in which the terminal divides the target bounding box into multiple sub-bounding boxes, and divides the shadow depth map of each sub-bounding box into shadow depth sub-maps, and then stores the plane equation fitting parameters corresponding to each shadow depth sub-map in a quadtree to obtain the corresponding shadow data, and stores the shadow data together with other data required in the process of real-time rendering of shadows. Compared with directly storing the shadow depth map of the entire virtual scene, this method uses a quadtree to store the plane equation fitting parameters of multiple shadow depth sub-maps corresponding to each sub-bounding box, which greatly reduces the amount of data stored in the terminal, improves the shadow rendering efficiency, and shortens the shadow rendering time.
[0140] It should be noted that: the compressed storage device of the shadow depth map provided in the above embodiment only uses the division of the above functional modules as an example when running an application. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above. In addition, the compressed storage device of the shadow depth map provided in the above embodiment and the compressed storage method embodiment of the shadow depth map belong to the same concept, and the implementation process thereof is shown in the method embodiment, which will not be repeated here.
[0141] Fig. 9 1 is a schematic diagram of a terminal structure provided according to an embodiment of the present application. The terminal 900 may be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The terminal 900 may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0142] Typically, the terminal 900 includes a processor 901 and a memory 902 .
[0143] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 901 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 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the volume cloud of the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0144] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 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 902 is used to store at least one computer program, which is used to be executed by the processor 901 to implement the compression storage method of the shadow depth map provided in the method embodiment of the present application.
[0145] In some embodiments, the terminal 900 may further optionally include: a peripheral device interface 903 and at least one peripheral device. The processor 901, the memory 902 and the peripheral device interface 903 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 903 via a bus, a signal line or a circuit board. The peripheral device includes: at least one of a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907 and a power supply 908.
[0146] The peripheral device interface 903 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902, and the peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902, and the peripheral device interface 903 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0147] The radio frequency circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 904 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. In some embodiments, the radio frequency circuit 904 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 904 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, 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 904 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0148] The display screen 905 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to collect touch signals on the surface or above the surface of the display screen 905. The touch signal can be input to the processor 901 as a control signal for processing. At this time, the display screen 905 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 905 can be one, set on the front panel of the terminal 900; in other embodiments, the display screen 905 can be at least two, respectively set on different surfaces of the terminal 900 or in a folding design; in other embodiments, the display screen 905 can be a flexible display screen, set on the curved surface or folding surface of the terminal 900. Even, the display screen 905 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 905 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).
[0149] The camera assembly 906 is used to capture images or videos. In some embodiments, the camera assembly 906 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed 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 panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 906 may also include a flash. The flash may 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.
[0150] The audio circuit 907 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 901 for processing, or input them into the radio frequency circuit 904 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 900. 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 901 or the radio frequency circuit 904 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 907 may also include a headphone jack.
[0151] The power supply 908 is used to power various components in the terminal 900. The power supply 908 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 908 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.
[0152] In some embodiments, the terminal 900 further includes one or more sensors 909 . The one or more sensors 909 include, but are not limited to: an acceleration sensor 910 , a gyroscope sensor 911 , a pressure sensor 912 , an optical sensor 913 , and a proximity sensor 914 .
[0153] The acceleration sensor 910 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 900. For example, the acceleration sensor 910 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 901 can control the display screen 905 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 910. The acceleration sensor 910 can also be used to collect motion data of games or users.
[0154] The gyro sensor 911 can detect the body direction and rotation angle of the terminal 900, and the gyro sensor 911 can cooperate with the acceleration sensor 910 to collect the user's 3D actions on the terminal 900. The processor 901 can implement the following functions based on the data collected by the gyro sensor 911: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0155] The pressure sensor 912 can be set on the side frame of the terminal 900 and / or the lower layer of the display screen 905. When the pressure sensor 912 is set on the side frame of the terminal 900, it can detect the user's holding signal of the terminal 900, and the processor 901 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 912. When the pressure sensor 912 is set on the lower layer of the display screen 905, the processor 901 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 905. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0156] The optical sensor 913 is used to collect the ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the display screen 905 according to the ambient light intensity collected by the optical sensor 913. Optionally, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 according to the ambient light intensity collected by the optical sensor 913.
[0157] The proximity sensor 914, also called a distance sensor, is disposed on the front panel of the terminal 900. The proximity sensor 914 is used to collect the distance between the user and the front of the terminal 900. In one embodiment, when the proximity sensor 914 detects that the distance between the user and the front of the terminal 900 is gradually decreasing, the processor 901 controls the display screen 905 to switch from the screen-on state to the screen-off state; when the proximity sensor 914 detects that the distance between the user and the front of the terminal 900 is gradually increasing, the processor 901 controls the display screen 905 to switch from the screen-off state to the screen-on state.
[0158] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the terminal 900, and the terminal 900 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0159] Fig.10It is a structural diagram of a server provided according to an embodiment of the present application. The server 1000 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1001 and one or more memories 1002, wherein the memory 1002 stores at least one computer program, and the at least one computer program is loaded and executed by the processor 1001 to implement the compression storage method of the shadow depth map provided by 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. The server may also include other components for implementing device functions, which will not be repeated here.
[0160] The embodiment of the present application also provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is loaded and executed by a processor to implement the compression storage method of the shadow depth map in the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device.
[0161] The embodiment of the present application also provides a computer program product, including a computer program, which is executed by a processor to implement the compression storage method of the shadow depth map in the embodiment of the present application.
[0162] A person skilled in the art will appreciate that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0163] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for compressing and storing a shadow depth map, characterized in that: The method comprises: For any sub-bounding box of the target bounding box, based on a first preset resolution, a shadow depth map of the sub-bounding box is divided into a plurality of shadow depth sub-maps, the target bounding box being a minimum bounding box that encloses a plurality of target virtual objects in the virtual scene, the sub-bounding boxes being obtained by evenly dividing the target bounding box, and the target virtual object being a virtual object to be rendered with a shadow among the plurality of virtual objects in the virtual scene; For any shadow depth sub-image, compress and store the shadow depth sub-image in the form of a quadtree to obtain shadow data of the shadow depth sub-image, nodes at different levels in the quadtree are used to store plane equation fitting parameters of different image areas in the shadow depth sub-image, and the plane equation fitting parameters are used to fit a partial image area of the shadow depth sub-image through a plane equation, and any parent node in the quadtree corresponds to four child nodes, and the image area corresponding to the parent node is a square area range formed by the image areas corresponding to the four child nodes; The shadow data of the multiple shadow depth sub-maps corresponding to the sub-bounding boxes, the camera parameters of the orthogonal camera corresponding to the sub-bounding boxes, the parameters of the target bounding box and the lighting direction in the virtual scene are stored.
2. The method according to claim 1, characterized in that For any shadow depth sub-map, compressing and storing the shadow depth sub-map in the form of a quadtree to obtain shadow data of the shadow depth sub-map includes: The shadow depth sub-image is divided into four equal parts layer by layer to obtain image regions of different levels, wherein the image region of the next level is obtained by dividing the image region of the previous level into four equal parts; From the top level to the bottom level, based on the plane equation fitting parameters of the image area in each level, the nodes of each level in the quadtree are sequentially constructed, and the four image areas of any level correspond to the four nodes of the level one by one; The constructed quadtree is determined as the shadow data of the shadow depth sub-map.
3. The method according to claim 2, characterized in that The nodes of each level in the quadtree are sequentially constructed from the top level to the bottom level based on the plane equation fitting parameters of the image area in each level, including: For any image region at any level, fitting the image region by plane equation to obtain a fitting plane of the image region and plane equation fitting parameters of the image region; When the fitting plane of the image area meets the preset error condition, the plane equation fitting parameters of the image area are stored in the corresponding nodes of the level, and the step of dividing the image area into the next level is cancelled; When the fitting plane of the image region does not satisfy the preset error condition, dividing the image region into four image regions of the next level; When the plane equation fitting parameters of all image areas in the shadow depth sub-image are stored in the nodes of the quadtree, the construction of the nodes of the quadtree is stopped.
4. The method according to claim 3, characterized in that: The method further comprises: For any image region of a target level, fitting the image region by using a plane equation to obtain a fitting plane of the image region and a plane equation fitting parameter of the image region, wherein the target level is used to indicate that a resolution of the image region is a second preset resolution, and the second preset resolution is smaller than the first preset resolution; When the fitting plane of the image area satisfies the preset error condition, storing the plane equation fitting parameters of the image area in the corresponding node of the target level; When the fitting plane of the image region does not satisfy the preset error condition, the depth value of the pixel point in the image region is stored in the corresponding node of the target level.
5. The method according to claim 1, characterized in that The method further comprises: Perform a first rendering on any sub-bounding box to obtain a first shadow depth map of the sub-bounding box; Determine a maximum depth value and a minimum depth value in the first shadow depth map; Based on the maximum depth value and the minimum depth value, the sub-bounding box is rendered a second time to obtain a second shadow depth map of the sub-bounding box, the depth value of any pixel point in the second shadow depth map is used to indicate whether the light passing through the corresponding position of the pixel point intersects with the target virtual object in the sub-bounding box, and the second shadow depth map is used to determine the multiple shadow depth sub-maps.
6. The method according to claim 5, characterized in that The performing a first rendering on any sub-bounding box to obtain a first shadow depth map of the sub-bounding box includes: For any sub-bounding box, determine the camera parameters of a first orthogonal camera corresponding to the sub-bounding box, the viewing angle range of the first orthogonal camera encloses the sub-bounding box, and the camera parameters include a near cross section of the first orthogonal camera and a far cross section of the first orthogonal camera; The first shadow depth map is determined based on the distance between the target virtual object in the sub-bounding box and the first orthogonal camera.
7. The method according to claim 5, characterized in that The performing a second rendering on the sub-bounding box based on the maximum depth value and the minimum depth value to obtain a second shadow depth map of the sub-bounding box includes: Based on the maximum depth value and the minimum depth value, determining a first position and a second position in the virtual scene, the first position being a corresponding position of a pixel point of the maximum depth value in the virtual scene, and the second position being a corresponding position of a pixel point of the minimum depth value in the virtual scene; Based on the first position, the second position, the first expansion coefficient, and the second expansion coefficient, a third position and a fourth position are determined in the virtual scene, wherein the distance between the third position and the first orthogonal camera is obtained by multiplying the distance between the first position and the first orthogonal camera by the first expansion coefficient, and the distance between the fourth position and the first orthogonal camera is obtained by multiplying the distance between the second position and the first orthogonal camera by the second expansion coefficient, the viewing angle range of the first orthogonal camera surrounds the sub-bounding box, the first expansion coefficient is greater than 1, and the second expansion coefficient is less than 1; The far section of the first orthogonal camera is replaced by a virtual plane passing through the third position and perpendicular to the illumination direction, and the near section of the first orthogonal camera is replaced by a virtual plane passing through the fourth position and perpendicular to the illumination direction, to obtain a second orthogonal camera; The second shadow depth map is determined based on the distance between the target virtual object in the sub-bounding box and the second orthogonal camera.
8. A compression storage device for a shadow depth map, characterized in that: The device comprises: A first division module is used for dividing the shadow depth map of any sub-bounding box of a target bounding box into a plurality of shadow depth sub-maps based on a first preset resolution, wherein the target bounding box is a minimum bounding box that encloses a plurality of target virtual objects in a virtual scene, and the sub-bounding boxes are obtained by evenly dividing the target bounding box, and the target virtual object refers to a virtual object to be rendered with a shadow among the plurality of virtual objects in the virtual scene; A compression module, for compressing and storing any shadow depth sub-image in the form of a quadtree to obtain shadow data of the shadow depth sub-image, wherein nodes at different levels in the quadtree are used to store plane equation fitting parameters of different image areas in the shadow depth sub-image, and the plane equation fitting parameters are used to fit a partial image area of the shadow depth sub-image through a plane equation, wherein any parent node in the quadtree corresponds to four child nodes, and the image area corresponding to the parent node is a square area range formed by the image areas corresponding to the four child nodes; A storage module is used to store shadow data of multiple shadow depth sub-maps corresponding to the sub-bounding boxes, camera parameters of the orthogonal camera corresponding to the sub-bounding boxes, parameters of the target bounding box, and the lighting direction in the virtual scene.
9. A computer device, characterized in that: The computer device includes a processor and a memory, the memory is used to store at least one computer program, and the at least one computer program is loaded by the processor and executes the compression storage method of the shadow depth map according to any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for compressing and storing the shadow depth map according to any one of claims 1 to 7 is implemented.
