Method and apparatus for determining potential object visible set, electronic device, and storage medium
By combining a multi-layered bounding box structure with soft raster and ray detection, the problems of low computational efficiency and recognition accuracy in virtual scenes are solved, achieving efficient and accurate model culling and improving rendering performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-12-06
- Publication Date
- 2026-07-21
Smart Images

Figure CN116212369B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of model rendering technology, and in particular to a method, apparatus, electronic device, and storage medium for determining the visible set of potential objects. Background Technology
[0002] In complex virtual scenes, there are usually a large number of models. When rendering the scene, occluded models need to be culled. These culled occluded models are not rendered, thus reducing draw calls during the rendering process and improving the frame rate. One related technique is to generate rays in the virtual scene and use rays to detect whether models are occluded, but this method is time-consuming and computationally inefficient. Another method is to compare the scene depth map with the model depth to identify occluded models, but this method has low accuracy in identifying occluded models and still renders a large number of occluded models, resulting in a waste of computational resources. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a method, apparatus, electronic device and storage medium for determining the visible set of potential objects, so as to ensure both computational efficiency and recognition accuracy, thereby improving the overall performance of scene rendering.
[0004] In a first aspect, embodiments of the present invention provide a method for determining a visible set of potential objects. The method includes: acquiring scene models in a virtual scene and constructing hierarchical bounding boxes of the virtual scene; the hierarchical bounding boxes include bounding boxes at different levels that surround the scene models; according to the hierarchical structure of the hierarchical bounding boxes, removing invisible bounding boxes at each level of the hierarchical bounding boxes using a soft raster method to obtain an initial visible bounding box in the hierarchical bounding boxes; the invisible bounding boxes represent that the scene models surrounded by the invisible bounding boxes are not visible; emitting rays to the scene models in the initial visible bounding boxes in the hierarchical bounding boxes, removing the invisible bounding boxes in the initial visible bounding boxes using a ray method to obtain a target visible bounding box surrounding the visible set of potential objects, thereby achieving the baking of the visible set of potential objects; the visible set of potential objects contains all visible scene models in the virtual scene.
[0005] Secondly, embodiments of the present invention provide an apparatus for determining a potential object visibility set. The apparatus includes: a construction module for acquiring scene models in a virtual scene and constructing a hierarchical bounding box of the virtual scene; the hierarchical bounding box includes bounding boxes at different levels that surround the scene models; a first culling module for culling invisible bounding boxes at each level of the hierarchical bounding box according to the hierarchical structure of the hierarchical bounding box using a soft raster method to obtain an initial visible bounding box in the hierarchical bounding box; the invisible bounding box represents that the scene model surrounded by the invisible bounding box is invisible; a second culling module for emitting rays to the scene models in the initial visible bounding box in the hierarchical bounding box, and culling the invisible bounding boxes in the initial visible bounding box using a ray method to obtain a target visible bounding box surrounding the potential object visibility set, thereby achieving the baking of the potential object visibility set; the potential object visibility set contains all visible scene models in the virtual scene.
[0006] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the above-described method for determining a potential object visibility set.
[0007] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the above-described method for determining the visible set of potential objects.
[0008] The embodiments of the present invention bring the following beneficial effects:
[0009] The aforementioned method, apparatus, electronic device, and storage medium for determining the visible set of latent objects acquire scene models in a virtual scene and construct hierarchical bounding boxes for the virtual scene. The hierarchical bounding boxes include bounding boxes at different levels that enclose the scene models. According to the hierarchical structure of the hierarchical bounding boxes, invisible bounding boxes at each level are removed using a soft raster method to obtain initial visible bounding boxes within the hierarchical bounding boxes. Invisible bounding boxes represent that the scene models enclosed by these boxes are not visible. Rays are emitted towards the scene models in the initial visible bounding boxes within the hierarchical bounding boxes, and invisible bounding boxes in the initial visible bounding boxes are removed using ray tracing to obtain target visible bounding boxes that enclose the visible set of latent objects, thereby achieving the baking of the visible set of latent objects. The visible set of latent objects contains all visible scene models in the virtual scene.
[0010] In the above method, multi-layered bounding boxes are set in the virtual scene. First, invisible bounding boxes are removed using soft rasterization to obtain initial visible bounding boxes. Then, invisible bounding boxes are removed using ray casting to obtain the final set of potential objects. This method can accurately remove invisible models. At the same time, since only a small number of bounding boxes are used for visibility detection using ray casting, the computation time is short and the computational efficiency is high. This method ensures both computational efficiency and recognition accuracy, thus improving the overall performance of scene rendering.
[0011] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0012] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0013] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0014] Figure 1 A flowchart illustrating a method for determining the visible set of potential objects, provided in an embodiment of the present invention;
[0015] Figure 2 An example diagram of a scene model and bounding box provided in an embodiment of the present invention;
[0016] Figure 3 This is a schematic diagram illustrating the hierarchical relationship between bounding boxes according to an embodiment of the present invention;
[0017] Figure 4 Schematic diagrams illustrating various visible scenarios of the detection bounding box provided in embodiments of the present invention;
[0018] Figure 5 A schematic diagram of a device for determining the visible set of potential objects provided in an embodiment of the present invention;
[0019] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Complex virtual scenes often contain a large number of models, such as game scenes. Occlusion culling techniques can reduce draw calls, thereby improving frame rates. Occlusion culling techniques include two main categories: real-time computation and offline baking. Real-time computation methods include GPU (Graphics Processing Unit) hardware culling and real-time soft raster occlusion culling; offline baking includes the PVS (Potential Visible Set) method. PVS is widely used due to its convenience and effectiveness. The basic idea of PVS is: in offline mode, the 3D space of the scene is divided into regions, and the visible set of objects in each region is calculated. This calculation process is generally called baking; then, during real-time gameplay, the objects in the corresponding visible set are obtained and drawn based on the current camera's location.
[0022] In fact, the real-time part of the PVS method is relatively simple, but it requires offline baking of the latent object visibility set data. How to accurately and efficiently acquire this data is one of the core issues, which is specifically reflected in the efficiency and accuracy of the baker PVSBaker.
[0023] The baker's calculation process can be implemented using either a CPU (Central Processing Unit) or a GPU. Currently, two common methods used in CPU-based PVS bakers to calculate the visible set of objects are Raycasting and Software Occlusion Culling (SOC). Raycasting typically uses physics engine libraries such as PhysX and Bullet, determining object visibility through ray intersection methods. SOC uses a soft raster method to calculate object visibility.
[0024] For the same virtual scene, Raycasting has a high rejection rate but is time-consuming, while Soft Raster Cushioning (SOC) is fast but has a lower rejection rate. The reason Raycasting is time-consuming is that it generates a large number of rays to maintain its high rejection rate. Reducing the ray density would obviously improve baking speed, but the accuracy would be unacceptable.
[0025] The reason for the lower culling rate of the SOC is that it builds a low-precision Z-buffer depth map on the CPU side, then uses the bounding box of the object to be detected to find the tiles covered by the bounding box and the corresponding depth values on those tiles. It then compares these depth values with the depth map tile by tile to determine whether the object is visible. A tile is a depth... Figure 2 The subdivided region, such as a 1024*1024 depth map, can be divided into multiple 8*8 tiles. In this process, firstly, the use of the object's AABB bounding box effectively magnifies the object's volume; secondly, the use of tile-by-tile comparison further magnifies the object to the size aligned with the tile boundaries. Therefore, the visibility assessment given by the SOC is that of an object much larger than it actually is. Clearly, in this case, the conclusion will be biased towards visibility, which is the fundamental reason for its low rejection rate. In fact, improving the Z-BUFFER's precision can reduce these effects, but this will drastically increase the baking time and lead to more additional problems.
[0026] In summary, among the related technologies, there is a trade-off between efficiency and culling accuracy when culling occluded objects in a scene, which affects the rendering performance of the virtual scene.
[0027] Based on this, embodiments of the present invention provide a method, apparatus, electronic device, and storage medium for determining the visible set of potential objects. This technology can be applied to the rendering of various virtual scenes, especially to virtual scenes with a large number of scene models or complex models, such as game scenes.
[0028] To facilitate understanding of this embodiment, a method for determining the visible set of potential objects disclosed in this embodiment of the invention will first be described in detail, such as... Figure 1 As shown, the method includes the following steps:
[0029] Step S102: Obtain the scene model in the virtual scene and construct the hierarchical bounding box of the virtual scene; the hierarchical bounding box includes: bounding boxes of different levels that enclose the scene model.
[0030] The bounding box consists of multiple levels; where, if a first bounding box encloses a second bounding box, the level of the first bounding box is higher than the level of the second bounding box; the lowest level bounding box encloses one or more scene models; each scene model is enclosed by a lowest level bounding box.
[0031] A virtual scene typically includes multiple scene models, such as building models, vehicle models, plant models, mountain models, and NPC (Non-Player Character) models. When models are densely packed or large, occlusion can occur between them. When a virtual camera captures an image in a virtual scene, completely occluded models will not be displayed in the scene image; that is, completely occluded models are invisible. Therefore, before rendering the scene image, based on the virtual camera's position and the positions between the models, it is possible to identify which models are completely occluded. These models are then not rendered, thus reducing the amount of rendering computation.
[0032] In this embodiment, to identify the visibility of each model, hierarchical bounding boxes are set in the virtual scene. These hierarchical bounding boxes comprise multiple levels of bounding boxes. The highest-level bounding box encompasses all scene models in the virtual scene; this highest level can be called the first level. The next level after the first level is the second level. The first level can include one or more bounding boxes. Taking two bounding boxes in the second level as an example, bounding box A and bounding box B, bounding box A includes a portion of the scene models in the virtual scene, and bounding box B includes another portion of the scene models in the virtual scene. The scene models in bounding boxes A and B together constitute all the scene models in the virtual scene, but the scene models in bounding boxes A and B do not overlap. The second-level bounding boxes may contain third-level bounding boxes, or they may only contain specific scene models. Taking bounding box A as an example, bounding box A also contains third-level bounding boxes; and so on. In the multi-level bounding box system, the lowest-level bounding box contains only one or more specific scene models.
[0033] As an example, Figure 2 An example of a scene model and bounding box is shown; the virtual scene includes a relatively dense scene model and a multi-layered bounding box. Figure 3 The hierarchical relationship between bounding boxes is shown in a two-dimensional plane. In this example, there are four levels of bounding boxes, and the fourth level of bounding box contains the scene model.
[0034] In practice, multi-level bounding boxes can be established using certain rules, such as the SAH (surface area heuristic) rule, or by dividing the bounding box by midpoints or by model partitioning. Generally, the multi-level bounding box structures established using different rules will be different.
[0035] Step S104: According to the hierarchical structure of the hierarchical bounding box, the invisible bounding boxes of each level in the hierarchical bounding box are removed by soft rasterization to obtain the initial visible bounding box in the hierarchical bounding box; the invisible bounding box represents that the scene model enclosed by the invisible bounding box is invisible.
[0036] In actual implementation, the visibility of bounding boxes can be checked one by one from high to low. If an invisible bounding box is found, i.e., the first bounding box, it can be determined that the scene model in the first bounding box is not visible, and the first bounding box is discarded. It should be noted that the first bounding box may contain the next level of bounding boxes. In this case, the visibility of the next level of bounding boxes in the first bounding box is no longer checked, nor is the visibility of the scene model in the first bounding box. The first bounding box, all levels of bounding boxes enclosed by the first bounding box, and the scene model inside the first bounding box are directly discarded.
[0037] To determine whether a bounding box is visible, a soft raster method can be used. First, determine the depth of the bounding box in the virtual scene. This depth can be understood as the distance between the bounding box and the virtual camera, projected in the direction the virtual camera is facing. If the depth of the bounding box is greater than the scene depth in the direction the bounding box is facing, it means the bounding box is occluded and is not visible. If the depth of the bounding box is equal to the scene depth in the direction the bounding box is facing, it means there is no obstruction between the bounding box and the virtual camera, and the bounding box is visible.
[0038] Step S106: A ray is emitted into the scene model in the initial visible bounding box of the hierarchical bounding box. The invisible bounding boxes in the initial visible bounding box are removed by ray casting to obtain the target visible bounding box that surrounds the potential object visible set, so as to realize the baking of the potential object visible set; the potential object visible set contains all visible scene models in the virtual scene.
[0039] The initial visible bounding box contains lower-level bounding boxes, with the lowest-level bounding box containing the scene model. In this embodiment, a ray is emitted from the camera position towards the bounding boxes within the initial visible bounding box. If the ray successfully reaches the bounding box, the bounding box is visible; if the ray is blocked, the bounding box is invisible and is culled. After culling all invisible bounding boxes, the aforementioned target visible bounding box is obtained, and the scene model included in this target visible bounding box is the visible scene model.
[0040] The method described above for determining the visible set of latent objects involves obtaining scene models in a virtual scene and constructing hierarchical bounding boxes for the virtual scene. These hierarchical bounding boxes include bounding boxes at different levels that enclose the scene models. Based on the hierarchical structure of the bounding boxes, invisible bounding boxes at each level are removed using a soft raster method to obtain the initial visible bounding boxes within the hierarchical bounding boxes. Invisible bounding boxes represent scenes whose enclosed scenes are not visible. Rays are emitted from the scene models within the initial visible bounding boxes in the hierarchical bounding boxes, and invisible bounding boxes within the initial visible bounding boxes are removed using ray tracing to obtain the target visible bounding boxes that enclose the visible set of latent objects, thus achieving the baking of the visible set of latent objects. The visible set of latent objects contains all visible scene models in the virtual scene.
[0041] In the above method, multi-layered bounding boxes are set in the virtual scene. First, invisible bounding boxes are removed using soft rasterization to obtain initial visible bounding boxes. Then, invisible bounding boxes are removed using ray casting to obtain the final set of potential objects. This method can accurately remove invisible models. At the same time, since only a small number of bounding boxes are used for visibility detection using ray casting, the computation time is short and the computational efficiency is high. This method ensures both computational efficiency and recognition accuracy, thus improving the overall performance of scene rendering.
[0042] The following embodiments provide a specific implementation method for removing invisible bounding boxes of each level in a hierarchical bounding box using a soft raster method.
[0043] First, determine the camera position of the virtual camera in the virtual scene, and then determine the scene depth of the virtual scene based on the camera position; wherein, the scene depth in a specified direction of the virtual camera is the depth of the scene model that is closest to the virtual camera in the specified direction.
[0044] In practical implementation, when the virtual scene is large or provides multiple viewpoints, the virtual scene can be divided into multiple scene regions, each corresponding to a camera position. Then, based on each camera position, the visibility of each scene model is determined in the manner described in this embodiment.
[0045] After determining the position of the virtual camera in the virtual scene, the scene depth can be obtained using soft rasterization. Soft rasterization is a process that simulates GPU hardware rasterization on the CPU using software. Specifically, it discretizes the mathematically described 3D objects in the virtual scene—the scene model—into pixel data. The distance from the camera to the surface of each pixel in this process is the depth. Scene depth can be achieved using a scene depth map, which records the depth value corresponding to each pixel in the scene.
[0046] Understandably, for each pixel position in the scene depth map, when that pixel position is mapped to the virtual scene, it corresponds to a model position located in a specified direction of the virtual camera. The scene depth in that specified direction is the depth of the scene model closest to the virtual camera in that specified direction. For example, if the closest scene model is model A when viewed from the camera position along the specified direction, and model B also exists in the specified direction but is completely occluded by model A, then the scene depth is determined based on the distance between model A and the virtual camera, and the distance between model B and the virtual scene is not considered in the scene depth.
[0047] In one approach, the current level is determined sequentially from high to low level, and the visibility of the bounding box in the current level is determined by using a soft raster method. If there is an invisible bounding box in the current level, it is removed. If there is a visible bounding box in the current level, the visibility of the bounding box in the next level of the visible bounding box is determined by using a soft raster method, and the invisible bounding box in the next level is removed. The bounding boxes that are not removed are determined as the initial visible bounding boxes in the layer bounding boxes.
[0048] If the current level corresponds to multiple bounding boxes, for each bounding box, we can use a soft raster method to determine whether the bounding box of the current level is visible. If there is a visible bounding box in the current level, we continue to determine whether the bounding box of the next level in the visible bounding box is visible, and remove the invisible bounding box in the next level, until we reach the bounding box of the lowest level. If there is an invisible bounding box in the aforementioned current level, we can directly determine that the scene model in the bounding box is invisible, and the invisible bounding box is removed. The scene model in the bounding box can be directly surrounded by the bounding box, or it can be surrounded by bounding boxes of any level in the bounding box.
[0049] Specifically, the process typically starts with the highest-level bounding box. First, the highest level is determined as the current level. If a visible bounding box exists in the current level, the next level corresponding to the visible bounding box is updated to the current level, and the following steps are performed: the visibility of the bounding box in the current level is determined using a soft raster; if an invisible bounding box exists in the current level, it is removed; if a visible bounding box exists in the current level, the visibility of the bounding box in the next level of the visible bounding box is determined using a soft raster, and the invisible bounding box in the next level is removed, until the current level is the lowest level.
[0050] When determining whether the bounding box of the current layer is visible using a soft raster method, it can be achieved as follows: obtain the bounding box depth of the target bounding box of the current layer; where the bounding box depth indicates: the distance between the virtual camera and the target bounding box, and the projection distance in the direction the virtual camera is facing; determine the relative direction between the target bounding box and the virtual camera, and determine the target scene depth in the relative direction; based on the bounding box depth and the target scene depth, determine whether the target bounding box of the current layer is visible.
[0051] For example, the orientation of the virtual camera and a certain point in the target bounding box can generate a plane; the length of the line connecting the virtual camera and the point in the target bounding box projected onto this plane is the bounding box depth of the target bounding box. From the aforementioned scene depth map, the depth value of the pixels in the direction relative to the target bounding box and the virtual camera can be found; by comparing this depth value with the bounding box depth of the target bounding box, it can be determined whether the target bounding box is visible.
[0052] In one specific implementation, the bounding box depth includes: the depth value of each pixel in the display area corresponding to the bounding box; if the depth value of each pixel in the bounding box depth is greater than the target scene depth, the target bounding box is determined to be invisible; if the depth value of any pixel in the bounding box depth is equal to the target scene depth, the target bounding box is determined to be visible.
[0053] Looking from the virtual camera's position along its orientation, you might only see a portion of the bounding box's surface. This portion forms a display area. Because the bounding box has a certain shape, the depth values at different locations on its surface are different. Therefore, each pixel in this display area corresponds to a depth value. The aforementioned target scene depth can also be understood as the scene depth in the direction corresponding to each location on the bounding box's surface. This target scene depth can include multiple scene depth values, and the scene depth values in different directions can be the same or different.
[0054] In practice, each depth value can be compared with the target scene depth. If every depth value is greater than the target scene depth, it means that no position within the target bounding box is visible. If any depth value is equal to the target scene depth, the target bounding box is visible; this target bounding box may be fully visible or partially visible. It should be noted that, based on each depth value, the scene depth value in the relative direction of the model position corresponding to that depth value can be obtained and then compared to determine more accurately whether each position on the target bounding box is visible.
[0055] In this embodiment, the reason for determining whether the bounding box is visible using the SOC method is analyzed as follows:
[0056] like Figure 4 In this scenario, assuming there are three scene models a, b, and c, and point o is the camera position, only object c is visible from point o; a and b are occluded by c. The intermediate nodes of a BVH (Bounding Volume Hierarchies) represent bounding boxes at a certain level. Because raycasting determines visibility by uniformly distributing sampling points on the surface of an object's bounding box, visibility is only determined when the surface area of the bounding box is smaller than the area of the object's bounding box within the node. Figure 4 As shown in (c), determining whether the bounding box is visible is meaningful; however, due to the randomness of the scene, such bounding boxes account for a small percentage, resulting in weak overall optimization capability. Figure 4 When scenario (b) occurs, negative optimization occurs. In this case, compared to the case without bounding boxes in (a), the bounding boxes in (b) actually increase the number of sampling points and increase the computational load. However, due to its tile-by-tile comparison characteristic, SOC provides a visibility judgment based on the visibility of an object much larger than the actual bounding box. Therefore, its conclusion of invisibility is very accurate and is suitable for bounding box visibility analysis.
[0057] The following embodiments further describe the implementation of removing invisible bounding boxes from the initial visible bounding boxes using ray casting. Specifically, sampling points are determined on the surface of the target scene model within the initial visible bounding box, and rays are emitted from the camera position towards the sampling points. If there are obstructions on the ray path between the ray and the sampling points, the target scene model is determined to be invisible, and the bounding box surrounding the target scene model is determined as an invisible bounding box, which is then removed. The remaining initial visible bounding boxes are then determined as the target visible bounding boxes surrounding the visible set of potential objects.
[0058] Understandably, the more sampling points there are, the more rays need to be generated, and the more accurate the result of determining whether the model is visible. In actual implementation, only one sampling point can be determined on the surface of the target scene model, and a ray can be emitted from the camera position towards that sampling point; if there are no obstructions on the ray path between the ray and the sampling point, the target scene model is determined to be visible; this method can efficiently and quickly determine whether the model is visible.
[0059] In another approach, each target scene model has multiple sampling points on its surface. If an obstruction exists on the ray path corresponding to any sampling point, the target scene model is determined to be invisible. These sampling points can be evenly distributed across the target scene model's surface. If an obstacle exists on the ray path corresponding to any sampling point, the target scene model is invisible; conversely, if no obstruction exists on the ray path corresponding to each sampling point, the target scene model can be determined to be visible.
[0060] The aforementioned methods combine ray casting and SOC (System-on-Chip) techniques to determine scene model visibility. However, considering the inherent overhead of this approach, for simple scene models, it can be more expensive than other methods without improving accuracy. To avoid this issue, this embodiment first assesses scene complexity before employing the combined ray casting and SOC approach. Only when the scene is complex is the combined ray casting and SOC approach used.
[0061] Determine the scene complexity of the virtual scene; where scene complexity indicates the baking difficulty of the latent object visible set; scene complexity is determined based on scene elements in the virtual scene; based on scene complexity, determine whether to perform the following objective steps: according to the hierarchical structure of the hierarchical bounding boxes, remove the invisible bounding boxes of each level in the hierarchical bounding boxes using a soft raster method to obtain the initial visible bounding boxes in the hierarchical bounding boxes; the invisible bounding boxes represent that the scene models enclosed by the invisible bounding boxes are not visible; emit rays to the scene models in the initial visible bounding boxes in the hierarchical bounding boxes, and remove the invisible bounding boxes in the initial visible bounding boxes using a ray method to obtain the target visible bounding boxes surrounding the latent object visible set, thereby achieving the baking of the latent object visible set; the latent object visible set contains all visible scene models in the virtual scene.
[0062] The scene complexity mentioned above can characterize the difficulty of baking the data of the visible set of potential objects. When calculating the scene complexity, you can refer to the elements and content contained in the virtual scene itself, such as the number of virtual cameras, the number of camera positions, the number of scene models, the number of model faces of the scene models, etc. The scene complexity is usually independent of the specific baking algorithm and can better measure the baking cost.
[0063] If the scene complexity is higher than the preset complexity threshold, execute the target step; if the scene complexity is lower than or equal to the preset complexity threshold, according to the hierarchical structure of the hierarchical bounding box, emit rays from the camera position to the scene model in the hierarchical bounding box, and remove the invisible bounding boxes in the hierarchical bounding box by ray casting to obtain the second target visible bounding box that surrounds the visible set of potential objects, so as to realize the baking of the visible set of potential objects; the visible set of potential objects contains all visible scene models in the virtual scene.
[0064] The target steps here are the same as those in the aforementioned embodiments, and will not be repeated here. Preset scene parameters may include various parameters such as scene size, number of models, model types, and virtual camera position. If the scene complexity is higher than a preset complexity threshold, the virtual scene is considered complex, and the above target steps are executed. If the scene complexity is lower than or equal to the preset complexity threshold, the virtual scene is considered simple, and the target steps are cancelled. Other methods can be used to determine whether the scene model is visible. For example, a ray can be emitted from the camera position towards the scene model, and the visibility of the scene model can be determined by the ray.
[0065] One specific method for determining scene complexity involves using preset scene parameters of the virtual scene to determine its complexity. These preset scene parameters include the number of preset cameras and / or the number of scene models in the virtual scene. It is understood that the more preset cameras or scene model data there are, the greater the computational load when identifying model visibility. Therefore, a higher number of preset cameras and a higher number of scene models result in greater scene complexity.
[0066] When calculating scene complexity, the first algebraic logic operation is performed to determine the preset number of cameras, the number of scene models, and preset constants to obtain the calculation result; the calculation result is determined as the scene complexity of the virtual scene.
[0067] The first algebraic logical operation can include, for example, dot product, or other variations of dot product; the first algebraic logical operation can also be other multiplication operations, or other logical operations besides multiplication, such as addition, exponentiation, etc. In one example, the product of the preset number of cameras, the number of scene models, and preset constants can be determined to obtain the product result; the product result is determined as the scene complexity of the virtual scene; wherein, the scene complexity has a preset complexity threshold. If the scene complexity is lower than the complexity threshold, the virtual scene is a simple scene; if the scene complexity is higher than or equal to the complexity threshold, the virtual scene is a complex scene.
[0068] In one example, scene complexity can be represented as SCI (SceneComplexIndex); SCI = BakePtCnt * OccludeeCnt / 1000000; where BakePtCnt represents the number of preset cameras, OccludeeCnt represents the number of scene models; 1 / 1000000 is the preset scaling constant; the value of the preset scaling constant can be determined empirically. The aforementioned complexity threshold can be set to 25. When SCI < 25, the visibility of the model is determined by ray emission; when SCI > 25, the visibility of the model is determined using the method described in this embodiment.
[0069] The above method can be used to obtain the scene model visible in the virtual scene, and then the scene model in the set of visible potential objects can be obtained. The scene model in the set of visible potential objects is then rendered. That is, during the rendering process, only the scene model in the set of visible potential objects is rendered.
[0070] In the method for determining the visibility set of potential objects provided in this embodiment, multi-layered bounding boxes are established in the virtual scene. The visibility of each bounding box is analyzed step by step from the high level to the low level. Occluded bounding boxes are removed in a coarse-grained manner, that is, the visibility of the bounding box is determined by the scene depth. For the lowest level bounding boxes that are not occluded, occluded scene models are removed in a fine-grained manner, that is, the visibility of the model is determined by ray casting. Compared with the method of using ray casting to detect the visibility of all models, the method in this embodiment reduces the number of ray castings and improves the baking efficiency of model visibility without reducing accuracy.
[0071] Without compromising the baking accuracy of model visibility, this embodiment improves baking speed. For complex city scenes in games, baking time can be reduced by up to 50% compared to simple raycasting. Table 1 below shows the baking time of various methods in different virtual scenes; Table 2 below shows the number of models remaining after culling occluded models in different virtual scenes using various baking methods. RayCast is a raycasting method, and SOC is a soft raster culling method. Compared to RayCast, this embodiment can significantly reduce baking time; compared to SOC, this embodiment can effectively extract more occluded models, reducing the number of models that need to be rendered.
[0072] Table 1
[0073] Test Scenario RayCast SOC The method of this embodiment church 888s 274s 616s School 3167s 425s 2172s shopping center 4662s 468s 2327s
[0074] Table 2
[0075]
[0076] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 5 The diagram shows a structural schematic of a device for determining the visible set of potential objects. The device includes:
[0077] Module 50 is used to obtain scene models in a virtual scene and construct hierarchical bounding boxes for the virtual scene; the hierarchical bounding boxes include bounding boxes at different levels that enclose the scene models.
[0078] The first culling module 52 is used to cull the invisible bounding boxes of each level in the hierarchical bounding box according to the hierarchical structure of the hierarchical bounding box, so as to obtain the initial visible bounding box in the hierarchical bounding box; the invisible bounding box represents that the scene model enclosed by the invisible bounding box is invisible.
[0079] The second culling module 54 is used to emit rays to the scene model in the initial visible bounding box in the hierarchical bounding box, and culling the invisible bounding box in the initial visible bounding box by ray culling to obtain the target visible bounding box that surrounds the potential object visible set, so as to realize the baking of the potential object visible set; the potential object visible set contains all visible scene models in the virtual scene.
[0080] The aforementioned apparatus for determining the visible set of potential objects acquires scene models in a virtual scene and constructs hierarchical bounding boxes for the virtual scene. The hierarchical bounding boxes include bounding boxes at different levels that enclose the scene models. According to the hierarchical structure of the hierarchical bounding boxes, invisible bounding boxes at each level in the hierarchical bounding boxes are removed using a soft raster method to obtain the initial visible bounding boxes in the hierarchical bounding boxes. Invisible bounding boxes represent that the scene models enclosed by invisible bounding boxes are not visible. Rays are emitted to the scene models in the initial visible bounding boxes in the hierarchical bounding boxes, and invisible bounding boxes in the initial visible bounding boxes are removed using a ray method to obtain the target visible bounding boxes that enclose the visible set of potential objects, thereby achieving the baking of the visible set of potential objects. The visible set of potential objects contains all visible scene models in the virtual scene.
[0081] In the above method, multi-layered bounding boxes are set in the virtual scene. First, invisible bounding boxes are removed using soft rasterization to obtain initial visible bounding boxes. Then, invisible bounding boxes are removed using ray casting to obtain the final set of potential objects. This method can accurately remove invisible models. At the same time, since only a small number of bounding boxes are used for visibility detection using ray casting, the computation time is short and the computational efficiency is high. This method ensures both computational efficiency and recognition accuracy, thus improving the overall performance of scene rendering.
[0082] The first elimination module described above is further configured to: determine the current level sequentially from high level to low level, and determine whether the bounding box of the current level is visible using a soft raster method; if there is an invisible bounding box in the current level, eliminate the invisible bounding box; if there is a visible bounding box in the current level, continue to determine whether the bounding box of the next level of the visible bounding box is visible using a soft raster method, and eliminate the invisible bounding box in the next level; and determine the bounding box that has not been eliminated as the initial visible bounding box in the layer bounding box.
[0083] The first elimination module described above is further configured to: determine the highest level as the current level; if there is a visible bounding box in the current level, update the next level corresponding to the visible bounding box to the current level, and continue to execute the following steps: determine whether the bounding box of the current level is visible by means of a soft raster; if there is an invisible bounding box in the current level, eliminate the invisible bounding box; if there is a visible bounding box in the current level, continue to determine whether the bounding box of the next level of the visible bounding box is visible by means of a soft raster, and eliminate the invisible bounding box in the next level, until the current level is the lowest level.
[0084] The first culling module described above is further configured to: obtain the bounding box depth of the target bounding box at the current level; wherein the bounding box depth indicates: the distance between the virtual camera and the target bounding box, and the projection distance in the direction in which the virtual camera faces; determine the relative direction between the target bounding box and the virtual camera, and determine the target scene depth in the relative direction; and determine whether the target bounding box at the current level is visible based on the bounding box depth and the target scene depth.
[0085] The bounding box depth includes the depth value of each pixel in the display area corresponding to the bounding box; the first culling module is further configured to: determine that the target bounding box is invisible if the depth value of each pixel in the bounding box depth is greater than the target scene depth; and determine that the target bounding box is visible if the depth value of any pixel in the bounding box depth is equal to the target scene depth.
[0086] The second culling module described above is further configured to: determine sampling points on the model surface of the target scene model within the initial visible bounding box; emit rays from the camera position to the sampling points; if there are obstructions on the ray path between the rays and the sampling points, determine that the target scene model is invisible; determine the bounding box surrounding the target scene model as the invisible bounding box; and culle the invisible bounding box; and determine the remaining initial visible bounding boxes as the target visible bounding boxes surrounding the visible set of potential objects.
[0087] The model surface of each target scene model has multiple sampling points; the second elimination module is also used to: determine that the target scene model is invisible if there is an obstruction on the ray path corresponding to any sampling point.
[0088] The aforementioned apparatus further includes a complexity determination module, used to: determine the scene complexity of the virtual scene; wherein, the scene complexity indicates the baking difficulty of the latent object visible set; the scene complexity is determined based on scene elements in the virtual scene; based on the scene complexity, determine whether to perform the following target steps: according to the hierarchical structure of the hierarchical bounding box, remove the invisible bounding boxes of each level in the hierarchical bounding box by means of soft rasterization to obtain the initial visible bounding box in the hierarchical bounding box; the invisible bounding box represents that the scene model enclosed by the invisible bounding box is invisible; emit a ray to the scene model in the initial visible bounding box in the hierarchical bounding box, remove the invisible bounding boxes in the initial visible bounding box by means of ray tracing to obtain the target visible bounding box surrounding the latent object visible set, so as to realize the baking of the latent object visible set; the latent object visible set contains all visible scene models in the virtual scene.
[0089] The aforementioned complexity determination module is also used to: determine the scene complexity of the virtual scene based on preset scene parameters of the virtual scene; wherein the preset scene parameters include: the number of preset cameras and / or the number of scene models in the virtual scene.
[0090] The aforementioned complexity determination module is also used to: determine the first algebraic logic operation of the preset number of cameras, the number of scene models, and preset constants, and obtain the operation result; and determine the operation result as the scene complexity of the virtual scene.
[0091] The aforementioned complexity determination module is also used to: if the scene complexity is higher than a preset complexity threshold, execute the target step; if the scene complexity is lower than or equal to the preset complexity threshold, according to the hierarchical structure of the hierarchical bounding box, emit rays from the camera position to the scene model in the hierarchical bounding box, and remove the invisible bounding boxes in the hierarchical bounding box by ray casting to obtain the second target visible bounding box that surrounds the visible set of potential objects, so as to realize the baking of the visible set of potential objects; the visible set of potential objects contains all visible scene models in the virtual scene.
[0092] The aforementioned device also includes a rendering module, used to: acquire a scene model from the visible set of potential objects, and perform rendering processing on the scene model from the visible set of potential objects.
[0093] This embodiment also provides an electronic device, including a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor. The processor executes the computer-executable instructions to implement the above-described method for determining a potential object visibility set. This electronic device can be a server or a terminal device.
[0094] See Figure 6As shown, the electronic device includes a processor 100 and a memory 101, the memory 101 storing computer-executable instructions that can be executed by the processor 100, the processor 100 executing the computer-executable instructions to implement the above-described method for determining the visible set of potential objects.
[0095] Furthermore, Figure 6 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0096] The memory 101 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0097] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 101. The processor 100 reads the information in memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiment.
[0098] The processor in the aforementioned electronic device, by executing computer-executable instructions, can perform the following operations in the method for determining the visible set of potential objects:
[0099] The process involves acquiring scene models from a virtual scene and constructing hierarchical bounding boxes for the virtual scene. These hierarchical bounding boxes include bounding boxes at different levels that enclose the scene models. Following the hierarchical structure of the bounding boxes, invisible bounding boxes at each level are removed using a soft raster technique to obtain the initial visible bounding boxes within the hierarchical bounding boxes. Invisible bounding boxes represent scenes whose enclosed models are not visible. Rays are emitted from the scene models within the initial visible bounding boxes in the hierarchical bounding boxes, and invisible bounding boxes within these initial visible bounding boxes are removed using ray tracing to obtain the target visible bounding boxes that enclose the potential object visible set, thus achieving the baking of the potential object visible set. The potential object visible set contains all visible scene models in the virtual scene.
[0100] The current level is determined sequentially from the highest to the lowest level. The visibility of the bounding box in the current level is determined by using a soft raster method. If there is an invisible bounding box in the current level, it is removed. If there is a visible bounding box in the current level, the visibility of the bounding box in the next level of the visible bounding box is determined by using a soft raster method, and the invisible bounding box in the next level is removed. The bounding boxes that are not removed are determined as the initial visible bounding boxes in the level bounding box.
[0101] The highest level is determined as the current level. If a visible bounding box exists in the current level, the next level corresponding to the visible bounding box is updated to the current level, and the following steps are continued: the bounding box of the current level is determined by soft rasterization; if an invisible bounding box exists in the current level, the invisible bounding box is removed; if a visible bounding box exists in the current level, the bounding box of the next level of the visible bounding box is determined by soft rasterization, and the invisible bounding box in the next level is removed, until the current level is the lowest level.
[0102] Obtain the bounding box depth of the target bounding box at the current level; where the bounding box depth indicates: the distance between the virtual camera and the target bounding box, and the projection distance in the direction the virtual camera is facing; determine the relative direction between the target bounding box and the virtual camera, and determine the target scene depth in the relative direction; based on the bounding box depth and the target scene depth, determine whether the target bounding box at the current level is visible.
[0103] Bounding box depth includes: the depth value of each pixel in the display area corresponding to the bounding box;
[0104] If the depth value of every pixel in the bounding box depth is greater than the target scene depth, the target bounding box is determined to be invisible; if the depth value of any pixel in the bounding box depth is equal to the target scene depth, the target bounding box is determined to be visible.
[0105] Sampling points are determined on the surface of the target scene model within the initial visible bounding box. Rays are emitted from the camera position toward the sampling points. If there are obstructions on the ray path between the ray and the sampling points, the target scene model is determined to be invisible. The bounding box surrounding the target scene model is determined to be an invisible bounding box and is discarded. The remaining initial visible bounding box is determined to be the target visible bounding box surrounding the visible set of potential objects.
[0106] The surface of each target scene model has multiple sampling points; if there is an obstruction on the ray path corresponding to any sampling point, the target scene model is determined to be invisible.
[0107] Determine the scene complexity of the virtual scene; where scene complexity indicates the baking difficulty of the latent object visible set; scene complexity is determined based on scene elements in the virtual scene; based on scene complexity, determine whether to perform the following objective steps: according to the hierarchical structure of the hierarchical bounding boxes, remove the invisible bounding boxes of each level in the hierarchical bounding boxes using a soft raster method to obtain the initial visible bounding boxes in the hierarchical bounding boxes; the invisible bounding boxes represent that the scene models enclosed by the invisible bounding boxes are not visible; emit rays to the scene models in the initial visible bounding boxes in the hierarchical bounding boxes, and remove the invisible bounding boxes in the initial visible bounding boxes using a ray method to obtain the target visible bounding boxes surrounding the latent object visible set, thereby achieving the baking of the latent object visible set; the latent object visible set contains all visible scene models in the virtual scene.
[0108] The scene complexity of the virtual scene is determined based on the preset scene parameters of the virtual scene; wherein the preset scene parameters include: the number of preset cameras and / or the number of scene models in the virtual scene.
[0109] The first algebraic logic operation is performed to determine the preset number of cameras, the number of scene models, and preset constants, and the result is used to determine the scene complexity of the virtual scene.
[0110] If the scene complexity is higher than the preset complexity threshold, execute the target step; if the scene complexity is lower than or equal to the preset complexity threshold, according to the hierarchical structure of the hierarchical bounding box, emit rays from the camera position to the scene model in the hierarchical bounding box, and remove the invisible bounding boxes in the hierarchical bounding box by ray casting to obtain the second target visible bounding box that surrounds the visible set of potential objects, so as to realize the baking of the visible set of potential objects; the visible set of potential objects contains all visible scene models in the virtual scene.
[0111] Obtain the scene model from the visible set of potential objects, and then perform rendering processing on the scene model from the visible set of potential objects.
[0112] In the above method, multi-layered bounding boxes are set in the virtual scene. First, invisible bounding boxes are removed using soft rasterization to obtain initial visible bounding boxes. Then, invisible bounding boxes are removed using ray casting to obtain the final set of potential objects. This method can accurately remove invisible models. At the same time, since only a small number of bounding boxes are used for visibility detection using ray casting, the computation time is short and the computational efficiency is high. This method ensures both computational efficiency and recognition accuracy, thus improving the overall performance of scene rendering.
[0113] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the above-described method for determining the visible set of potential objects.
[0114] The computer-executable instructions stored in the aforementioned computer-readable storage medium, by executing the aforementioned computer-executable instructions, can perform the following operations in the method for determining the visible set of potential objects:
[0115] The process involves acquiring scene models from a virtual scene and constructing hierarchical bounding boxes for the virtual scene. These hierarchical bounding boxes include bounding boxes at different levels that enclose the scene models. Following the hierarchical structure of the bounding boxes, invisible bounding boxes at each level are removed using a soft raster technique to obtain the initial visible bounding boxes within the hierarchical bounding boxes. Invisible bounding boxes represent scenes whose enclosed models are not visible. Rays are emitted from the scene models within the initial visible bounding boxes in the hierarchical bounding boxes, and invisible bounding boxes within these initial visible bounding boxes are removed using ray tracing to obtain the target visible bounding boxes that enclose the potential object visible set, thus achieving the baking of the potential object visible set. The potential object visible set contains all visible scene models in the virtual scene.
[0116] The current level is determined sequentially from the highest to the lowest level. The visibility of the bounding box in the current level is determined by using a soft raster method. If there is an invisible bounding box in the current level, it is removed. If there is a visible bounding box in the current level, the visibility of the bounding box in the next level of the visible bounding box is determined by using a soft raster method, and the invisible bounding box in the next level is removed. The bounding boxes that are not removed are determined as the initial visible bounding boxes in the level bounding box.
[0117] The highest level is determined as the current level. If a visible bounding box exists in the current level, the next level corresponding to the visible bounding box is updated to the current level, and the following steps are continued: the bounding box of the current level is determined by soft rasterization; if an invisible bounding box exists in the current level, the invisible bounding box is removed; if a visible bounding box exists in the current level, the bounding box of the next level of the visible bounding box is determined by soft rasterization, and the invisible bounding box in the next level is removed, until the current level is the lowest level.
[0118] Obtain the bounding box depth of the target bounding box at the current level; where the bounding box depth indicates: the distance between the virtual camera and the target bounding box, and the projection distance in the direction the virtual camera is facing; determine the relative direction between the target bounding box and the virtual camera, and determine the target scene depth in the relative direction; based on the bounding box depth and the target scene depth, determine whether the target bounding box at the current level is visible.
[0119] Bounding box depth includes: the depth value of each pixel in the display area corresponding to the bounding box;
[0120] If the depth value of every pixel in the bounding box depth is greater than the target scene depth, the target bounding box is determined to be invisible; if the depth value of any pixel in the bounding box depth is equal to the target scene depth, the target bounding box is determined to be visible.
[0121] Sampling points are determined on the surface of the target scene model within the initial visible bounding box. Rays are emitted from the camera position toward the sampling points. If there are obstructions on the ray path between the ray and the sampling points, the target scene model is determined to be invisible. The bounding box surrounding the target scene model is determined to be an invisible bounding box and is discarded. The remaining initial visible bounding box is determined to be the target visible bounding box surrounding the visible set of potential objects.
[0122] The surface of each target scene model has multiple sampling points; if there is an obstruction on the ray path corresponding to any sampling point, the target scene model is determined to be invisible.
[0123] Determine the scene complexity of the virtual scene; where scene complexity indicates the baking difficulty of the latent object visible set; scene complexity is determined based on scene elements in the virtual scene; based on scene complexity, determine whether to perform the following objective steps: according to the hierarchical structure of the hierarchical bounding boxes, remove the invisible bounding boxes of each level in the hierarchical bounding boxes using a soft raster method to obtain the initial visible bounding boxes in the hierarchical bounding boxes; the invisible bounding boxes represent that the scene models enclosed by the invisible bounding boxes are not visible; emit rays to the scene models in the initial visible bounding boxes in the hierarchical bounding boxes, and remove the invisible bounding boxes in the initial visible bounding boxes using a ray method to obtain the target visible bounding boxes surrounding the latent object visible set, thereby achieving the baking of the latent object visible set; the latent object visible set contains all visible scene models in the virtual scene.
[0124] The scene complexity of the virtual scene is determined based on the preset scene parameters of the virtual scene; wherein the preset scene parameters include: the number of preset cameras and / or the number of scene models in the virtual scene.
[0125] The first algebraic logic operation is performed to determine the preset number of cameras, the number of scene models, and preset constants, and the result is used to determine the scene complexity of the virtual scene.
[0126] If the scene complexity is higher than the preset complexity threshold, execute the target step; if the scene complexity is lower than or equal to the preset complexity threshold, according to the hierarchical structure of the hierarchical bounding box, emit rays from the camera position to the scene model in the hierarchical bounding box, and remove the invisible bounding boxes in the hierarchical bounding box by ray casting to obtain the second target visible bounding box that surrounds the visible set of potential objects, so as to realize the baking of the visible set of potential objects; the visible set of potential objects contains all visible scene models in the virtual scene.
[0127] Obtain the scene model from the visible set of potential objects, and then perform rendering processing on the scene model from the visible set of potential objects.
[0128] In the above method, multi-layered bounding boxes are set in the virtual scene. First, invisible bounding boxes are removed using soft rasterization to obtain initial visible bounding boxes. Then, invisible bounding boxes are removed using ray casting to obtain the final set of potential objects. This method can accurately remove invisible models. At the same time, since only a small number of bounding boxes are used for visibility detection using ray casting, the computation time is short and the computational efficiency is high. This method ensures both computational efficiency and recognition accuracy, thus improving the overall performance of scene rendering.
[0129] The computer program product for determining the visible set of potential objects provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0130] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0131] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0132] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0133] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0134] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for determining the visible set of potential objects, characterized in that, The method includes: Obtain a scene model from a virtual scene and construct a hierarchical bounding box for the virtual scene; the hierarchical bounding box includes bounding boxes at different levels that enclose the scene model; According to the hierarchical structure of the hierarchical bounding boxes, the invisible bounding boxes at each level in the hierarchical bounding boxes are removed by soft rasterization to obtain the initial visible bounding boxes in the hierarchical bounding boxes; the invisible bounding boxes represent that the scene model enclosed by the invisible bounding boxes is not visible. A ray is emitted into the scene model in the initial visible bounding box of the hierarchical bounding box. The invisible bounding boxes in the initial visible bounding box are removed by ray casting to obtain the target visible bounding box that surrounds the potential object visible set, thereby achieving the baking of the potential object visible set; the potential object visible set contains all visible scene models in the virtual scene. The step of removing invisible bounding boxes at each level of the hierarchical bounding box using a soft raster method, according to the hierarchical structure of the hierarchical bounding box, to obtain the initial visible bounding box in the hierarchical bounding box, includes: The current level is determined sequentially from high level to low level, and the visibility of the bounding box of the current level is determined by a soft raster method. If an invisible bounding box exists in the current level, remove the invisible bounding box. If a visible bounding box exists in the current layer, continue to determine whether the bounding box in the next layer of the visible bounding box is visible using a soft raster method, and remove the invisible bounding box in the next layer. The bounding boxes that are not removed are identified as the initial visible bounding boxes in the hierarchical bounding boxes.
2. The method according to claim 1, characterized in that, The current level is determined sequentially from the highest level to the lowest level, including: setting the highest level as the current level; If a visible bounding box exists in the current layer, the process of determining whether the bounding box in the next layer of the visible bounding box is visible using a soft raster method, and then removing the invisible bounding box in the next layer, includes: If a visible bounding box exists in the current level, update the next level corresponding to the visible bounding box to the current level, and continue to perform the following steps: determine whether the bounding box of the current level is visible using a soft raster method; if an invisible bounding box exists in the current level, remove the invisible bounding box; if a visible bounding box exists in the current level, continue to determine whether the bounding box of the next level of the visible bounding box is visible using a soft raster method, and remove the invisible bounding box in the next level, until the current level is the lowest level.
3. The method according to claim 1, characterized in that, Determining whether the bounding box of the current layer is visible using a soft raster method includes: Obtain the bounding box depth of the target bounding box at the current level; wherein, the bounding box depth indicates: the distance between the virtual camera and the target bounding box, and the projection distance in the direction in which the virtual camera is facing; Determine the relative orientation of the target bounding box and the virtual camera, and determine the target scene depth in the relative orientation; Based on the bounding box depth and the target scene depth, determine whether the target bounding box of the current level is visible.
4. The method according to claim 3, characterized in that, The bounding box depth includes: the depth value corresponding to each pixel in the display area corresponding to the bounding box; Determining whether the target bounding box at the current level is visible based on the bounding box depth and the target scene depth includes: If the depth value of each pixel in the bounding box depth is greater than the target scene depth, the target bounding box is determined to be invisible. If any pixel in the bounding box depth has a depth value equal to the target scene depth, then the target bounding box is determined to be visible.
5. The method according to claim 1, characterized in that, A ray is emitted into the scene model within the initial visible bounding box of the hierarchical bounding box. Invisible bounding boxes within the initial visible bounding box are culled using this ray, resulting in a target visible bounding box that encloses the visible set of potential objects. Sampling points are determined on the surface of the target scene model within the initial visible bounding box, and rays are emitted from the camera position toward the sampling points; If there is an obstruction on the ray path between the sampling points, the target scene model is determined to be invisible, the bounding box surrounding the target scene model is determined to be an invisible bounding box, and the invisible bounding box is discarded. The remaining initial visible bounding boxes are determined as the target visible bounding boxes that enclose the visible set of potential objects.
6. The method according to claim 5, characterized in that, Each target scene model has a plurality of sampling points on its model surface; The step of determining that the target scene model is invisible if there is an obstruction on the ray path between the sampling points includes: If there is an obstruction on the ray path corresponding to any of the sampling points, the target scene model is determined to be invisible.
7. The method according to claim 1, characterized in that, Before obtaining the initial visible bounding boxes in the hierarchical bounding boxes by removing the invisible bounding boxes at each level of the hierarchical bounding boxes using a soft raster method according to the hierarchical bounding box structure, the method further includes: Determine the scene complexity of the virtual scene; wherein the scene complexity indicates the baking difficulty of the visible set of potential objects; the scene complexity is determined based on scene elements in the virtual scene; Based on the complexity of the scenario, determine whether to perform the following objective steps: According to the hierarchical structure of the hierarchical bounding boxes, the invisible bounding boxes at each level in the hierarchical bounding boxes are removed by soft rasterization to obtain the initial visible bounding boxes in the hierarchical bounding boxes; the invisible bounding boxes represent that the scene model enclosed by the invisible bounding boxes is not visible. A ray is emitted into the scene model in the initial visible bounding box of the hierarchical bounding box. The invisible bounding boxes in the initial visible bounding box are removed by ray casting to obtain the target visible bounding box that surrounds the potential object visible set, thereby achieving the baking of the potential object visible set; the potential object visible set contains all visible scene models in the virtual scene.
8. The method according to claim 7, characterized in that, Determining the scene complexity of the virtual scene includes: Based on the preset scene parameters of the virtual scene, the scene complexity of the virtual scene is determined; wherein, the preset scene parameters include: the preset number of cameras and / or the number of scene models in the virtual scene.
9. The method according to claim 8, characterized in that, Based on the preset scene parameters of the virtual scene, the scene complexity of the virtual scene is determined, including: A first algebraic logic operation is performed to determine the preset number of cameras, the number of scene models, and preset constants to obtain the calculation result; The calculation result is determined as the scene complexity of the virtual scene.
10. The method according to claim 7, characterized in that, Based on the complexity of the scenario, determine whether to execute the following target steps, including: If the complexity of the scenario exceeds a preset complexity threshold, execute the target step; If the scene complexity is lower than or equal to a preset complexity threshold, rays are emitted from the camera position to the scene model in the hierarchical bounding box according to the hierarchical structure of the hierarchical bounding box. Invisible bounding boxes in the hierarchical bounding box are removed by ray casting to obtain a second target visible bounding box that surrounds the potential object visible set, thereby achieving the baking of the potential object visible set; the potential object visible set contains all visible scene models in the virtual scene.
11. The method according to claim 1, characterized in that, The method further includes: Obtain the scene model from the visible set of potential objects, and perform rendering processing on the scene model from the visible set of potential objects.
12. An apparatus for determining the visible set of potential objects, characterized in that, The device includes: A construction module is used to acquire a scene model in a virtual scene and construct a hierarchical bounding box for the virtual scene; the hierarchical bounding box includes bounding boxes at different levels that enclose the scene model; The first culling module is used to cull the invisible bounding boxes of each level in the hierarchical bounding box according to the hierarchical structure of the hierarchical bounding box, using a soft raster method, so as to obtain the initial visible bounding box in the hierarchical bounding box; the invisible bounding box indicates that the scene model enclosed by the invisible bounding box is invisible. The second culling module is used to emit rays to the scene model in the initial visible bounding box in the hierarchical bounding box, and culling the invisible bounding boxes in the initial visible bounding box by ray culling to obtain the target visible bounding box that surrounds the potential object visible set, so as to realize the baking of the potential object visible set; the potential object visible set contains all visible scene models in the virtual scene; The first rejection module is further configured to sequentially determine the current level from high level to low level, and determine whether the bounding box of the current level is visible using a soft raster method; if there is an invisible bounding box in the current level, reject the invisible bounding box; if there is a visible bounding box in the current level, continue to determine whether the bounding box of the next level of the visible bounding box is visible using a soft raster method, and reject the invisible bounding box in the next level; and determine the bounding box that has not been rejected as the initial visible bounding box in the bounding box of the level.
13. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor to implement the method for determining a visible set of potential objects as described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the method for determining a visible set of potential objects as described in any one of claims 1-11.