Full-viewing-angle depth information construction method and apparatus, device, and storage medium
By generating and attaching surface elements in the virtual scene, obtaining the distance value between the surface element and the camera, and constructing full-view depth information, it solves the problems of low construction efficiency and low depth information quality in the existing technology, and achieves high efficiency. , Accurate depth information construction.
Patent Information
- Application Number
- PCT/CN2024/085582
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-13
- Filing Date
- 2024-04-02
- Publication Date
- 2024-10-17
AI Technical Summary
It is difficult to efficiently construct full-view depth information of virtual scenes with existing technology, resulting in low construction efficiency and low quality of depth information.
By generating multiple polygons in the virtual scene and obtaining the distance between each polygon and the camera as the depth value, full-view depth information is constructed. The surface elements are attached to the surface of the virtual object to improve the accuracy of the depth value, and the depth value of the virtual object is jointly represented by multiple surface elements.
It improves the construction efficiency and quality of full-view depth information, saves time costs and processing resources, and enhances the accuracy of virtual object depth values.
Smart Images

Figure CN2024085582_17102024_PF_FP_ABST
Abstract
Description
Method, device, equipment and storage medium for constructing full-view depth information
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on April 13, 2023, with application number 2023103936686 and application name “Information Construction Method, Device, Equipment and Storage Medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, specifically to the field of computer graphics technology, and more particularly to a method, apparatus, device, and storage medium for constructing full-view depth information. Background Art
[0003] With the development of computer graphics technology, full-view depth information for virtual scenes has gained widespread application. Full view refers to the full 360° viewing angle of any object (such as a user or a camera) viewing a virtual scene. This allows all virtual objects in the scene to be seen. Full-view depth information for virtual scenes indicates the depth of each virtual object in the scene. The depth of any virtual object is the distance between the object and the camera. Currently, constructing full-view depth information for virtual scenes has become a hot topic of research.
[0004] Summary of the Invention
[0005] The embodiments of the present application provide a method, apparatus, device, and storage medium for constructing full-view depth information, which can improve the efficiency of constructing full-view depth information and the quality of full-view depth information.
[0006] In one aspect, an embodiment of the present application provides a method for constructing full-view depth information, the method comprising:
[0007] Obtaining a virtual scene, wherein the virtual scene includes a camera and at least one virtual object, wherein the camera is a component for presenting a view of the virtual scene in at least one viewing direction;
[0008] Generating a plurality of surface elements in the virtual scene, wherein the surface element is a plane figure having a direction and a size, wherein at least one surface element is attached to the surface of each virtual object;
[0009] Obtaining respective depth values of the plurality of surface elements in the virtual scene, wherein the depth value refers to: a distance value between the surface element and the camera;
[0010] The acquired depth value is used to construct full-view depth information of the virtual scene.
[0011] On the other hand, an embodiment of the present application provides a device for constructing full-view depth information, the device comprising:
[0012] a processing unit, configured to obtain a virtual scene, wherein the virtual scene includes a camera and at least one virtual object, wherein the camera is a component for presenting a view of the virtual scene in at least one viewing direction;
[0013] The processing unit is further configured to generate a plurality of surface elements in the virtual scene, wherein the surface element is a planar figure having a direction and a size, wherein at least one surface element is attached to the surface of each virtual object;
[0014] The processing unit is further configured to obtain a depth value of each of the plurality of surface elements in the virtual scene, where the depth value refers to a distance value between the surface element and the camera;
[0015] A construction unit is configured to construct full-view depth information of the virtual scene using the acquired depth value.
[0016] In another aspect, an embodiment of the present application provides a computer device, the computer device including an input interface and an output interface, and the computer device further including:
[0017] processors and computer storage media;
[0018] The processor is suitable for implementing one or more instructions, and the computer storage medium stores one or more instructions, and the one or more instructions are suitable for the processor to load and execute the above-mentioned method for constructing full-view depth information.
[0019] On the other hand, an embodiment of the present application provides a computer storage medium, which stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the above-mentioned method for constructing full-view depth information.
[0020] On the other hand, an embodiment of the present application provides a computer program product, which includes a computer program; when the computer program is executed by a processor, it implements the above-mentioned method for constructing full-view depth information.
[0021] In the embodiment of the present application, multiple facets can be generated in a virtual scene, and the distance value between each facet and the camera can be obtained as the depth value of the corresponding facet in the virtual scene, thereby using the depth value of each facet in the virtual scene to construct the full-view depth information of the virtual scene. It can be seen that the construction process of the full-view depth information proposed in the embodiment of the present application is relatively simple, which can save the time cost and processing resources (such as bandwidth) required to construct the full-view depth information, thereby improving the efficiency of constructing the full-view depth information. Moreover, since each facet is attached to the surface of the corresponding virtual object, the depth value of each facet in the virtual scene can more accurately represent the depth value of the corresponding virtual object. Therefore, by constructing the full-view depth information using the depth value of each facet, the constructed full-view depth information can have a higher accuracy, thereby improving the quality of the full-view depth information. In addition, when multiple facets are attached to the surface of each virtual object, the depth value of the same virtual object can be jointly represented by the depth values of multiple facets in the full-view depth information, which can further improve the accuracy of the depth value of the virtual object, thereby further improving the quality of the full-view depth information. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] FIG1a is a schematic diagram of a method for constructing full-view depth information jointly performed by a terminal and a server according to an embodiment of the present application;
[0023] FIG1b is a schematic diagram of another method for constructing full-view depth information jointly performed by a terminal and a server according to an embodiment of the present application;
[0024] FIG2 is a flow chart of a method for constructing full-view depth information according to an embodiment of the present application;
[0025] FIG3a is a schematic diagram of generating facets on the surface of a virtual object provided by an embodiment of the present application;
[0026] FIG3 b is a schematic diagram of generating a facet in a virtual scene according to an embodiment of the present application;
[0027] FIG3 c is a schematic diagram of an octahedral mapping provided in an embodiment of the present application;
[0028] FIG4 is a flow chart of a method for constructing full-view depth information according to another embodiment of the present application;
[0029] FIG5a is a schematic diagram of determining pixel points corresponding to bins in a mapping template according to an embodiment of the present application;
[0030] FIG5b is a schematic diagram of another method for determining pixel points corresponding to bins in a mapping template provided by an embodiment of the present application;
[0031] FIG5c is a schematic diagram of another method for determining pixel points corresponding to bins in a mapping template provided by an embodiment of the present application;
[0032] FIG5 d is a schematic diagram of the positional relationship between a camera and a facet provided in an embodiment of the present application;
[0033] FIG5e is a schematic diagram of a depth information map provided in an embodiment of the present application;
[0034] FIG5f is a schematic diagram of reconstructing a depth information map according to an embodiment of the present application;
[0035] FIG5g is a schematic diagram of another depth information map provided in an embodiment of the present application;
[0036] FIG5h is a schematic diagram of a step-by-step method for generating a low-precision information map according to an embodiment of the present application;
[0037] FIG5i is a schematic diagram of a step-by-step filling of a high-precision information map provided by an embodiment of the present application;
[0038] FIG6 is a schematic structural diagram of a device for constructing full-view depth information provided by an embodiment of the present application;
[0039] FIG7 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application.
[0041] The embodiment of the present application is based on computer vision (CV) and computer graphics technology in AI (Artificial Intelligence) technology, and proposes a method for constructing full-view depth information of a virtual scene based on facets. The so-called AI technology refers to the theory, method, technology and application system technology of using digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, AI is a comprehensive technology in computer science; it mainly produces a new type of intelligent machine that can respond in a similar way to human intelligence by understanding the essence of intelligence, so that the intelligent machine has multiple functions such as perception, reasoning and decision-making. Computer vision technology in AI technology is a science that studies how to make machines "see". More specifically, it refers to the technology of using cameras and computers to replace human eyes to identify and measure targets, and further perform graphic processing to make the computer processing into an image that is more suitable for human eye observation or transmission to instrument detection. Computer graphics technology in AI technology is a science that uses mathematical algorithms to convert two-dimensional or three-dimensional graphics into raster form for computer displays; simply put, the main research content of computer graphics is to study how to represent graphics in computers, as well as the relevant principles and algorithms for using computers to calculate, process and display graphics.
[0042] In the embodiments of the present application, a face element may be referred to as a discrete face element, which refers to a plane figure with a direction and size, such as a circle, an ellipse, a square, a hexagon, etc. The basic components of a face element (which may be referred to as face element information) may include but are not limited to the following: ① world space coordinates, such as the world space coordinates of the center point of the face element. The so-called world space coordinates refer to the three-dimensional coordinates in the world space coordinate system, and the world space coordinate system may also be referred to as an absolute coordinate system, which does not change with the viewing angle or other factors; ② normal vector, that is, the vector represented by the straight line perpendicular to the face element, which may indicate the normal direction of the face element. The normal direction mentioned here is the direction of the face element; ③ size information, that is, information used to indicate the size of the face element. For example, when the face element is a circle, the size information may be the radius of the circle (referred to as the radius).
[0043] A virtual scene can be understood as a scene that can be displayed on a device screen. Specifically, the virtual scene can be a scene obtained by digitally simulating a real-world scene, such as a scene obtained by simulating an autonomous driving scene or a scenic spot tour scene in the real world. Alternatively, the virtual scene can be a semi-simulated and semi-fictional scene, such as a scene with fictional characters superimposed on a simulated world corresponding to the real world. Alternatively, the virtual scene can be a purely fictional scene, such as a scene from a game, a TV series, or a movie.
[0044] The virtual scene may include at least one virtual object. The so-called virtual object may be a static object element in the virtual scene, such as virtual grass, virtual buildings, etc.; or, the virtual object may be an movable object in the virtual scene, such as a virtual character in a game scene, a virtual animal in a game scene, etc. It should be understood that each virtual object in the virtual scene may be a static object element, or may be an movable object, or may include both static object elements and movable objects, without limitation. Furthermore, the virtual scene may also include a camera, which is a component for presenting a view of the virtual scene in at least one viewing direction; the embodiment of the present application does not limit the position of the camera in the virtual scene. For example, it may be located at the position of a virtual object in the virtual scene, or at any position in the virtual scene other than the position of each virtual object, etc.
[0045] Based on the above definitions, the following describes the principle of the method for constructing full-view depth information of a virtual scene based on facets proposed in the embodiment of the present application. Specifically, the general principle of the method is as follows: First, at least one facet can be generated and attached to the surface of each virtual object in the virtual scene; then, the depth value of each facet in the virtual scene can be obtained. The depth value of any facet in the virtual scene refers to the distance between the corresponding facet and the camera; then, the depth value of each facet in the virtual scene can be used to construct the full-view depth information of the virtual scene. It can be seen that the embodiment of the present application constructs full-view depth information of the virtual scene based on facets, which can make the construction process of full-view depth information relatively simple, thus saving the time cost and processing resources (such as bandwidth) required to construct full-view depth information, and improving the efficiency of constructing full-view depth information. Moreover, since each facet is attached to the surface of the corresponding virtual object, the depth value of each facet in the virtual scene can more accurately represent the depth value of the corresponding virtual object. Therefore, by constructing full-view depth information using the depth value of each facet, the constructed full-view depth information can have higher accuracy, thereby improving the quality of full-view depth information. In addition, when multiple facets are attached to the surface of each virtual object, the depth value of the same virtual object can be jointly represented by the depth values of multiple facets in the full-view depth information, which can further improve the accuracy of the depth value of the virtual object and thus further improve the quality of the full-view depth information.
[0046] In a specific implementation, the above-mentioned method can be executed by a computer device, which can be a terminal or a server. Alternatively, the above-mentioned method can be executed jointly by the terminal and the server. For example, the terminal can be responsible for generating and attaching at least one facet on the surface of each virtual object in the virtual scene, and then sending the basic components of the facet (such as world space coordinates, normal vectors, size information, etc.) to the server, so that the server performs the steps of obtaining the respective depth values of each facet in the virtual scene and constructing the full-view depth information according to the basic components, as shown in Figure 1a. For another example, the server can also be responsible for generating and attaching multiple facets and obtaining the respective depth values of each facet in the virtual scene, and then sending the respective depth values of each facet in the virtual scene to the terminal, so that the terminal is responsible for using the respective depth values of each facet in the virtual scene to construct the full-view depth information of the virtual scene, as shown in Figure 1b. For another example, the server may be responsible for generating multiple face elements and sending the basic constituent elements of the multiple face elements to the terminal, so that the terminal obtains the depth value of each face element in the virtual scene based on the basic constituent elements, and returns the obtained depth value to the server, triggering the server to use the received depth values to construct the full-view depth information of the virtual scene, and so on.
[0047] Among them, the terminals mentioned above may include but are not limited to: smart phones, computers (such as tablets, laptops, desktop computers, etc.), smart wearable devices (such as smart watches, smart glasses, etc.), smart voice interaction devices, smart home appliances (such as smart TVs), vehicle-mounted terminals or aircraft, etc.; the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides 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), and big data and artificial intelligence platforms and other basic cloud computing services, etc.
[0048] Based on the above description, the present embodiment proposes a method for constructing full-view depth information. This method can be executed by the aforementioned computer device (terminal or server), or by both the terminal and the server. For ease of explanation, the following description will be based on an example of a computer device executing this method. Referring to Figure 2, this method may include the following steps S201-S203:
[0049] S201: Obtain a virtual scene, and generate multiple facets in the virtual scene.
[0050] In a specific implementation, the computer device can traverse each virtual object in the virtual scene. For the currently traversed virtual object, the computer device can generate and attach at least one face element on the mesh surface (referred to as the surface) of the currently traversed virtual object based on the position of the currently traversed virtual object in the virtual scene. Different face elements correspond to different attachment positions. The so-called surface-attached face element can be understood as the face element being tightly attached to the surface of the virtual object. Taking the face element as a circle as an example, a schematic diagram of generating and attaching face elements on the surface of the virtual object can be seen in Figure 3a. Furthermore, after generating and attaching at least one face element on the surface of the currently traversed virtual object, the computer device can continue to traverse other virtual objects in the virtual scene until all virtual objects in the virtual scene have been traversed, and the face element generation operation is terminated.
[0051] It can be seen that step S201 can make the surface of each virtual object in the virtual scene be attached with at least one facet. It should be understood that the number of facets attached to the surfaces of different virtual objects may be the same or different, and there is no limitation on this; and the attributes of different facets (such as size, direction) may be the same or different, and there is no limitation on this. Exemplarily, a schematic diagram of generating facets in a virtual scene can be seen in Figure 3b. It can be seen that the embodiment of the present application can establish a facet-based scene representation system by allowing the facets to be closely attached to the mesh surfaces of each virtual object in the virtual scene, and then use these facets to approximate the geometric information of the virtual scene, making the expression of the geometric information of the virtual scene simpler.
[0052] Because each facet is attached to the surface of the corresponding virtual object, the depth value of any virtual object in the virtual scene can be represented by the depth values of each facet attached to its surface in the virtual scene. Based on this, after the computer device generates multiple facets in the virtual scene in step S201, it can execute step S202 to obtain the depth values of each of the multiple facets in the virtual scene. This allows the computer device to subsequently use the depth values of each of the multiple facets in the virtual scene to construct full-view depth information for the virtual scene.
[0053] S202: Obtain respective depth values of a plurality of facets in the virtual scene.
[0054] Among them, the depth value of any facet in the virtual scene refers to: the distance value between the corresponding facet and the camera. In the specific implementation of step S202, the computer device can respectively obtain the distance value between each facet and the camera, and then use the distance value between each facet and the camera as the depth value of the corresponding facet in the virtual scene. It can be understood that since at least one view of the virtual scene is presented on the display screen through a camera, in actual applications, the depth value mentioned in the embodiment of the present application can be used as a depth rendering parameter, so that the corresponding facet or virtual object can be rendered and displayed based on the depth rendering parameter.
[0055] Furthermore, the distance value between any facet and the camera can be obtained by obtaining the world space coordinates of the facet and the world space coordinates of the camera, and calculating the Euclidean distance between the corresponding facet and the camera based on the world space coordinates of the facet and the camera to obtain the distance value between the corresponding facet and the camera. As can be seen from the foregoing, world space coordinates refer to coordinates in the world space coordinate system, and the world space coordinate system does not change with perspective or other factors; therefore, by calculating the distance value based on the world space coordinates, the problem of distance value deviation caused by perspective change or other factors can be avoided, thereby ensuring the accuracy of the distance value, and thus ensuring the accuracy of the depth value of each facet in the virtual scene.
[0056] It should be understood that the above is merely an exemplary embodiment of how to obtain the distance value between a surfel and a camera, and is not exhaustive. For example, in other embodiments, the computer device may also establish a scene coordinate system based on a point in the virtual scene, and thereby calculate the Euclidean distance between the corresponding surfel and the camera based on the position coordinates of the surfel in the scene coordinate system and the position coordinates of the camera in the scene coordinate system, thereby obtaining the distance value between the corresponding surfel and the camera, and so on. The Euclidean distance refers to the Euclidean metric; in mathematics, the Euclidean metric is the distance between two points in Euclidean space.
[0057] S203 , constructing full-view depth information of the virtual scene using the acquired depth values; wherein the acquired depth values include: respective depth values of a plurality of facets in the virtual scene.
[0058] In a specific implementation, the computer device can represent the full-view depth information of the virtual scene through a two-dimensional image. In this specific implementation, the implementation method of step S203 can be:
[0059] A mapping template is obtained, which is a two-dimensional image and may include multiple pixels, one pixel being used to store a depth value. Multiple surface elements are projected from the virtual scene onto the mapping template to obtain the pixel points corresponding to each of the multiple surface elements in the mapping template. Any surface element can be mapped to the mapping template in an octahedron mapping manner; the so-called octahedron mapping refers to a spherical parameterized mapping method, the principle of which is to map spherical parameters to an octahedron, and then further map them to parameter mapping on a two-dimensional image, as shown in FIG3c. After obtaining the pixel point corresponding to each surface element in the mapping template, the computer device can store the depth values of the multiple surface elements in the virtual scene in the pixel points corresponding to each of the multiple surface elements in the mapping template to obtain the full-view depth information of the virtual scene.
[0060] It should be noted that full-view depth information can be widely used in various post-processing operations such as ray tracing and image rendering. When full-view depth information is applied to ray tracing, the method of representing full-view depth information in a two-dimensional image allows the entire subsequent ray tracing process to be completed on a single two-dimensional image, which greatly improves ray tracing efficiency.
[0061] In another specific implementation, the computer device can also use a table to represent the full-view depth information of the virtual scene. In this specific implementation, the implementation method of step S203 can be:
[0062] The computer device can construct a blank table and obtain the facet identifier of each facet and the object identifier of each virtual object; then, based on the correspondence between the virtual objects and the facets, the object identifier of each virtual object, the facet identifier of each facet, and the depth value of each facet in the virtual scene are associated and stored in the blank table to obtain the full-view depth information of the virtual scene.
[0063] For example, suppose a virtual scene includes two virtual objects, whose object identifiers are object a and object b; and each of the two virtual objects has two facets attached to its surface, whose facet identifiers are facet 1, facet 2, facet 3, and facet 4, respectively. The depth values of the facets in the virtual scene are 0.2, 0.5, 0.3, and 0.7, respectively. Then the full-view depth information constructed can be shown in Table 1 below:
[0064] Table 1
[0065] In the embodiment of the present application, multiple facets can be generated in a virtual scene, and the distance value between each facet and the camera can be obtained as the depth value of the corresponding facet in the virtual scene, thereby using the depth value of each facet in the virtual scene to construct the full-view depth information of the virtual scene. It can be seen that the construction process of the full-view depth information proposed in the embodiment of the present application is relatively simple, which can save the time cost and processing resources (such as bandwidth) required to construct the full-view depth information, thereby improving the efficiency of constructing the full-view depth information. Moreover, since each facet is attached to the surface of the corresponding virtual object, the depth value of each facet in the virtual scene can more accurately represent the depth value of the corresponding virtual object. Therefore, by constructing the full-view depth information using the depth value of each facet, the constructed full-view depth information can have a higher accuracy, thereby improving the quality of the full-view depth information. In addition, when multiple facets are attached to the surface of each virtual object, the depth value of the same virtual object can be jointly represented by the depth values of multiple facets in the full-view depth information, which can further improve the accuracy of the depth value of the virtual object, thereby further improving the quality of the full-view depth information.
[0066] Based on the method embodiment shown in FIG2 , the present application further proposes a more specific method for constructing full-view depth information. In this embodiment, the method for constructing full-view depth information is primarily described using a computer device as an example. Referring to FIG4 , the method for constructing full-view depth information may include the following steps S401-S404:
[0067] S401 , obtaining a virtual scene, generating a plurality of surface elements in the virtual scene, and obtaining respective depth values of the plurality of surface elements in the virtual scene.
[0068] S402: Obtain a texture template, where the texture template includes a plurality of pixels, and one pixel is used to store one depth value.
[0069] S403 , projecting the plurality of surface elements from the virtual scene onto the mapping template to obtain pixel points corresponding to the plurality of surface elements in the mapping template.
[0070] In a first specific implementation, the computer device may consider the center point of each facet to perform a projection operation on each facet to obtain the pixel point corresponding to the corresponding facet in the mapping template. Specifically, for the i-th facet (i∈[1, I], I is the total number of facets), the computer device may project the corresponding center point from the virtual scene to the mapping template based on the direction vector between the center point of the i-th facet and the camera (i.e., the vector pointing from the camera to the center point) to obtain a first projection point; then, the computer device may use the pixel point in the mapping template located at the first projection point as the pixel point corresponding to the i-th facet in the mapping template. For example, see FIG5a: a circle is used to represent the pixel point in the mapping template, and the first projection point is set to be the point represented by the five-pointed star shape. Since the pixel point 25 in the mapping template is located at the first projection point, the pixel point 25 in the mapping template may be used as the pixel point corresponding to the i-th facet in the mapping template. It can be seen that by projecting the face element onto the mapping template to obtain the pixel point of the face element in the mapping template, it is possible to avoid projecting the entire face element, which can save the processing resources required for projection and improve projection efficiency; and, since the center point can more accurately represent the position of the face element, the accuracy of the pixel point can be guaranteed by projecting the center point to obtain the pixel point of the face element in the mapping template.
[0071] In a second specific implementation, when the bin is circular, the computer device may also consider the radius of each bin to perform a projection operation on each bin to obtain the pixel point corresponding to the corresponding bin in the mapping template. Specifically, for the i-th bin, the computer device may project the corresponding center point from the virtual scene to the mapping template based on the direction vector between the center point of the i-th bin and the camera, obtaining a first projection point. Furthermore, based on the direction vector between an edge point of the i-th bin and the camera (i.e., the vector pointing from the camera to the edge point), the computer device may project the corresponding edge point from the virtual scene to the mapping template, obtaining a second projection point. An edge point is a point selected from the edge of the bin based on the radius of the bin. A circle is then drawn on the mapping template with the first projection point as the center and the distance between the first and second projection points as the radius, obtaining a circular area. Each pixel in the mapping template located within the circular area is used as the pixel point corresponding to the i-th bin in the mapping template. The pixel points located within the circular area mentioned herein may include pixel points located on the edge of the circular area. For example, see Figure 5b: circles are used to represent pixel points in the mapping template, and the first projection point is assumed to be the point represented by the five-pointed star shape, the second projection point is assumed to be the point represented by the triangle shape, and the circular area drawn based on the first projection point and the second projection point is the dotted circle area. Then, pixel point 05, pixel point 14-pixel point 16, pixel point 23-pixel point 27, pixel point 34-36 and pixel point 45 in the mapping template located in the dotted circle area can all be used as the pixel points corresponding to the i-th face element in the mapping template. It can be seen that by projecting the face element onto the mapping template to obtain the pixel points of the face element in the mapping template in this way, the shape composed of the pixel points finally obtained can be the same as the shape of the face element, which can improve the accuracy of the pixel points; and the number of pixel points corresponding to each face element in the mapping template can be multiple, so that after the depth values of each face element in the virtual scene are stored in the corresponding pixel points in the mapping template, there will be basically no holes or fewer holes in the depth information map obtained, which can improve the quality of the depth information map.
[0072] It should be noted that the edge points mentioned in this specific implementation can be pre-specified or determined in real time by the computer device during the execution of step S403; if the edge points are determined in real time by the computer device, the computer device needs to obtain the face element information of the i-th face element before projecting the corresponding edge points from the virtual scene to the mapping template through the octahedron projection operation to obtain the second projection point. The face element information includes: the radius of the face element, the world space coordinates of the center point, and the normal vector. Then, based on the obtained face element information, the edge of the i-th face element is determined in the virtual scene; and a point is selected (such as randomly selected) on the determined edge as the edge point of the i-th face element. By determining the edge points in real time, there is no need to consume processing resources and memory space to pre-store relevant information of the edge points, which can effectively save processing resources and memory space and improve the operating performance of the computer device.
[0073] In a third specific implementation, the computer device may also only consider the edge points of each face element to perform a projection operation on each face element to obtain the pixel point corresponding to the corresponding face element in the mapping template. Specifically, for the i-th face element, the computer device may first select K edge points on the edge of the i-th face element, where K is an integer greater than 2; and project the corresponding edge points from the virtual scene to the mapping template based on the direction vector between each edge point and the camera to obtain K second projection points. Then, the K second projection points may be connected in sequence on the mapping template to obtain a closed area; and each pixel point in the mapping template located within the closed area is used as the pixel point corresponding to the i-th face element in the mapping template. The pixel points located within the closed area mentioned here may include pixel points located on the edge of the closed area. For example, see FIG5c: a circle is used to represent a pixel point in the mapping template, and the four second projection points are all points represented by a triangular figure. The closed area drawn by sequentially connecting the four second projection points is a dotted area. Then, pixel point 14, pixel point 23-pixel point 25, and pixel point 34 in the mapping template located in the dotted area can all be used as the pixel point corresponding to the i-th face element in the mapping template. It can be seen that by projecting the face element onto the mapping template in this way to obtain the pixel point of the face element in the mapping template, the shape composed of the pixel points obtained can be similar to the shape of the face element, ensuring that the number of pixel points corresponding to each face element in the mapping template is multiple, so that after the depth value of each face element in the virtual scene is stored in the corresponding pixel point in the mapping template, there will be basically no holes or fewer holes in the depth information map obtained, which can improve the quality of the depth information map. Moreover, this method is applicable to facets of any shape, that is, no matter what the shape of the facet is, K edge points are selected on the edge of the facet for projection to determine the pixel points of the facet in the mapping template. It can be seen that this method has high applicability.
[0074] It should be noted that any two adjacent second projection points can be connected by a straight line or a curve, and there is no limitation on this; therefore, the shape of the closed area obtained by connecting K second projection points may be the same as or different from the shape of the i-th face element. In addition, the K edge points mentioned in this specific implementation can be pre-specified or determined in real time by the computer device during the execution of step S403. Furthermore, the way in which the computer device determines the K edge points in real time may include any of the following: ① Randomly select K points on the edge of the i-th face element as edge points. ② Select K points at equal intervals on the edge of the i-th face element as edge points. ③ According to the edge point selection strategy adapted to the shape of the i-th face element, K edge points are selected on the edge of the i-th face element; the edge point selection strategies corresponding to different shapes can be pre-set, such as the edge point selection strategy corresponding to the circle is used to indicate that K points are selected at equal intervals on the edge of the circle as edge points, and the edge point selection strategy corresponding to the polygon (such as a square or hexagon) is used to indicate that vertices on the edge are selected as edge points. By selecting K edge points considering the shape of the face element, the shape of the final closed area can be made similar to the shape of the i-th face element, thereby improving the accuracy of the pixel points.
[0075] Regarding the three specific implementations of step S403 mentioned above, it should be noted that:
[0076] (1) In practical applications, the computer device can arbitrarily select one of the three specific implementations mentioned above to project the i-th face element onto the mapping template. Alternatively, the computer device can also select one of the three specific implementations mentioned above to project the i-th face element onto the mapping template by considering the normal vector of the i-th face element. For example, when the shape of the i-th face element is circular, the computer device can determine the positional relationship between the i-th face element and the image plane of the camera (i.e., the plane where the lens is located) based on the normal vector of the i-th face element, and thus select a specific implementation method based on the positional relationship between the i-th face element and the image plane of the camera. The positional relationship between the i-th face element and the image plane of the camera may include a vertical relationship, a parallel relationship, or an oblique relationship.
[0077] Specifically, the computer device can determine the positional relationship between the i-th face element and the image plane of the camera by determining the positional relationship between the normal vector of the i-th face element and the image plane of the camera. Since the normal vector of the i-th face element is perpendicular to the i-th face element, if the normal vector of the i-th face element is perpendicular to the image plane of the camera, then the positional relationship between the i-th face element and the image plane of the camera can be determined to be a parallel relationship; if the normal vector of the i-th face element is parallel to the image plane of the camera, then the positional relationship between the i-th face element and the image plane of the camera can be determined to be a perpendicular relationship; if the normal vector of the i-th face element is oblique to the image plane of the camera, then the positional relationship between the i-th face element and the image plane of the camera can be determined to be an oblique relationship.
[0078] If the i-th surface element and the camera's image plane are perpendicular to each other, the image of the i-th surface element in the camera is a line segment (as shown in the upper figure in Figure 5d). The midpoint of the line segment is the center point of the i-th surface element. At this time, the camera can accurately see the center point of the i-th surface element. In this case, the first specific implementation method described above can be selected to project the center point of the i-th surface element onto the mapping template. In other words, if the i-th surface element and the camera's image plane are determined to be perpendicular to each other based on the normal vector of the i-th surface element, only the center point of the i-th surface element is projected onto the mapping template.
[0079] If the i-th bin and the camera's image plane are parallel, the image of the i-th bin in the camera is a circle (as shown in the lower image of Figure 5d). At this point, the camera can see the entire contents of the i-th bin. In this case, the projection of the i-th bin in the mapping template may be a circle. Therefore, the second specific implementation described above can be selected to project the center point and one edge point of the i-th bin onto the mapping template, so that the corresponding pixel can be determined by drawing a circle from the two projected points. In other words, if the i-th bin and the camera's image plane are parallel, as determined by the normal vector of the i-th bin, the center point and one edge point of the i-th bin are projected onto the mapping template. It should be understood that when the i-th bin and the camera's image plane are parallel, the projection of the i-th bin in the mapping template may not be a circle due to projection errors. Therefore, to improve pixel accuracy, the third specific implementation described above can also be selected to determine the pixel corresponding to the i-th bin when the i-th bin and the camera's image plane are parallel.
[0080] If the i-th surface element and the camera's image plane intersect obliquely, the image of the i-th surface element in the camera is an ellipse (not shown in Figure 5d). At this time, the camera can see part of the content of the i-th surface element. In this case, the third specific implementation described above can be selected to project the K edge points of the i-th surface element onto the mapping template, so that the corresponding pixel points can be determined by drawing a closed area using the K second projection points. In other words, if the i-th surface element and the camera's image plane are determined to intersect obliquely based on the normal vector of the i-th surface element, only the multiple edge points of the i-th surface element are projected onto the mapping template.
[0081] It can be seen from this that by considering the positional relationship between the i-th surface element and the image plane of the camera to determine the projection method of the i-th surface element, the projection result of the i-th surface element can be made more consistent with the visual effect of the camera for the i-th surface element, thereby improving the accuracy of the projection result of the i-th surface element.
[0082] (2) In the above three specific implementations, when the computer device projects the corresponding point to the mapping template to obtain the projection point based on the direction vector between any point and the camera, it can be specifically projected to the mapping template by an octahedron mapping operation based on the direction vector between any point and the camera to obtain the projection point. Furthermore, the computer device projects the corresponding point to the mapping template by an octahedron mapping operation based on the direction vector between any point and the camera to obtain the projection point in the following manner: first, each vector element in the direction vector between any point and the camera can be normalized so that the modulus of the normalized direction vector is 1, so that the normalized direction vector can be used to represent the position of any point on the sphere constructed with the camera as the center; then, the target pseudocode can be used to convert the normalized direction vector into two-dimensional coordinates, and the converted two-dimensional coordinates are the coordinates of the projection point of the any point on the mapping template. The target pseudocode is as follows:
[0083] S404 , storing the acquired depth values of the plurality of surface elements in the virtual scene in the pixel points corresponding to the plurality of surface elements in the mapping template, to obtain full-view depth information of the virtual scene.
[0084] In the specific implementation process of step S404, the computer device can first store the depth values of the multiple surface elements in the virtual scene in the corresponding pixels of the multiple surface elements in the map template to obtain a depth information map; wherein, the pixel points in the depth information map that do not store the depth value of any surface element are invalid pixels, that is, invalid pixels do not store any depth value, which can be understood as empty pixels. Then, the full-view depth information of the virtual scene can be determined based on the depth information map; specifically:
[0085] In one specific implementation, since the pixels in the texture template are all discrete points, if the pixel corresponding to each bin in the texture template is determined using the first specific implementation in step S403 (i.e., projecting only the center point of each bin), then the number of pixels corresponding to each bin in the texture template is 1. Therefore, after storing the depth value of each bin in the virtual scene into the corresponding pixel in the texture template, the resulting depth information map will contain a large number of empty pixels (i.e., pixels that do not store any depth value). These empty pixels will form one or more holes, as shown in FIG5e. In this case, if the depth information map is directly used as the full-view depth information of the virtual scene, the quality of the full-view depth information will be poor (e.g., it will contain less depth value information and have a poor visual effect). Based on this, to improve the quality of the full-view depth information, the computer device can reconstruct the invalid pixels in the depth information map according to the information reconstruction strategy to obtain a reconstructed depth information map, and use the reconstructed depth information map as the full-view depth information of the virtual scene. As shown in FIG5f , by reconstructing information of invalid pixels in the depth information map, the number of holes in the final full-view depth information can be effectively reduced, thereby improving the quality of the full-view depth information.
[0086] In another specific implementation, if the pixel points corresponding to each facet in the mapping template are determined by the second specific implementation method in step S403 (i.e., projecting the center point and one edge point of each facet), or by the third specific implementation method in step S403 (i.e., projecting multiple edge points of each facet), then the number of pixel points corresponding to each facet in the mapping template may be multiple. Then, after storing the depth value of each facet in the virtual scene into the corresponding pixel point in the mapping template, the resulting depth information map will have substantially no holes or relatively few holes, as shown in FIG5g. In this case, the computer device can directly use the depth information map as the full-view depth information of the virtual scene, thereby improving the efficiency of constructing the full-view depth information. Of course, it should be understood that in this case, in order to further improve the quality of the full-view depth information, the computer device can also reconstruct the invalid pixels in the depth information map according to the information reconstruction strategy and use the reconstructed depth information map as the full-view depth information of the virtual scene. This is not limited to this.
[0087] The information reconstruction strategy mentioned above may be a Pull-Push strategy (Pull means: constructing low-precision Mips layer by layer from high-precision Mips (information maps) according to certain rules; Push means: using low-precision Mips constructed in the Pull process to fill invalid pixels (i.e., pixels that do not store depth values) in high-precision Mips layer by layer according to certain rules). Based on this, the computer device reconstructs information on invalid pixels in the depth information map according to the information reconstruction strategy, and a specific implementation method for obtaining the reconstructed depth information map may include the following steps s11-s12:
[0088] s11, based on the depth information map, low-precision information map is generated step by step to obtain the target information map.
[0089] In which, when generating low-precision information maps step by step, the depth value stored in any pixel in the k+1th level information map is determined based on the depth values stored in multiple pixels in the kth level information map; the target information map obtained by step s11 includes only one pixel, and the included pixel stores a depth value. In this embodiment of the present application, k∈[1, K-1], K is the precision level corresponding to the target information map, and the level 0 information map is a depth information map; and the precision of any information map is positively correlated with the number of pixels contained in the corresponding information map. That is, during the execution of step s11, the precision of the level 0 information map (i.e., the depth information map) is the highest.
[0090] It should be understood that the stepwise generation of low-precision information maps based on the depth information map means: first, according to the principle of generating information maps from high to low precision, a low-precision information map (i.e., a level 1 information map) is generated based on the depth information map (i.e., a level 0 information map), and then an even lower-precision information map (i.e., a level 2 information map) is generated based on the level 1 information map, and then an even lower-precision information map (i.e., a level 3 information map) is generated based on the level 2 information map, and so on, until the target information map (i.e., an information map that only includes one pixel and stores a depth value for the pixel) is generated. That is, in the specific implementation of step s11, the value of k increases step by step, i.e., k first takes a value of 1, then a value of 2, and so on, until k takes a value of K-1.
[0091] During the specific implementation of step s11, the computer device may group the pixels in the k-th level information map, specifically grouping the pixels in the k-th level information map in a manner that a preset number (e.g., 4) of pixels form a group. After obtaining the grouping result, the image template used to generate the k+1-th level information map may be determined based on the grouping result; each pixel in the image template does not store a depth value, and a pixel in the image template corresponds to a pixel group in the grouping result, and different pixels correspond to different pixel groups. Then, the computer device may traverse each pixel in the image template, and use the currently traversed pixel as the current pixel; obtain the pixel group corresponding to the current pixel from the grouping result, and filter out valid pixels in the obtained pixel group. The so-called valid pixels refer to pixels that store depth values. If at least one valid pixel is screened out, the depth values stored in each of the valid pixels that are screened out are averaged (or weighted averaged), and the value obtained by the average operation (or weighted average) is used as the depth value and stored in the current pixel; if no valid pixel is screened out, the current pixel is determined to be empty, that is, the operation of filling the depth value is not performed on the current pixel. Continue traversing until all the pixels in the image template are traversed, and the k+1-th level information map is obtained. Alternatively, after the computer device obtains the pixel group corresponding to the current pixel, it may not perform the valid pixel screening operation, but directly perform the average operation (or weighted average) on the depth values stored in each pixel in the obtained pixel group, and store the value obtained by the average operation (or weighted average) as the depth value in the current pixel.
[0092] For example, see the left figure in Figure 5h: Assume that the depth information map (i.e., the information map of level 0) includes 16 pixels, and the computer device groups them in groups of 4 pixels. Then the computer device can first group the pixels in the depth information map to obtain 4 pixel groups, and one pixel group includes 4 pixels. Then the image template for generating the information map of level 1 can be determined. The image template includes 4 pixels, and one pixel corresponds to one pixel group. For the first pixel in the image template, the pixel group corresponding to the first pixel can be selected from the 4 pixel groups corresponding to the depth information map according to the correspondence between the pixels and the pixel groups shown in the left figure in Figure 5h (i.e., the corresponding 4 pixels are selected). Then, the four pixels in the selected pixel group are screened. If a pixel does not store a depth value, it is considered invalid. Since all four pixels in the selected pixel group are valid, the depth values stored by the four selected pixels can be directly averaged. In this case, the weight of each pixel is 1 / 4, and the average value obtained by the operation is then assigned as the depth value and stored in the first pixel. For the other three pixels in the image template, the same operation as the first pixel is performed, and the first-level information map can be obtained.
[0093] Furthermore, the computer device can continue to group the pixels in the first-level information map to obtain one pixel group, and determine an image template for generating a second-level information map, which image template includes one pixel. For this one pixel, the four pixels in the grouped pixel group can be screened; since all four pixels in this pixel group are valid, the depth values stored for the four pixels in this pixel group can be directly averaged, and the average value obtained by the operation is then designated as the depth value and stored in the pixel of the image template, resulting in a second-level information map, as shown in the right figure in Figure 5h. The dotted dots in the right figure in Figure 5h represent pixels in the first-level information map, the solid dots represent pixels in the second-level information map, and the number 1 / 4 represents the weight of each pixel in the first-level information map. Since the second-level information map only includes one pixel, and the pixel stores a depth value, the low-precision Mip generation process can be ended, and the second-level information map is used as the target information map.
[0094] It can be seen that in the embodiment of the present application, in the process of generating a low-precision information map step by step based on the depth information map to obtain the target information map, the depth value required to be stored for the pixel point in the information map of the k+1th level can be generated each time according to the depth value stored in the adjacent pixel point in the information map of the kth level. This not only makes the depth values stored in the information maps of the two adjacent levels change smoothly, thereby improving the smoothness between the information maps, but also makes the depth value stored in the target information map finally generated contain the relevant information of the various depth values originally stored in the depth information map, so that when the invalid pixel points in the depth information map are subsequently filled based on the target information map, the depth value filled in each invalid pixel point can contain the relevant information of the original existing depth value, thereby improving the quality of the reconstructed depth information map.
[0095] s12, filling invalid pixels in the high-precision information map step by step based on the target information map until all invalid pixels in the depth information map are filled, thereby obtaining a reconstructed depth information map.
[0096] In which, when filling invalid pixels in the high-precision information map step by step, the depth value stored in the invalid pixel in the k-th level information map is determined based on the depth value stored in at least one pixel in the k+1th level. It should be understood that when k is K-1, the k+1th level information map is the target information map. It should be understood that filling invalid pixels in the high-precision information map step by step based on the target information map means: according to the filling principle of the information map from low to high precision, first fill the invalid pixels in the adjacent high-precision information map (i.e., the K-1th level information map) based on the target information map (i.e., the K-th level information map), then fill the invalid pixels in the adjacent high-precision information map (i.e., the K-2th level information map) based on the K-1th level information map, then fill the invalid pixels in the adjacent high-precision information map (i.e., the K-3th level information map) based on the K-2th level information map, and so on, until the invalid pixels in the depth information map (i.e., the 0th level information map) are filled. That is to say, in the specific implementation of step s12, the value of k decreases step by step, that is, k first takes the value of K-1, then takes the value of K-2, and so on, until the value of k takes 0.
[0097] During the specific implementation of step s12, the computer device may traverse the invalid pixels in the k-th level information map and map the currently traversed invalid pixel to the k+1-th level information map to obtain a mapping point. After obtaining the mapping point, the computer device may select at least one pixel from the k+1-th level information map based on the mapping point as a reference pixel for the currently traversed invalid pixel. This embodiment of the present application does not limit the method for selecting the pixel points. For example, at least one pixel may be selected on each side of the mapping point, or multiple pixels may be selected only on the left or right side of the mapping point. The depth value of the currently traversed invalid pixel may then be calculated based on the depth values stored for each reference pixel, and the calculated depth value may be applied to the currently traversed invalid pixel. The traversal process may then continue until all invalid pixels in the k-th level information map have been traversed. It should be understood that if there are no invalid pixels in the k-th level information map, the value of k may be subtracted by one to update k, thereby re-traversing the invalid pixels in the k-th level information map. For example, when the value of k is 3, there are no invalid pixels in the information map of the third level, and the value of k can be updated to 2 through a subtraction operation, thereby traversing the invalid pixels in the information map of the second level; further, if there are still no invalid pixels in the information map of the second level, the value of k can be updated to 1 again through a subtraction operation, thereby traversing the invalid pixels in the information map of the first level, and so on.
[0098] Among them, the specific implementation method of mapping the currently traversed invalid pixel point to the k+1-th level information map to obtain the mapping point can be: obtaining the horizontal coordinate and vertical coordinate of the currently traversed invalid pixel point in the k-th level information map, using the ratio between the horizontal coordinate and the image length of the k-th level information map as the scaling parameter of the horizontal coordinate, and using the ratio between the vertical coordinate and the image width of the k-th level information map as the scaling parameter of the vertical coordinate; multiplying the scaling parameter of the horizontal coordinate by the image length of the k+1-th level information map to obtain the horizontal coordinate of the mapping point, and multiplying the scaling parameter of the vertical coordinate by the image width of the k+1-th level information map to obtain the vertical coordinate of the mapping point. For example, suppose that the horizontal coordinate of the currently traversed invalid pixel point in the k-th level information map is 10 and the vertical coordinate is 6, and the image length of the k-th level information map is 100 and the image width is 60, then the scaling parameter of the horizontal coordinate can be calculated to be 10 / 100=0.1, and the scaling parameter of the vertical coordinate can be calculated to be 6 / 60=0.1; then if the image length of the k+1-th level information map is 60 and the image width is 40, then the horizontal coordinate of the mapping point can be calculated to be 0.1×60=6, and the vertical coordinate of the mapping point can be calculated to be 0.1×40=4, so that the point with coordinates (6, 4) in the k+1-th level information map can be determined as the mapping point of the currently traversed invalid pixel point in the k+1-th level information map.
[0099] A specific implementation method for calculating the depth value of the currently traversed invalid pixel based on the depth values stored by each reference pixel can be: according to the principle that distance and weight are inversely proportional, a weight is assigned to each reference pixel based on the distance between each reference pixel and the mapping point, and the sum of the weights of each reference pixel should be equal to 1. Furthermore, each reference pixel is individually validated. Specifically, the computer device can determine whether each reference pixel passes the validity check by determining whether a depth value is stored for each reference pixel. If any reference pixel stores a depth value, the reference pixel passes the validity check. Then, based on the weights of the reference pixels that pass the validity check, a weighted average of the depth values stored for the corresponding reference pixels is performed to obtain the depth value of the currently traversed invalid pixel. This method allows for the depth value of the invalid pixel to be calculated by prioritizing the depth values stored for reference pixels closer to the invalid pixel. This allows for a smooth transition between the calculated depth value of the invalid pixel and the depth value of the reference pixel, thereby improving the accuracy of the depth value of the invalid pixel. Alternatively, a specific implementation method may be: directly perform an average operation on the depth values stored in each reference pixel to obtain the depth value of the currently traversed invalid pixel. Alternatively, first perform a validity check on each reference pixel separately; then, according to the principle that distance and weight are inversely proportional, assign weights to each reference pixel that has passed the validity check based on the distance between each reference pixel that has passed the validity check and the mapping point, thereby performing a weighted average of the weights of the reference pixels that have passed the validity check and the corresponding depth values to obtain the depth value of the currently traversed invalid pixel.
[0100] For example, refer to the left figure in FIG5i: the target information map is the second-level information map shown in the left figure of the aforementioned FIG5h. First, it is possible to detect whether there are invalid pixels in the first-level information map. Since there are no invalid pixels in the first-level information map, the computer device can continue to detect whether there are invalid pixels in the 0-level information map (i.e., the depth information map). As can be seen from the above, the 0-level information map contains a large number of invalid pixels. Therefore, the computer device can traverse each invalid pixel and select 4 pixels in the first-level information map as reference pixels for the currently traversed invalid pixel. The weight ratio of these 4 reference pixels can be 1:3:3:9 according to their distance from the currently traversed invalid pixel, that is, the weights of these 4 reference pixels can be 1 / 16, 3 / 16, 3 / 16, and 9 / 16, respectively. Then, these four reference pixels can be screened; since these four reference pixels are all valid, the depth values stored in these four reference pixels can be weighted averaged according to the weights of these four reference pixels, and the average value obtained by the weighted average is designated as the depth value and stored in the currently traversed invalid pixel, as shown in the right figure in Figure 5i. Among them, the dotted dots in the right figure in Figure 5i represent the pixels in the information map of level 0, and the solid dots represent the pixels in the information map of level 1. Then, the other invalid pixels in the information map of level 0 (i.e., the depth information map) can be traversed until all invalid pixels are traversed, and the reconstructed depth information map is obtained.
[0101] It can be seen that in the process of filling the high-precision information map step by step based on the target information map to obtain the reconstructed depth information map, the embodiment of the present application can fill the invalid pixel points in the k-th level information map each time according to the depth value stored in at least one pixel point in the k+1-th level information map. In this way, the depth values stored in the information maps of two adjacent levels can change smoothly, thereby improving the smoothness between the information maps.
[0102] Based on the relevant descriptions of s11-s12 above, it can be seen that the embodiment of the present application realizes the reconstruction of the depth information map by first generating a low-precision information map step by step based on the depth information map to obtain the target information map, and then filling the invalid pixel points in the high-precision information map step by step based on the target information map. This can make the depth values stored in adjacent pixels in the reconstructed depth information map have a smooth transition, thereby improving the image quality of the reconstructed depth information map.
[0103] It should be noted that the above is only an exemplary explanation of one implementation method of the information reconstruction strategy, and is not exhaustive. For example, in other embodiments, when the shape of the face element is circular, the information reconstruction strategy can also be a strategy for information reconstruction based on the radius of the face element. Based on this, the computer device reconstructs information on invalid pixels in the depth information map according to the information reconstruction strategy, and the specific implementation method for obtaining the reconstructed depth information map can be: traversing each face element, scaling the radius of the currently traversed face element according to a preset radius scaling ratio to obtain a scaled radius; based on the projection point of the currently traversed face element in the depth information map, draw a circular area with the scaled radius, and fill the depth values of each invalid pixel point in the depth information map located in the drawn circular area with the depth value of the current face element in the virtual scene. Continue traversing until all face elements are traversed, and obtain the reconstructed depth information map.
[0104] In the embodiment of the present application, multiple facets can be generated in a virtual scene, and the distance value between each facet and the camera can be obtained as the depth value of the corresponding facet in the virtual scene, thereby using the depth value of each facet in the virtual scene to construct the full-view depth information of the virtual scene. It can be seen that the construction process of the full-view depth information proposed in the embodiment of the present application is relatively simple, which can save the time cost and processing resources (such as bandwidth) required to construct the full-view depth information, thereby improving the efficiency of constructing the full-view depth information. Moreover, since each facet is attached to the surface of the corresponding virtual object, the depth value of each facet in the virtual scene can more accurately represent the depth value of the corresponding virtual object. Therefore, by constructing the full-view depth information using the depth value of each facet, the constructed full-view depth information can have a higher accuracy, thereby improving the quality of the full-view depth information. In addition, when multiple facets are attached to the surface of each virtual object, the depth value of the same virtual object can be jointly represented by the depth values of multiple facets in the full-view depth information, which can further improve the accuracy of the depth value of the virtual object, thereby further improving the quality of the full-view depth information.
[0105] In practical applications, the method for constructing full-view depth information shown in Figures 2 and 4 can be used in various virtual scenes, such as game scenes, scenes in film and television dramas, digital simulation scenes (i.e., scenes obtained by digitally simulating scenes in the real world), etc. For example, taking the virtual scene as a game scene as an example, the application process of the method for constructing full-view depth information may include the following two parts:
[0106] The first part is about surface-based scene geometry representation. This part mainly generates multiple surface elements in the game scene by making the surface elements closely fit the mesh surfaces of various virtual objects in the game scene (such as virtual characters, virtual props, and virtual scenery). This establishes a surface-based scene representation system, and then uses these surface elements to approximate the game scene's geometric information.
[0107] The second part involves constructing scene depth information based on bins. In this part, the direction vector between each bin's center point and the camera is first calculated based on the world-space coordinates of the bin's center point and the camera's world-space coordinates. Next, based on the calculated direction vectors, the bin's center point is projected onto a two-dimensional texture template using an octahedral mapping operation, resulting in multiple first projection points. Each first projection point represents the projected position of a bin's center point within the texture template. The pixel in the texture template located at each first projection point is then used as the corresponding pixel of the corresponding bin in the texture template. The depth value of each bin in the game scene is stored in the corresponding pixel to obtain a depth information map. Furthermore, the aforementioned pull-push strategy can be used to reconstruct information for invalid pixels in the depth information map, and the reconstructed depth information map is used as the full-view depth information for the game scene. Optionally, after obtaining the full-view depth information map for the game scene, ray tracing can be performed based on this full-view depth information, and the corresponding game screen can be rendered based on the ray tracing results.
[0108] The embodiment of the present application first constructs the face element and then uses Pull-Push to restore the full scene depth information of the game scene. On the one hand, it can improve the quality of the full-view depth information. When the full-view depth information is used for ray tracing, the quality of the full-view depth information can meet the use of the subsequent ray tracing process. This can make the lighting effect presented on the game screen more realistic when the game screen is subsequently rendered based on the ray tracing results. On the other hand, compared with the traditional drawing method in which each virtual object needs to undergo multiple depth tests, it can greatly reduce the bandwidth and time required for drawing submission, thereby improving the construction efficiency of the full-view depth information to a certain extent, and making the game quality indicators such as running efficiency and bandwidth consumption significantly improved.
[0109] Similarly, when the virtual scene is a scene obtained by digitally simulating a popular tourist attraction in the real world (hereinafter referred to as a digital simulation scene), the application process of the method for constructing full-view depth information can also include the following two parts:
[0110] The first part is about facet-based scene geometry representation. This part primarily involves generating multiple facets in a digitally simulated scene by attaching facets to the mesh surfaces of various virtual objects in the scene (e.g., virtual buildings and plants simulated in popular tourist attractions). This creates a facet-based scene representation system, which then uses these facets to approximate the scene's geometry.
[0111] The second part is the construction of full-view depth information of scene depth based on facets. In this part, the center point of each facet can be projected into a two-dimensional mapping template through an octahedral mapping operation according to the direction vector between the center point of each facet and the camera to obtain multiple first projection points, and the pixel points located at each first projection point in the mapping template are used as the pixel points corresponding to the corresponding facet in the mapping template, so as to store the depth value of each facet in the digital simulation scene into the corresponding pixel points and obtain a depth information map. Furthermore, the aforementioned Pull-Push strategy can be used to reconstruct information of invalid pixels in the depth information map, and the reconstructed depth information map can be used as the full-view depth information of the digital simulation scene. Optionally, after obtaining the full-view depth information map of the digital simulation scene, ray tracing can be performed based on the full-view depth information, and then the corresponding digital simulation picture can be rendered based on the ray tracing results.
[0112] The embodiment of the present application first constructs the face element and then performs a pull-push restoration to obtain the full scene depth information of the digital simulation scene. On the one hand, this can improve the quality of the full-view depth information. When the full-view depth information is used for ray tracing, the quality of the full-view depth information can meet the needs of the subsequent ray tracing process. This allows the subsequent rendering of the digital simulation screen based on the ray tracing results to present a more realistic lighting effect. On the other hand, compared to the traditional drawing method in which each virtual object needs to undergo multiple depth tests, the bandwidth and time required for drawing submission can be greatly reduced, thereby improving the construction efficiency of the full-view depth information to a certain extent, thereby avoiding the phenomenon of jamming during the rendering and display of the digital simulation screen, and improving the display smoothness of the digital simulation screen.
[0113] Based on the description of the embodiment of the method for constructing full-view depth information described above, the present application also discloses a device for constructing full-view depth information. The device for constructing full-view depth information can be a computer program (including program code) running on a computer device, and the device for constructing full-view depth information can execute each step of the method flow shown in Figure 2 or Figure 4. Referring to Figure 6, the device for constructing full-view depth information can run the following units:
[0114] The processing unit 601 is configured to obtain a virtual scene, wherein the virtual scene includes a camera and at least one virtual object, wherein the camera is a component for presenting a view of the virtual scene in at least one viewing direction;
[0115] The processing unit 601 is further configured to generate a plurality of facets in the virtual scene, wherein the facets are planar figures having directions and sizes; wherein at least one facet is attached to the surface of each virtual object;
[0116] The processing unit 601 is further configured to obtain a depth value of each of the plurality of surface elements in the virtual scene, where the depth value refers to a distance between the surface element and the camera.
[0117] The constructing unit 602 is configured to construct full-view depth information of the virtual scene using the acquired depth value.
[0118] In one embodiment, when the construction unit 602 is used to construct the full-view depth information of the virtual scene using the acquired depth value, it can be specifically used to:
[0119] Obtaining a texture template, wherein the texture template includes a plurality of pixels, and each pixel is used to store one depth value;
[0120] Projecting the plurality of facets from the virtual scene onto the mapping template to obtain pixel points corresponding to the plurality of facets in the mapping template;
[0121] The acquired depth values of the plurality of surface elements in the virtual scene are stored in the pixel points corresponding to the plurality of surface elements in the mapping template, so as to obtain the full-view depth information of the virtual scene.
[0122] In another embodiment, when the construction unit 602 is used to project the multiple surface elements from the virtual scene onto the mapping template to obtain the pixel points corresponding to the multiple surface elements in the mapping template, it can be specifically used to:
[0123] For the i-th facet, project the corresponding center point from the virtual scene to the mapping template according to the direction vector between the center point of the i-th facet and the camera to obtain a first projection point; where i∈[1,I], I is the total number of facets;
[0124] The pixel point located at the first projection point in the mapping template is used as the pixel point corresponding to the i-th surface element in the mapping template.
[0125] In another embodiment, when the construction unit 602 is configured to store the acquired depth values of the plurality of surface elements in the virtual scene in the pixel points corresponding to the plurality of surface elements in the mapping template to obtain the full-view depth information of the virtual scene, it can be specifically configured to:
[0126] The acquired depth values of the plurality of surface elements in the virtual scene are stored in the pixel points corresponding to the plurality of surface elements in the map template, respectively, to obtain a depth information map, wherein the pixel points in the depth information map that do not store the depth value of any surface element are invalid pixels;
[0127] The invalid pixels in the depth information map are reconstructed according to the information reconstruction strategy to obtain a reconstructed depth information map, and the reconstructed depth information map is used as the full-view depth information of the virtual scene.
[0128] In another embodiment, when the construction unit 602 is used to reconstruct information of invalid pixels in the depth information map according to the information reconstruction strategy to obtain a reconstructed depth information map, it can be specifically used to:
[0129] Based on the depth information map, a low-precision information map is generated level by level to obtain a target information map; the target information map includes only one pixel, and the pixel includes a depth value stored therein; wherein, when the low-precision information map is generated level by level, the depth value stored in any pixel in the information map of the k+1th level is determined based on the depth values stored in multiple pixels in the information map of the kth level;
[0130] Filling invalid pixels in the high-precision information map level by level based on the target information map until all invalid pixels in the depth information map are filled, thereby obtaining a reconstructed depth information map; wherein, when filling invalid pixels in the high-precision information map level by level, a depth value stored in the invalid pixel in the k-th level information map is determined based on a depth value stored in at least one pixel in the k+1-th level information map;
[0131] Among them, the accuracy of any information map is positively correlated with the number of pixels contained in the corresponding information map; k∈[1, K-1], K is the accuracy level corresponding to the target information map, and the information map of level 0 is the depth information map; when the value of k is K-1, the information map of level k+1 is the target information map.
[0132] In another embodiment, when the construction unit 602 is used to generate the low-precision information map step by step based on the depth information map, it can be specifically used to:
[0133] Grouping pixels in the k-th level information map, and determining an image template for generating a k+1-th level information map based on the grouping result; each pixel in the image template does not store a depth value, and each pixel in the image template corresponds to a pixel group in the grouping result, and different pixels correspond to different pixel groups;
[0134] Traversing each pixel point in the image template, and taking the currently traversed pixel point as the current pixel point;
[0135] Obtaining a pixel group corresponding to the current pixel from the grouping result, and screening valid pixels in the obtained pixel group, where the valid pixels refer to pixels storing depth values;
[0136] If at least one valid pixel point is screened out, a mean operation is performed on the depth values stored in each of the screened valid pixel points, and the value obtained by the mean operation is used as the depth value and stored in the current pixel point; if no valid pixel point is screened out, the current pixel point is determined to be empty;
[0137] The traversal is continued until all the pixels in the image template are traversed, and the k+1th level information map is obtained.
[0138] In another embodiment, when the construction unit 602 is used to fill invalid pixels in the high-precision information map step by step based on the target information map, it can be specifically used to:
[0139] Traverse the invalid pixels in the k-th level information map;
[0140] Mapping the currently traversed invalid pixel point to the k+1th level information map to obtain a mapping point; and selecting at least one pixel point from the k+1th level information map based on the mapping point as a reference pixel point for the currently traversed invalid pixel point;
[0141] Calculating the depth value of the currently traversed invalid pixel according to the depth value stored in each reference pixel, and filling the calculated depth value into the currently traversed invalid pixel;
[0142] The traversal is continued until all invalid pixels in the k-th level information map are traversed.
[0143] In another embodiment, when the construction unit 602 is used to calculate the depth value of the currently traversed invalid pixel point based on the depth value stored in each reference pixel point, it can be specifically used to:
[0144] According to the principle that distance and weight are inversely proportional, a weight is assigned to each reference pixel according to the distance between each reference pixel and the mapping point;
[0145] Performing validity checks on each of the reference pixels respectively; wherein, if any reference pixel stores a depth value, the reference pixel passes the validity check;
[0146] According to the weights of the reference pixels that have passed the validity check, a weighted average is performed on the depth values stored for the corresponding reference pixels to obtain the depth value of the currently traversed invalid pixel.
[0147] In another embodiment, the shape of any surface element is circular; accordingly, when the construction unit 602 is used to project the multiple surface elements from the virtual scene onto the mapping template to obtain the pixel points corresponding to the multiple surface elements in the mapping template, it can be specifically used to:
[0148] For the i-th facet, project the corresponding center point from the virtual scene to the mapping template according to the direction vector between the center point of the i-th facet and the camera to obtain a first projection point; where i∈[1,I], I is the total number of facets;
[0149] According to a direction vector between an edge point of the i-th facet and the camera, project the corresponding edge point from the virtual scene to the mapping template to obtain a second projection point; an edge point refers to a point selected from the edge of the facet based on the radius of the facet;
[0150] Draw a circle on the mapping template with the first projection point as the center and the distance between the first projection point and the second projection point as the radius to obtain a circular area;
[0151] Each pixel point in the mapping template located within the circular area is used as the pixel point corresponding to the i-th bin in the mapping template.
[0152] In another embodiment, the construction unit 602 may also be used to:
[0153] Obtaining facet information of the i-th facet, the facet information including: a radius, a world space coordinate of a center point, and a normal vector of the i-th facet;
[0154] According to the acquired facet information, an edge of the i-th facet is determined in the virtual scene; and a point on the determined edge is selected as an edge point of the i-th facet.
[0155] In another embodiment, when the construction unit 602 is used to project the multiple surface elements from the virtual scene onto the mapping template to obtain the pixel points corresponding to the multiple surface elements in the mapping template, it can be specifically used to:
[0156] For the i-th bin, select K edge points on the edge of the i-th bin, where K is an integer greater than 2; where i∈[1, I], I is the total number of bins;
[0157] According to the direction vector between each edge point and the camera, the corresponding edge point is projected from the virtual scene to the mapping template to obtain K second projection points;
[0158] Connecting the K second projection points sequentially on the mapping template to obtain a closed area;
[0159] Each pixel point in the mapping template located within the closed area is used as the pixel point corresponding to the i-th surface element in the mapping template.
[0160] In another embodiment, when the construction unit 602 is configured to store the acquired depth values of the plurality of surface elements in the virtual scene in the pixel points corresponding to the plurality of surface elements in the mapping template to obtain the full-view depth information of the virtual scene, it can be specifically configured to:
[0161] The depth values of the plurality of surface elements in the virtual scene are stored in the pixel points corresponding to the plurality of surface elements in the map template to obtain a depth information map;
[0162] The depth information map is used as the full-view depth information of the virtual scene.
[0163] According to another embodiment of the present application, the various units in the construction device for full-view depth information shown in Figure 6 can be individually or all combined into one or several other units to constitute, or one (or some) of the units can be further divided into multiple functionally smaller units to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the construction device based on full-view depth information can also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0164] According to another embodiment of the present application, a computer program (including program code) capable of executing the steps involved in the corresponding method shown in FIG. 2 or FIG. 4 can be run on a general-purpose computing device, such as a computer, including processing elements and storage elements such as a central processing unit (CPU), a random access memory (RAM), and a read-only memory (ROM). A device for constructing full-view depth information as shown in FIG. 6 can be constructed, and the method for constructing full-view depth information in the embodiment of the present application can be implemented. The computer program can be recorded on, for example, a computer-readable recording medium, and loaded into the computing device via the computer-readable recording medium and executed therein.
[0165] In the embodiment of the present application, multiple facets can be generated in a virtual scene, and the distance value between each facet and the camera can be obtained as the depth value of the corresponding facet in the virtual scene, thereby using the depth value of each facet in the virtual scene to construct the full-view depth information of the virtual scene. It can be seen that the construction process of the full-view depth information proposed in the embodiment of the present application is relatively simple, which can save the time cost and processing resources (such as bandwidth) required to construct the full-view depth information, thereby improving the efficiency of constructing the full-view depth information. Moreover, since each facet is attached to the surface of the corresponding virtual object, the depth value of each facet in the virtual scene can more accurately represent the depth value of the corresponding virtual object. Therefore, by constructing the full-view depth information using the depth value of each facet, the constructed full-view depth information can have a higher accuracy, thereby improving the quality of the full-view depth information. In addition, when multiple facets are attached to the surface of each virtual object, the depth value of the same virtual object can be jointly represented by the depth values of multiple facets in the full-view depth information, which can further improve the accuracy of the depth value of the virtual object, thereby further improving the quality of the full-view depth information.
[0166] Based on the description of the above method embodiment and the device embodiment, the embodiment of the present application also provides a computer device. Referring to Figure 7, the computer device at least includes a processor 701, an input interface 702, an output interface 703 and a computer storage medium 704. Among them, the processor 701, the input interface 702, the output interface 703 and the computer storage medium 704 in the computer device can be connected via a bus or other means. The computer storage medium 704 can be stored in the memory of the computer device, and the computer storage medium 704 is used to store a computer program, and the computer program includes program instructions, and the processor 701 is used to execute the program instructions stored in the computer storage medium 704. The processor 701 (or CPU (Central Processing Unit, central processing unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to realize the corresponding method flow or corresponding function.
[0167] In one embodiment, the processor 701 described in the embodiment of the present application can be used to perform a series of full-view depth information construction processes on a virtual scene, specifically including: generating multiple face elements in the virtual scene, where the face elements are planar figures with direction and size; the virtual scene includes a camera and at least one virtual object, and each virtual object has at least one face element attached to its surface; obtaining the depth values of each generated face element in the virtual scene, where the depth value of any face element in the virtual scene is determined by the distance value between the corresponding face element and the camera; using the depth values of each face element in the virtual scene to construct the full-view depth information of the virtual scene, and so on.
[0168] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer storage medium provides a storage space that stores the operating system of the computer device. In addition, one or more instructions suitable for being loaded and executed by the processor 701 are also stored in the storage space. These instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.
[0169] In one embodiment, a processor may load and execute one or more instructions stored in a computer storage medium to implement the corresponding steps in the method embodiments shown in FIG. 2 or FIG. 4 . In a specific implementation, the processor may load and execute the following steps:
[0170] Obtaining a virtual scene, wherein the virtual scene includes a camera and at least one virtual object, wherein the camera is a component for presenting a view of the virtual scene in at least one viewing direction;
[0171] Generating a plurality of surface elements in the virtual scene, wherein the surface element is a plane figure having a direction and a size, wherein at least one surface element is attached to the surface of each virtual object;
[0172] Obtaining respective depth values of the plurality of surface elements in the virtual scene, wherein the depth value refers to: a distance value between the surface element and the camera;
[0173] The acquired depth value is used to construct full-view depth information of the virtual scene.
[0174] In one embodiment, when constructing the full-view depth information of the virtual scene using the acquired depth value, the one or more instructions may be loaded and specifically executed by the processor:
[0175] Obtaining a texture template, wherein the texture template includes a plurality of pixels, and each pixel is used to store one depth value;
[0176] Projecting the plurality of facets from the virtual scene onto the mapping template to obtain pixel points corresponding to the plurality of facets in the mapping template;
[0177] The acquired depth values of the plurality of surface elements in the virtual scene are stored in the pixel points corresponding to the plurality of surface elements in the mapping template, so as to obtain the full-view depth information of the virtual scene.
[0178] In another embodiment, when projecting the multiple surface elements from the virtual scene onto the mapping template to obtain pixel points corresponding to the multiple surface elements in the mapping template, the one or more instructions may be loaded and specifically executed by the processor:
[0179] For the i-th facet, project the corresponding center point from the virtual scene to the mapping template according to the direction vector between the center point of the i-th facet and the camera to obtain a first projection point; where i∈[1,I], I is the total number of facets;
[0180] The pixel point located at the first projection point in the mapping template is used as the pixel point corresponding to the i-th surface element in the mapping template.
[0181] In another embodiment, when storing the acquired depth values of the plurality of surface elements in the virtual scene in the pixel points corresponding to the plurality of surface elements in the mapping template to obtain the full-view depth information of the virtual scene, the one or more instructions may be loaded and specifically executed by the processor:
[0182] The acquired depth values of the plurality of surface elements in the virtual scene are stored in the pixel points corresponding to the plurality of surface elements in the map template, respectively, to obtain a depth information map, wherein the pixel points in the depth information map that do not store the depth value of any surface element are invalid pixels;
[0183] The invalid pixels in the depth information map are reconstructed according to the information reconstruction strategy to obtain a reconstructed depth information map, and the reconstructed depth information map is used as the full-view depth information of the virtual scene.
[0184] In another embodiment, when reconstructing information of invalid pixels in the depth information map according to the information reconstruction strategy to obtain a reconstructed depth information map, the one or more instructions may be loaded and specifically executed by the processor:
[0185] Based on the depth information map, a low-precision information map is generated level by level to obtain a target information map; the target information map includes only one pixel, and the pixel includes a depth value stored therein; wherein, when the low-precision information map is generated level by level, the depth value stored in any pixel in the information map of the k+1th level is determined based on the depth values stored in multiple pixels in the information map of the kth level;
[0186] Filling invalid pixels in the high-precision information map level by level based on the target information map until all invalid pixels in the depth information map are filled, thereby obtaining a reconstructed depth information map; wherein, when filling invalid pixels in the high-precision information map level by level, a depth value stored in the invalid pixel in the k-th level information map is determined based on a depth value stored in at least one pixel in the k+1-th level information map;
[0187] Among them, the accuracy of any information map is positively correlated with the number of pixels contained in the corresponding information map; k∈[1, K-1], K is the accuracy level corresponding to the target information map, and the information map of level 0 is the depth information map; when the value of k is K-1, the information map of level k+1 is the target information map.
[0188] In another embodiment, when generating a low-precision information map step by step based on the depth information map, the one or more instructions may be loaded and specifically executed by the processor:
[0189] Grouping pixels in the k-th level information map, and determining an image template for generating a k+1-th level information map based on the grouping result; each pixel in the image template does not store a depth value, and each pixel in the image template corresponds to a pixel group in the grouping result, and different pixels correspond to different pixel groups;
[0190] Traversing each pixel point in the image template, and taking the currently traversed pixel point as the current pixel point;
[0191] Obtaining a pixel group corresponding to the current pixel from the grouping result, and screening valid pixels in the obtained pixel group, where the valid pixels refer to pixels storing depth values;
[0192] If at least one valid pixel point is screened out, a mean operation is performed on the depth values stored in each of the screened valid pixel points, and the value obtained by the mean operation is used as the depth value and stored in the current pixel point; if no valid pixel point is screened out, the current pixel point is determined to be empty;
[0193] The traversal is continued until all the pixels in the image template are traversed, and the k+1th level information map is obtained.
[0194] In another embodiment, when filling invalid pixels in a high-precision information map step by step based on the target information map, the one or more instructions may be loaded and specifically executed by the processor:
[0195] Traverse the invalid pixels in the k-th level information map;
[0196] Mapping the currently traversed invalid pixel point to the k+1th level information map to obtain a mapping point; and selecting at least one pixel point from the k+1th level information map based on the mapping point as a reference pixel point for the currently traversed invalid pixel point;
[0197] Calculating the depth value of the currently traversed invalid pixel according to the depth value stored in each reference pixel, and filling the calculated depth value into the currently traversed invalid pixel;
[0198] The traversal is continued until all invalid pixels in the k-th level information map are traversed.
[0199] In another embodiment, when calculating the depth value of the currently traversed invalid pixel point based on the depth values stored in each reference pixel point, the one or more instructions may be loaded and specifically executed by the processor:
[0200] According to the principle that distance and weight are inversely proportional, a weight is assigned to each reference pixel according to the distance between each reference pixel and the mapping point;
[0201] Performing validity checks on each of the reference pixels respectively; wherein, if any reference pixel stores a depth value, the reference pixel passes the validity check;
[0202] According to the weights of the reference pixels that have passed the validity check, a weighted average is performed on the depth values stored for the corresponding reference pixels to obtain the depth value of the currently traversed invalid pixel.
[0203] In another embodiment, the shape of any bin is circular; accordingly, when projecting the multiple bins from the virtual scene onto the mapping template to obtain pixel points corresponding to the multiple bins in the mapping template, the one or more instructions may be loaded and specifically executed by the processor:
[0204] For the i-th facet, project the corresponding center point from the virtual scene to the mapping template according to the direction vector between the center point of the i-th facet and the camera to obtain a first projection point; where i∈[1,I], I is the total number of facets;
[0205] According to a direction vector between an edge point of the i-th facet and the camera, project the corresponding edge point from the virtual scene to the mapping template to obtain a second projection point; an edge point refers to a point selected from the edge of the facet based on the radius of the facet;
[0206] Draw a circle on the mapping template with the first projection point as the center and the distance between the first projection point and the second projection point as the radius to obtain a circular area;
[0207] Each pixel point in the mapping template located within the circular area is used as the pixel point corresponding to the i-th bin in the mapping template.
[0208] In another embodiment, the one or more instructions may be loaded and specifically executed by a processor:
[0209] Obtaining facet information of the i-th facet, the facet information including: a radius, a world space coordinate of a center point, and a normal vector of the i-th facet;
[0210] According to the acquired facet information, an edge of the i-th facet is determined in the virtual scene; and a point on the determined edge is selected as an edge point of the i-th facet.
[0211] In another embodiment, when projecting the multiple surface elements from the virtual scene onto the mapping template to obtain pixel points corresponding to the multiple surface elements in the mapping template, the one or more instructions may be loaded and specifically executed by the processor:
[0212] For the i-th bin, select K edge points on the edge of the i-th bin, where K is an integer greater than 2; where i∈[1, I], I is the total number of bins;
[0213] According to the direction vector between each edge point and the camera, the corresponding edge point is projected from the virtual scene to the mapping template to obtain K second projection points;
[0214] Connecting the K second projection points sequentially on the mapping template to obtain a closed area;
[0215] Each pixel point in the mapping template located within the closed area is used as the pixel point corresponding to the i-th surface element in the mapping template.
[0216] In another embodiment, when storing the acquired depth values of the plurality of surface elements in the virtual scene in the pixel points corresponding to the plurality of surface elements in the mapping template to obtain the full-view depth information of the virtual scene, the one or more instructions may be loaded and specifically executed by the processor:
[0217] The depth values of the plurality of surface elements in the virtual scene are stored in the pixel points corresponding to the plurality of surface elements in the map template to obtain a depth information map;
[0218] The depth information map is used as the full-view depth information of the virtual scene.
[0219] In the embodiment of the present application, multiple facets can be generated in a virtual scene, and the distance value between each facet and the camera can be obtained as the depth value of the corresponding facet in the virtual scene, thereby using the depth value of each facet in the virtual scene to construct the full-view depth information of the virtual scene. It can be seen that the construction process of the full-view depth information proposed in the embodiment of the present application is relatively simple, which can save the time cost and processing resources (such as bandwidth) required to construct the full-view depth information, thereby improving the efficiency of constructing the full-view depth information. Moreover, since each facet is attached to the surface of the corresponding virtual object, the depth value of each facet in the virtual scene can more accurately represent the depth value of the corresponding virtual object. Therefore, by constructing the full-view depth information using the depth value of each facet, the constructed full-view depth information can have a higher accuracy, thereby improving the quality of the full-view depth information. In addition, when multiple facets are attached to the surface of each virtual object, the depth value of the same virtual object can be jointly represented by the depth values of multiple facets in the full-view depth information, which can further improve the accuracy of the depth value of the virtual object, thereby further improving the quality of the full-view depth information.
[0220] It should be noted that, according to one aspect of the present application, a computer program product or computer program is also provided. The computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional aspects of the method embodiments shown in FIG. 2 or FIG. 4 .
[0221] It should be understood that the above disclosure is only a preferred embodiment of the present application and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A method for constructing full-view depth information, It is characterized in that include: Obtaining a virtual scene, wherein the virtual scene includes a camera and at least one virtual object, wherein the camera is a component for presenting a view of the virtual scene in at least one viewing direction; Generate a plurality of face elements in the virtual scene, wherein the face element is a plane figure having a direction and a size, wherein at least one face element is attached to the surface of each virtual object; Obtaining respective depth values of the plurality of face elements in the virtual scene, wherein the depth value refers to: a distance value between the face element and the camera; The acquired depth value is used to construct full-view depth information of the virtual scene.
2. The method according to claim 1, It is characterized in that The step of using the acquired depth value to construct full-view depth information of the virtual scene includes: Acquire a texture template, wherein the texture template includes a plurality of pixels, and one pixel is used to store one depth value; Projecting the plurality of face elements from the virtual scene to the mapping template to obtain pixel points corresponding to the plurality of face elements in the mapping template; The acquired depth values of the plurality of surface elements in the virtual scene are stored in the pixel points corresponding to the plurality of surface elements in the mapping template, so as to obtain the full-viewing depth information of the virtual scene.
3. The method according to claim 1 or 2, It is characterized in that The step of projecting the plurality of facets from the virtual scene to the mapping template to obtain pixel points corresponding to the plurality of facets in the mapping template includes: For the i-th face element, according to the direction vector between the center point of the i-th face element and the camera, project the corresponding center point from the virtual scene to the mapping template to obtain a first projection point; wherein i∈[1,I], I is the total number of face elements; The pixel point located at the first projection point in the mapping template is used as the pixel point corresponding to the i-th surface element in the mapping template.
4. The method according to any one of claims 1 to 3, It is characterized in that The method of storing the acquired depth values of the plurality of face elements in the virtual scene in the pixel points corresponding to the plurality of face elements in the mapping template to obtain the full-view depth information of the virtual scene includes: The acquired depth values of the plurality of face elements in the virtual scene are stored in the pixel points corresponding to the plurality of face elements in the map template, respectively, to obtain a depth information map, wherein the pixel points in the depth information map that do not store the depth value of any face element are invalid pixel points; The invalid pixels in the depth information map are reconstructed according to the information reconstruction strategy to obtain a reconstructed depth information map, and the reconstructed depth information map is used as the full-view depth information of the virtual scene.
5. The method according to any one of claims 1 to 4, It is characterized in that The step of reconstructing information of invalid pixels in the depth information map according to the information reconstruction strategy to obtain a reconstructed depth information map includes: Based on the depth information map, a low-precision information map is generated step by step to obtain a target information map; the target information map includes only one pixel point, and the pixel point includes a depth value stored therein; wherein, when the low-precision information map is generated step by step, the depth value stored in any pixel point in the information map of the k+1th level is determined according to the depth values stored in multiple pixel points in the information map of the kth level; Based on the target information map, invalid pixels in the high-precision information map are filled step by step until all invalid pixels in the depth information map are filled, thereby obtaining a reconstructed depth information map; wherein, when the invalid pixels in the high-precision information map are filled step by step, the depth value stored in the invalid pixel in the k-th level information map is determined according to the depth value stored in at least one pixel in the k+1-th level information map; Among them, the accuracy of any information map is positively correlated with the number of pixels contained in the corresponding information map; k∈[1, K-1], K is the accuracy level corresponding to the target information map, and the 0th level information map is the depth information map; when the value of k is K-1, the k+1th level information map is the target information map.
6. The method according to any one of claims 1 to 5, It is characterized in that The step of gradually generating a low-precision information map based on the depth information map includes: The pixel points in the k-th level information map are grouped, and an image template for generating the k+1-th level information map is determined according to the grouping result; each pixel point in the image template does not store a depth value, and a pixel point in the image template corresponds to a pixel group in the grouping result, and different pixel points correspond to different pixel groups; Traversing each pixel point in the image template, and taking the currently traversed pixel point as the current pixel point; Acquire a pixel group corresponding to the current pixel from the grouping result, and filter valid pixel points in the acquired pixel group, wherein the valid pixel points refer to pixel points storing depth values; If at least one valid pixel point is screened out, a mean operation is performed on the depth values stored in each of the screened valid pixel points, and a value obtained by the mean operation is used as a depth value and stored in the current pixel point; if no valid pixel point is screened out, the current pixel point is determined to be empty; Continue traversing until all pixels in the image template are traversed, and obtain the k+1th level information map.
7. The method according to any one of claims 1 to 6, It is characterized in that The step of filling invalid pixels in the high-precision information map step by step based on the target information map includes: Traverse the invalid pixels in the k-th level information map; Mapping the currently traversed invalid pixel point to the k+1th level information map to obtain a mapping point; and selecting at least one pixel point from the k+1th level information map based on the mapping point as a reference pixel point for the currently traversed invalid pixel point; Calculate the depth value of the currently traversed invalid pixel according to the depth value stored in each reference pixel, and fill the calculated depth value into the currently traversed invalid pixel; The traversal is continued until all invalid pixels in the k-th level information map are traversed.
8. The method according to any one of claims 1 to 7, It is characterized in that The calculating the depth value of the currently traversed invalid pixel point according to the depth value stored in each reference pixel point includes: According to the principle that distance and weight are inversely proportional, a weight is assigned to each reference pixel point according to the distance between each reference pixel point and the mapping point; Performing validity checks on each of the reference pixels respectively; wherein if any of the reference pixels stores a depth value, the any of the reference pixels passes the validity check; According to the weights of the reference pixels that have passed the validity check, the depth values stored in the corresponding reference pixels are weighted averaged to obtain the depth value of the currently traversed invalid pixel.
9. The method according to any one of claims 1 to 8, It is characterized in that The shape of any face element is a circle; and the step of projecting the plurality of face elements from the virtual scene to the mapping template to obtain pixel points corresponding to the plurality of face elements in the mapping template comprises: For the i-th face element, according to the direction vector between the center point of the i-th face element and the camera, project the corresponding center point from the virtual scene to the mapping template to obtain a first projection point; wherein i∈[1,I], I is the total number of face elements; According to a direction vector between an edge point of the i-th face element and the camera, project the corresponding edge point from the virtual scene to the mapping template to obtain a second projection point; the edge point refers to: a point selected from the edge of the face element based on the radius of the face element; Taking the first projection point as the center and the distance between the first projection point and the second projection point as the radius, draw a circle on the mapping template to obtain a circular area; Each pixel point in the mapping template that is located within the circular area is used as a pixel point corresponding to the i-th face element in the mapping template.
10. The method according to any one of claims 1 to 9, It is characterized in that The method further comprises: Obtaining face element information of the i-th face element, the face element information including: a radius of the i-th face element, a world space coordinate of a center point, and a normal vector; According to the acquired face element information, the edge of the i-th face element is determined in the virtual scene; and a point is selected on the determined edge as the edge point of the i-th face element.
11. The method according to any one of claims 1 to 10, It is characterized in that The step of projecting the plurality of facets from the virtual scene to the mapping template to obtain pixel points corresponding to the plurality of facets in the mapping template includes: For the i-th facet, select K edge points on the edge of the i-th facet, where K is an integer greater than 2; wherein i∈[1, I], I is the total number of facets; According to the direction vector between each edge point and the camera, the corresponding edge point is projected from the virtual scene to the mapping template to obtain K second projection points; Connecting the K second projection points in sequence on the mapping template to obtain a closed area; Each pixel point in the mapping template located in the closed area is used as the pixel point corresponding to the i-th face element in the mapping template.
12. The method according to any one of claims 1 to 11, It is characterized in that The method of storing the acquired depth values of the plurality of face elements in the virtual scene in the pixel points corresponding to the plurality of face elements in the mapping template to obtain the full-view depth information of the virtual scene includes: The acquired depth values of the plurality of face elements in the virtual scene are stored in the pixel points corresponding to the plurality of face elements in the texture template to obtain a depth information texture; The depth information map is used as the full-view depth information of the virtual scene.
13. The method according to any one of claims 1 to 12, It is characterized in that If it is determined according to the normal vector of the i-th surface element that the i-th surface element and the image plane of the camera are perpendicular to each other, then only the center point of the i-th surface element is projected onto the mapping template; If it is determined according to the normal vector of the i-th surface element that the i-th surface element and the image plane of the camera are parallel to each other, then the center point and an edge point of the i-th surface element are projected onto the mapping template; If it is determined according to the normal vector of the i-th surface element that the i-th surface element and the image plane of the camera are mutually oblique, then only the multiple edge points of the i-th surface element are projected onto the mapping template; Wherein, i∈[1,I], I is the total number of the facets.
14. A device for constructing full-view depth information, It is characterized in that include: A processing unit, configured to obtain a virtual scene, wherein the virtual scene includes a camera and at least one virtual object, wherein the camera is a component for presenting a view of the virtual scene in at least one viewing direction; The processing unit is further used to generate a plurality of face elements in the virtual scene, wherein the face element is a plane figure having a direction and a size; wherein at least one face element is attached to the surface of each virtual object; The processing unit is further used to obtain the depth value of each of the plurality of face elements in the virtual scene, wherein the depth value refers to: the distance value between the face element and the camera; A construction unit is used to construct full-view depth information of the virtual scene using the acquired depth value.
15. A computer device comprising an input interface and an output interface, It is characterized in that Also includes: processor and computer storage media; The processor is suitable for implementing one or more instructions, the computer storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by the processor and executing the method for constructing full-view depth information as described in any one of claims 1-13.
16. A computer storage medium, It is characterized in that The computer storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the method for constructing full-view depth information as described in any one of claims 1-13.
Citation Information
Patent Citations
Modelling a three-dimensional space
CN107980150A
Generating environmental data
CN115004193A
Global illumination rendering method and device, computer equipment and storage medium
CN115830208A
Information construction method and device, equipment and storage medium
CN116109803A
Method and device for establishing the frontier between objects of a scene in a depth map
US20150371433A1
