Method and system for improving effect of rendering parallel light shadow in real time and application
By generating high-quality depth maps through two renderings, the problem of poor parallel light shadowing in the existing technology is solved, and a clearer shadow display effect is achieved.
Patent Information
- Application Number
- CN202310968289.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-02
- Publication Date
- 2025-02-14
AI Technical Summary
When the prior art realizes the parallel light shadow effect in a three-dimensional model, it is difficult to accurately determine the detailed parameters in the view matrix and projection matrix of the parallel light space, resulting in poor shadow effect, especially in scenes of complex scenes and details.
High-quality depth maps are generated through two renderings. First, they are converted from the preset world space to the preset parallel light space, and the first round matrix is built and the first round depth map is rendered. Then, based on the first round depth map, they are detected and the outer contour of the three-dimensional object is constructed. The minimum encirclement rectangle is transformed into three-dimensional space, and finally the second round projection matrix and view matrix are constructed based on the width, height and rotation angle of the minimum encirclement rectangle, and the final second round depth map is rendered.
It improves the utilization rate of actual objects in shadow maps, greatly improves the shadow display effect, and makes the edges of objects and the shadows of small objects clearly visible.
Smart Images

Figure CN119444970A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of three-dimensional modeling and rendering, and in particular to a method, system and application for improving real-time rendering of parallel light shadow effects. Background Art
[0002] A 3D model is a polygonal representation of an object, usually displayed by a computer or other video device. Anything that exists in the physical world can be represented by a 3D model. With the continuous development of computer technology, 3D models have become an important tool in all walks of life. In the fields of games, movies, architecture, product design, etc., 3D models are widely used to create realistic scenes, visual effects and interactive experiences.
[0003] Real-time rendering is an important part of 3D modeling. The shadow effect of parallel light is a common rendering technology in computer graphics and computer vision, which can produce shadow effects in 3D models. Usually, parallel light is a light source from a specific direction, so it can produce clear shadows in 3D models.
[0004] When implementing the shadow effect of parallel light, the shadow map algorithm or its variants are usually used. The shadow map principle is to render a depth map of the scene from the space where the parallel light is located, and then when rendering each pixel of the object, the current pixel is converted to the parallel light space, and the depth value of the current pixel is compared with the depth value of the corresponding pixel on the depth map. If the current pixel depth is greater, it means that the current pixel is not illuminated by the light source, which is a shadow.
[0005] The shadow map algorithm is simple, but many detailed parameters are uncertain. The core problem is how to determine the coordinates of the camera's upward direction and the scene in the view matrix of the parallel light space, and the width and height values in the projection matrix. The most intuitive method is that the developer is very familiar with the rendering scene and knows the size of the scene, so some empirical values can be written. When the scene is relatively fixed, this solution can achieve good results. As the types of 3D scenes become more and more complex, the disadvantages of this empirical value method are gradually becoming apparent. For example, in order to ensure universality, the default value is usually set to a larger value. In some scenes, the size of the objects in the scene is relatively small. In this scenario, users tend to pay more attention to details, but the larger default value causes the details to be lost. In other more serious cases, even if a larger default value is set, some scenes may have larger objects, which will cause the generated image to not cover the entire scene. Then, the shadow will be missing where the default value range is exceeded. This visual discontinuity phenomenon is unacceptable to users.
[0006] In the prior art, there is a solution for calculating the bounding box of a scene. This method dynamically calculates the total bounding box of all objects in the scene, and then sets the size of the parallel light space according to the bounding box. This method is satisfactory for general scenes. However, for scenes with fine object modeling, if the user needs to see the details of the object clearly, this method is still not ideal, and the generated depth map is usually not highly utilized, and may even be less than 10% at special angles. Summary of the invention
[0007] In view of this, the present invention proposes a method, system and application for improving the real-time rendering of parallel light shadow effects. The specific scheme is as follows:
[0008] A method for improving real-time rendering of parallel light shadow effect, comprising:
[0009] Convert from the preset world space to the preset parallel light space, build the first round matrix based on the scene information of the preset three-dimensional object and render the first round depth map;
[0010] Detecting the outer contour of the three-dimensional object based on the local value of each pixel in the first-round depth map, and classifying the pixels where the outer contour is located into a two-dimensional point set;
[0011] Constructing a minimum enclosing rectangle enclosing the three-dimensional object in the first-round depth map based on the two-dimensional point set, and obtaining the width, height, center, and rotation angle relative to the horizontal axis of the minimum enclosing rectangle;
[0012] The center of the minimum enclosing rectangle is given information of a third dimension to convert it from a two-dimensional space to a three-dimensional space, and then converted from the parallel light space back to the world space;
[0013] A secondary projection matrix is constructed based on the width and height of the minimum enclosing rectangle, a secondary view matrix is constructed based on the center of the minimum enclosing rectangle and the rotation angle relative to the horizontal axis, and the secondary projection matrix and the secondary view matrix are combined to render the final secondary depth map.
[0014] In a specific embodiment, the process of constructing the secondary view matrix specifically includes:
[0015] The position of the secondary camera looking at the scene is obtained based on the center of the minimum enclosing rectangle in the three-dimensional space; the direction is adjusted by the rotation angle of the minimum enclosing rectangle relative to the horizontal axis to obtain the upward direction of the secondary camera; the position of the secondary camera is obtained by combining the parallel light direction and the position of the secondary camera looking at the scene;
[0016] The secondary view matrix is obtained by combining the secondary camera position, the upward direction of the secondary camera and the position where the secondary camera looks at the scene.
[0017] In a specific embodiment, a preset bounding box algorithm is used to align the overall axis of the scene with the center outside the bounding box to set the first-round matrix.
[0018] In a specific embodiment, the scene axis is aligned with the bounding box to obtain the position of the first-pass camera looking at the scene;
[0019] Specify a default value as the first round camera up direction;
[0020] The half of the diagonal length of the bounding box aligned with the scene axis is taken as the distance from the camera to the scene position, and the first round camera position is calculated based on the distance.
[0021] In a specific embodiment, the expression of the first-round camera position is:
[0022] P=os*D
[0023] Among them, the three-dimensional vector P represents the first-round camera position, the three-dimensional vector o represents the upward direction of the first-round camera, the three-dimensional vector D represents the position of the first-round camera looking at the scene, and s represents the distance from the camera looking at the scene.
[0024] In a specific embodiment, the coordinates of the center point of the bounding box in the third dimension are used as the coordinates of the center of the minimum enclosing rectangle in the third dimension to complete the conversion of the three-dimensional space so as to fix the information of the third dimension in the scene.
[0025] In a specific embodiment, the process of obtaining the minimum enclosing rectangle specifically includes: solving the convex hull of the two-dimensional point set, calculating the minimum rectangle surrounding the convex hull through a rotating caliper algorithm, and obtaining the width, height, center and rotation angle of the minimum enclosing rectangle relative to the horizontal axis.
[0026] An improved system for real-time rendering of parallel light shadow effects, comprising:
[0027] A first-round rendering unit, used for converting from a preset world space to a preset parallel light space, constructing a first-round matrix based on scene information of a preset three-dimensional object, and rendering a first-round depth map;
[0028] A contour detection unit, configured to detect an outer contour of a three-dimensional object based on the local value of each pixel in the first-round depth map, and classify the pixels where the outer contour is located into a two-dimensional point set;
[0029] A rectangle acquisition unit, configured to construct a minimum enclosing rectangle enclosing the three-dimensional object in the first-round depth map based on the two-dimensional point set, and acquire a width, a height, a center, and a rotation angle relative to a horizontal axis of the minimum enclosing rectangle;
[0030] A three-dimensional conversion unit, used for giving the center of the minimum enclosing rectangle information of a third dimension to convert it from a two-dimensional space to a three-dimensional space, and then converting it from the parallel light space back to the world space;
[0031] A rendering output unit is used to construct a secondary projection matrix based on the width and height of the minimum enclosing rectangle, to construct a secondary view matrix based on the center of the minimum enclosing rectangle and the rotation angle relative to the horizontal axis, and to render a final secondary depth map by combining the secondary projection matrix and the secondary view matrix.
[0032] In a specific embodiment, in the rendering output unit, the process of constructing the secondary round view matrix specifically includes:
[0033] The position of the secondary camera looking at the scene is obtained based on the center of the minimum enclosing rectangle in the three-dimensional space; the direction is adjusted by the rotation angle of the minimum enclosing rectangle relative to the horizontal axis to obtain the upward direction of the secondary camera; the position of the secondary camera is obtained by combining the parallel light direction and the position of the secondary camera looking at the scene;
[0034] The secondary view matrix is obtained by combining the secondary camera position, the upward direction of the secondary camera and the position where the secondary camera looks at the scene.
[0035] An image rendering method uses any of the above-mentioned methods for improving the real-time rendering of parallel light shadow effects to render parallel light shadows in real time.
[0036] Beneficial effects:
[0037] The present invention provides a method, system and application for improving the real-time rendering of parallel light shadow effects. A high-quality depth map is generated by rendering twice. While ensuring the strict requirements of real-time rendering calculations, the utilization rate of actual objects in the shadow map is increased, the shadow display effect is greatly improved, and the shadows of object edges and small objects are clearly discernible. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a flow chart of an improvement method according to an embodiment of the present invention;
[0039] Figure 2 is a schematic diagram of the first round of rendering results of an embodiment of the present invention;
[0040] Figure 3 is a schematic diagram of a second round of rendering results according to an embodiment of the present invention;
[0041] Figure 4 It is a schematic diagram of a gesture generation system module according to an embodiment of the present invention.
[0042] Figure numerals: 1 - first round rendering unit; 2 - contour detection unit; 3 - rectangle acquisition unit; 4 - three-dimensional conversion unit; 5 - rendering output unit. DETAILED DESCRIPTION
[0043] In the following, various embodiments of the present disclosure will be described more fully. The present disclosure may have various embodiments, and adjustments and changes may be made therein. However, it should be understood that there is no intention to limit the various embodiments of the present disclosure to the specific embodiments disclosed herein, but the present disclosure should be understood to cover all adjustments, equivalents and / or alternatives that fall within the spirit and scope of the various embodiments of the present disclosure.
[0044] Example 1
[0045] Embodiment 1 of the present invention discloses a method for improving the shadow effect of parallel light in real-time rendering. The final depth map is generated by rendering twice, which improves the space utilization of the shadow map and improves the accuracy of the shadow. Figure 1 The specific plan is as follows:
[0046] A method for improving the real-time rendering of parallel light shadow effects comprises the following steps:
[0047] 101. Convert from a preset world space to a preset parallel light space, construct a first-round matrix based on scene information of a preset three-dimensional object, and render a first-round depth map;
[0048] 102. Detect the outer contour of the three-dimensional object based on the local value of each pixel in the first round depth map, and classify the pixels where the outer contour is located into a two-dimensional point set;
[0049] 103. Construct a minimum enclosing rectangle that encloses the three-dimensional object in the first-round depth map based on the two-dimensional point set, and obtain the width, height, center, and rotation angle relative to the horizontal axis of the minimum enclosing rectangle;
[0050] 104. The center of the minimum enclosing rectangle is given the information of the third dimension to convert it from the two-dimensional space to the three-dimensional space, and then converted from the parallel light space back to the world space;
[0051] 105. Construct a secondary projection matrix based on the width and height of the minimum enclosing rectangle, construct a secondary view matrix based on the center of the minimum enclosing rectangle and the rotation angle relative to the horizontal axis, and render the final secondary depth map by combining the secondary projection matrix and the secondary view matrix.
[0052] In this embodiment, in order to render a depth map in parallel light space, two matrices need to be established, the view matrix and the orthogonal projection matrix. The ultimate purpose of the improvement method of this embodiment is also to obtain these two matrices. The information required by the former is the camera position, the camera's upward direction, and the position of the camera looking at the scene (i.e., a certain coordinate). The orthogonal projection matrix needs to know the width, height, near plane, and far plane of the scene being viewed. After constructing the two matrices, when rendering each specific pixel subsequently, it is also converted to the parallel light space through matrix multiplication and perspective processing is performed, and then the depth value is compared. Existing algorithms cannot determine many details, such as the coordinates of the camera's upward direction and the scene it is looking at, and the width and height values in the projection matrix cannot be accurately obtained.
[0053] The improved method of this embodiment changes the original one-time rendering process into two-time rendering, and uses image processing technology between the two renderings to accurately obtain all the parameters required to construct the matrix. Under the same storage conditions, the solution of this embodiment can greatly increase the utilization rate of the actual objects in the shadow map, so that the final shadow display effect is greatly improved, and the shadows of the edges of objects and small objects are clearly discernible.
[0054] In step 101, it is necessary to construct a view matrix and an orthogonal projection matrix from the scene information and render a depth map. Step 101 can be understood as a first rendering, and steps 102-105 can be understood as a second rendering.
[0055] Preferably, the view matrix and the projection matrix are set according to the value of the overall axis-aligned bounding box (AABB) of the scene. The depth map size is set in a conventional manner. The matrices obtained by the first round of rendering are defined as the first round view matrix and the first round projection matrix.
[0056] Among them, constructing the first-round view matrix is equivalent to constructing a camera. The camera can be understood as an eye in the real world, with a position, orientation, and upward direction (the direction the head is pointing). The camera determines what can be seen. The position of the first-round camera looking at the scene is specifically the center outside the scene axis-aligned bounding box. The upward direction of the first-round camera can arbitrarily specify a default value. As for the position of the first-round camera, since the direction of the parallel light is known (set as a three-dimensional vector D), the position of the first-round camera looking at the scene (set as a three-dimensional vector o) has been calculated, so it is necessary to know the distance from the first-round camera to the position looking at the scene. Half of the diagonal length of the scene axis-aligned bounding box can be used (set as s). The camera position can be calculated according to the vector calculation formula (set as a three-dimensional vector P). The expression of the first-round camera position is:
[0057] P=os*D
[0058] Among them, the three-dimensional vector P represents the first-round camera position, the three-dimensional vector o represents the upward direction of the first-round camera, the three-dimensional vector D represents the position of the first-round camera looking at the scene, and s represents the distance from the camera looking at the scene.
[0059] Among them, to construct the first round of orthogonal projection matrix, you only need to know the geometric size information of the cuboid box of the scene you are looking at. The distance between the upper and lower surfaces can use the diagonal length of the scene axis-aligned bounding box mentioned above, and the distance between the left and right surfaces can use the diagonal length of the scene axis-aligned bounding box mentioned above. The near plane can be set to a smaller value, and the far plane can be set to a larger value.
[0060] The result obtained in step 101 is shown in the attached figure. Figure 2 As shown in the figure, the area occupied by the character's shadow in the picture is actually not much. In the figure, the position where the camera is looking at in the first round is the center of the picture after two-dimensionalization. After the second rendering of steps 102-105, the position where the camera is looking is moved to the center of the minimum enclosing rectangle, and the width and height of the orthogonal projection matrix are set to the width and height of the minimum enclosing rectangle. At the same time, the camera is rotated upward to make it perpendicular to the horizontal axis of the minimum enclosing rectangle, so that the filled picture is the complete three-dimensional object in the minimum enclosing rectangle, as shown in the figure. Figure 3 Specifically, the first-round camera position is moved to the center of the minimum enclosing rectangle to obtain the second-round camera position; the first-round camera is rotated upward by the rotation angle of the minimum enclosing rectangle relative to the horizontal axis to obtain the second-round camera upward direction perpendicular to the horizontal axis of the minimum enclosing rectangle.
[0061] Steps 102-103 process the depth map obtained in step 101 to obtain information of a minimum rectangle surrounding the three-dimensional object in the depth map. The information of the rectangle includes the width, height, center and rotation angle of the rectangle relative to the horizontal axis.
[0062] In the depth map obtained in step 101, the values of places where there are objects are non-zero, and the values of other places are zero. Based on this characteristic, this embodiment traverses all image pixels in the depth map, analyzes the local values to obtain the outer contour of the three-dimensional object, and stores the pixels where the outer contour is located in the two-dimensional point set.
[0063] Step 103 is to calculate the minimum enclosing rectangle of the outer contour. The minimum bounding rectangle (MBR) refers to the minimum circumscribed rectangle that surrounds the primitive and is parallel to the x and y axes. In computer graphics and computer vision, the minimum enclosing rectangle is a commonly used algorithm for quickly obtaining the boundary information of two-dimensional graphics. The calculation method of the minimum enclosing rectangle is usually based on the bounding box of the primitive. The bounding box refers to the largest rectangle containing the primitive, and the coordinates of its two diagonal vertices correspond to the minimum and maximum x and y coordinates of the graphics respectively. For a given primitive, the coordinates of the upper left corner and the lower right corner of its bounding box can be calculated, and then the coordinates of the upper left corner and the lower right corner of the minimum enclosing rectangle are calculated through the coordinates of these two points. Therefore, the center of the minimum enclosing rectangle is a two-dimensional coordinate.
[0064] A variety of algorithms can be used to calculate the minimum enclosing rectangle based on a two-dimensional point set. For example, the convex hull of the two-dimensional point set is first solved, and the minimum rectangle enclosing the convex hull is calculated by a rotating caliper algorithm to obtain the width, height, center, and rotation angle of the minimum enclosing rectangle relative to the horizontal axis.
[0065] The width, height, and angle of rotation relative to the horizontal axis of the minimum enclosing rectangle can be used directly and therefore do not need to be processed. However, the center of the minimum enclosing rectangle is a two-dimensional coordinate and cannot be used directly and needs to be converted into a three-dimensional space coordinate. In the absence of coordinate information for the third dimension, an arbitrary legal value can be assigned to it to make the center of the minimum enclosing rectangle a three-dimensional coordinate. However, it is more preferred to use the coordinates of the center point of the bounding box in the third dimension as the coordinates of the third dimension of the center of the minimum enclosing rectangle to complete the conversion of the three-dimensional space so as to fix the information of the third dimension in the scene. Use the third-dimensional coordinates of the center point of the AABB of the entire scene as the third-dimensional coordinates of the center to be determined so that the added value is still within the scene, avoiding additional judgments and reducing the amount of calculation.
[0066] The key information of the two matrices has been obtained through the above steps, and step 105 is to construct the matrix and output the depth map. The matrix output by step 105 is defined as the secondary view matrix and the secondary projection matrix. The secondary projection matrix is constructed by the width and height of the minimum enclosing rectangle. The construction process of the secondary view matrix specifically includes: obtaining the position of the secondary camera looking at the scene based on the center of the minimum enclosing rectangle in three-dimensional space; adjusting the direction by the rotation angle of the minimum enclosing rectangle relative to the horizontal axis to obtain the upward direction of the secondary camera; combining the parallel light direction and the position of the secondary camera looking at the scene to obtain the secondary camera position; combining the secondary camera position, the secondary camera upward direction and the position of the secondary camera looking at the scene to obtain the secondary view matrix.
[0067] Step 101 is to convert the coordinates of the three-dimensional object from the default space (i.e., world space) to the coordinates in the parallel light space for easy calculation. Step 104 is to reverse the coordinates of the three-dimensional object from the parallel light space back to the default space (world space) coordinates so that the final calculation result is in the default space. By converting between the default space and the parallel light space, the calculation is simplified and the calculation cost is reduced.
[0068] This embodiment provides a method for improving the real-time rendering of parallel light shadow effects. A high-quality depth map is generated by rendering twice. While ensuring the strict requirements of real-time rendering calculations, the utilization rate of actual objects in the shadow map is increased, the shadow display effect is greatly improved, and the shadows of object edges and small objects are clearly discernible.
[0069] Example 2
[0070] Embodiment 2 of the present invention discloses a system for improving the real-time rendering of parallel light shadow effects, which systematizes the method for improving the real-time rendering of parallel light shadow effects in embodiment 1 to make it more practical. The overall structure diagram of the improvement system is shown in the attached manual. Figure 4 The specific plan is as follows:
[0071] An improved system for real-time rendering of parallel light shadow effects, comprising:
[0072] A first-round rendering unit 1 is used to convert a preset world space into a preset parallel light space, construct a first-round matrix based on scene information of a preset three-dimensional object, and render a first-round depth map;
[0073] Contour detection unit 2, used to detect the outer contour of the three-dimensional object based on the local value of each pixel in the first round depth map, and classify the pixels where the outer contour is located into a two-dimensional point set;
[0074] Rectangle acquisition unit 3, used to construct a minimum enclosing rectangle enclosing the three-dimensional object in the first-round depth map based on the two-dimensional point set, and obtain the width, height, center and rotation angle of the minimum enclosing rectangle relative to the horizontal axis;
[0075] A three-dimensional conversion unit 4, used for giving the center of the minimum enclosing rectangle information of the third dimension to convert it from the two-dimensional space to the three-dimensional space, and converting it from the parallel light space back to the world space;
[0076] The rendering output unit 5 is used to construct a secondary projection matrix based on the width and height of the minimum enclosing rectangle, construct a secondary view matrix based on the center of the minimum enclosing rectangle and the rotation angle relative to the horizontal axis, and render the final secondary depth map by combining the secondary projection matrix and the secondary view matrix.
[0077] In the rendering output unit 5, the construction process of the secondary view matrix specifically includes: obtaining the position of the secondary camera looking at the scene based on the center of the minimum enclosing rectangle in the three-dimensional space; adjusting the direction by the rotation angle of the minimum enclosing rectangle relative to the horizontal axis to obtain the upward direction of the secondary camera; combining the parallel light direction and the position of the secondary camera looking at the scene to obtain the secondary camera position; and obtaining the secondary view matrix by combining the secondary camera position, the upward direction of the secondary camera and the position of the secondary camera looking at the scene.
[0078] Example 3
[0079] This embodiment provides an image rendering method, which uses an improved method for real-time rendering of parallel light shadow effect in Embodiment 1 to render parallel light shadow in real time.
[0080] The present invention provides a method, system and application for improving the real-time rendering of parallel light shadow effects. A high-quality depth map is generated by rendering twice. While ensuring the strict requirements of real-time rendering calculations, the utilization rate of actual objects in the shadow map is increased, the shadow display effect is greatly improved, and the shadows of object edges and small objects are clearly discernible.
[0081] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily required for implementing the present invention. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be changed accordingly and located in one or more devices different from the present implementation scenario.
Claims
1. A method for improving the real-time rendering of parallel light shadow effects, characterized in that: include: Convert from the preset world space to the preset parallel light space, build the first round matrix based on the scene information of the preset three-dimensional object and render the first round depth map; Detecting the outer contour of the three-dimensional object based on the local value of each pixel in the first-round depth map, and classifying the pixels where the outer contour is located into a two-dimensional point set; Constructing a minimum enclosing rectangle enclosing the three-dimensional object in the first-round depth map based on the two-dimensional point set, and obtaining the width, height, center, and rotation angle relative to the horizontal axis of the minimum enclosing rectangle; The center of the minimum enclosing rectangle is given information of a third dimension to convert it from a two-dimensional space to a three-dimensional space, and then converted from the parallel light space back to the world space; A secondary projection matrix is constructed based on the width and height of the minimum enclosing rectangle, a secondary view matrix is constructed based on the center of the minimum enclosing rectangle and the rotation angle relative to the horizontal axis, and the secondary projection matrix and the secondary view matrix are combined to render the final secondary depth map.
2. The improvement method according to claim 1, characterized in that: The construction process of the secondary view matrix specifically includes: The position of the secondary camera looking at the scene is obtained based on the center of the minimum enclosing rectangle in the three-dimensional space; the direction is adjusted by the rotation angle of the minimum enclosing rectangle relative to the horizontal axis to obtain the upward direction of the secondary camera; the position of the secondary camera is obtained by combining the parallel light direction and the position of the secondary camera looking at the scene; The secondary view matrix is obtained by combining the secondary camera position, the upward direction of the secondary camera and the position where the secondary camera looks at the scene.
3. The improvement method according to claim 2, characterized in that: Using the preset bounding box algorithm, the overall axis of the scene is aligned to the center outside the bounding box to set the first round matrix.
4. The improvement method according to claim 3, characterized in that: Align the scene axis to the bounding box to get the position of the first camera looking at the scene; Specify a default value as the first round camera up direction; The half of the diagonal length of the bounding box aligned with the scene axis is taken as the distance from the camera to the scene position, and the first round camera position is calculated based on the distance.
5. The improvement method according to claim 4, characterized in that: The expression of the first round camera position is: P=os*D Among them, the three-dimensional vector P represents the first-round camera position, the three-dimensional vector o represents the upward direction of the first-round camera, the three-dimensional vector D represents the position of the first-round camera looking at the scene, and s represents the distance from the camera looking at the scene.
6. The improvement method according to claim 4, characterized in that: The coordinates of the center point of the bounding box in the third dimension are used as the coordinates of the center of the minimum enclosing rectangle in the third dimension to complete the conversion of the three-dimensional space, so as to fix the information of the third dimension in the scene.
7. The improvement method according to claim 4, characterized in that: The process of obtaining the minimum enclosing rectangle specifically includes: solving the convex hull of the two-dimensional point set, calculating the minimum rectangle enclosing the convex hull by a rotating caliper algorithm, and obtaining the width, height, center and rotation angle of the minimum enclosing rectangle relative to the horizontal axis.
8. A system for improving the real-time rendering of parallel light shadow effects, characterized in that: include: A first-round rendering unit, used for converting from a preset world space to a preset parallel light space, constructing a first-round matrix based on scene information of a preset three-dimensional object, and rendering a first-round depth map; A contour detection unit, configured to detect an outer contour of a three-dimensional object based on the local value of each pixel in the first-round depth map, and classify the pixels where the outer contour is located into a two-dimensional point set; A rectangle acquisition unit, configured to construct a minimum enclosing rectangle enclosing the three-dimensional object in the first-round depth map based on the two-dimensional point set, and acquire a width, a height, a center, and a rotation angle relative to a horizontal axis of the minimum enclosing rectangle; A three-dimensional conversion unit, used for giving the center of the minimum enclosing rectangle information of a third dimension to convert it from a two-dimensional space to a three-dimensional space, and then converting it from the parallel light space back to the world space; A rendering output unit is used to construct a secondary projection matrix based on the width and height of the minimum enclosing rectangle, to construct a secondary view matrix based on the center of the minimum enclosing rectangle and the rotation angle relative to the horizontal axis, and to render a final secondary depth map by combining the secondary projection matrix and the secondary view matrix.
9. The improved system according to claim 8, characterized in that: In the rendering output unit, the construction process of the secondary view matrix specifically includes: Based on the center of the minimum enclosing rectangle (corrected to: minimum enclosing rectangle) in three-dimensional space, the position of the secondary camera looking at the scene is obtained; the direction is adjusted by the rotation angle of the minimum enclosing rectangle relative to the horizontal axis to obtain the upward direction of the secondary camera; the position of the secondary camera is obtained by combining the parallel light direction and the position of the secondary camera looking at the scene; The secondary view matrix is obtained by combining the secondary camera position, the upward direction of the secondary camera and the position where the secondary camera looks at the scene.
10. An image rendering method, characterized in that: The parallel light shadow is rendered in real time using the method for improving the real-time rendering of parallel light shadow effect as described in any one of claims 1 to 7.