Real-time depth volume occlusion culling method and device, electronic equipment and storage medium
By using a real-time depth volume occlusion culling method, the problem of high resource consumption in mobile open-world 3D games was solved, resulting in improved rendering performance and memory optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 珠海剑心互动娱乐有限公司
- Filing Date
- 2023-02-16
- Publication Date
- 2026-06-23
AI Technical Summary
In existing open-world 3D mobile games, occlusion culling methods cannot effectively reduce resource consumption, especially in complex scenes with dynamic objects and frequent player movement, resulting in excessively high rendering performance and memory consumption.
A real-time depth volume occlusion culling method is adopted. By obtaining the depth volume of the model in the target scene, calculating the occlusion relationship, and performing dynamic unloading and loading processing, resource consumption is reduced.
It improved rendering performance, reduced memory consumption, and maintained excellent rendering quality.
Smart Images

Figure CN116468843B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer game technology, and in particular to a real-time depth volume occlusion culling method, apparatus, electronic device, and medium. Background Technology
[0002] In mobile open-world 3D games, maintaining excellent rendering quality is crucial for improving rendering performance and reducing memory consumption. Mobile devices are severely limited by performance and memory, and open-world scenes contain numerous objects, dynamic elements like monsters, and players constantly entering and exiting the scene. Occlusion culling is a vital technique in 3D rendering, removing invisible objects to improve performance and reduce memory consumption. Existing techniques include: 1) Visible Grid Occlusion Culling: A static technique that divides the scene into uniform 3D grids and places visible object information within each grid. 2) Connectivity Grid Occlusion Culling: A static technique that bakes the scene so that adjacent grids of multiple objects are connected, calculating the visibility range of an object at its current position. 3) Soft Rasterization Occlusion Culling: A real-time technique that soft rasterizes object models into CPU memory and then checks for visibility in CPU memory. Summary of the Invention
[0003] The main objective of this invention is to provide a real-time depth volume occlusion culling method, apparatus, electronic device, and medium that reduces the resource consumption of the occlusion culling system.
[0004] One aspect of the present invention provides a real-time depth volume occlusion culling method, comprising:
[0005] Based on the real-time depth volume occlusion culling request, obtain the depth volume of the model in the target scene;
[0006] Obtain the position and length information of the depth volume;
[0007] Create a culling thread to calculate the occlusion relationship of the depth volume in the target scene based on the position and length information;
[0008] Dynamic processing is performed on the unloading and loading of the model in the target scene based on the occlusion relationship.
[0009] According to the real-time depth volume occlusion culling method, obtaining the depth volume of the model in the target scene based on the real-time depth volume occlusion culling request includes:
[0010] The CPU main thread traverses the target scene to obtain all the depth volumes of the model, and also obtains the view frustum.
[0011] According to the real-time depth volume occlusion culling method, obtaining the position and length information of the depth volume includes:
[0012] The position and length information of the dynamic object depth volume, NPC depth volume and view frustum are calculated using a fuzzy algorithm, and the rotation matrix, projection matrix and view matrix of the depth volume are obtained.
[0013] According to the real-time depth volume occlusion culling method, a culling thread is created to calculate the occlusion relationship of the depth volume in the target scene based on the position information and length information, including:
[0014] The occlusion culling thread determines whether the depth volume of the target scene is within the view frustum, and creates storage data to store the distance of the depth volume that exists within the range of the view frustum.
[0015] According to the real-time depth volume occlusion culling method, the unloading and loading of the model in the target scene are dynamically processed based on the occlusion relationship, including:
[0016] The occlusion culling thread calculates the first depth value and the first influence space of the depth volume by performing calculations on the depth volume within the view frustum with the rotation matrix, projection matrix, and view matrix of the view frustum.
[0017] The first depth value and the first influence space are compared with the second depth value and the second influence space in the memory space to obtain the comparison result;
[0018] The occlusion relationships of all the depth volumes are determined based on the comparison results.
[0019] According to the real-time depth volume occlusion culling method, the unloading and loading of the model in the target scene are dynamically processed based on the occlusion relationship, including:
[0020] The occlusion culling thread dynamically calculates the occlusion relationship of the depth volume in the target scene and sends the occlusion relationship analysis results to the CPU main thread;
[0021] The CPU main thread performs dynamic processing on the unloading and loading of the model.
[0022] Another aspect of the present invention provides a bridge travel warning device, comprising:
[0023] The first module is used to obtain the depth volume of the model in the target scene based on the real-time depth volume occlusion culling request;
[0024] The second module is used to obtain the position and length information of the depth body;
[0025] The third module is used to create a culling thread to calculate the occlusion relationship of the depth volume in the target scene based on the position information and length information.
[0026] The fourth module is used to perform dynamic processing on the unloading and loading of the model in the target scene according to the occlusion relationship.
[0027] Another aspect of the present invention provides an electronic device, including a processor and a memory;
[0028] The memory is used to store programs;
[0029] The processor executes the program to implement the bridge driving warning method described above.
[0030] This invention also discloses a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the methods described above. Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0031] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0032] Figure 1 This is a flowchart illustrating the real-time depth volume occlusion culling method according to an embodiment of the present invention.
[0033] Figure 2 This is a schematic diagram of the occlusion relationship analysis process according to an embodiment of the present invention.
[0034] Figure 3 This is a schematic diagram illustrating the occlusion removal effect of an embodiment of the present invention.
[0035] Figure 4 This is the intended process for dynamic unloading and loading in an embodiment of the present invention.
[0036] Figure 5 This is a schematic diagram of a device for real-time depth volume occlusion culling according to an embodiment of the present invention. Detailed Implementation
[0037] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings. Throughout the description, the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions. In the following description, suffixes such as "module," "part," or "unit" used to denote elements are used only for the purpose of illustrative purposes and have no specific meaning in themselves. Therefore, "module," "part," or "unit" can be used interchangeably. Terms such as "first," "second," etc., are used only to distinguish technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the sequential relationship of the indicated technical features. In the following description, the consecutive reference numerals for method steps are for ease of review and understanding. Adjusting the implementation order of steps, in conjunction with the overall technical solution of the present invention and the logical relationship between the various steps, will not affect the technical effect achieved by the technical solution of the present invention. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0038] Terminology Explanation:
[0039] NPC, a non-player character.
[0040] refer to Figure 1 ,in Figure 1 This is a flowchart illustrating the real-time depth volume occlusion culling method according to an embodiment of the present invention, which includes, but is not limited to, steps S100~S400:
[0041] S100: Based on the real-time depth volume occlusion culling request, obtain the depth volume of the model in the target scene.
[0042] In some embodiments, the target scene is traversed by the CPU main thread to obtain all depth volumes of the model, and the view frustum is also obtained.
[0043] In some embodiments, the view cone is used to represent the view cone for viewing the target scene.
[0044] S200, acquire the position and length information of the depth volume;
[0045] In some embodiments, a fuzzy algorithm is used to calculate the position and length information of the dynamic object depth volume, the NPC depth volume, and the view frustum, and the rotation matrix, projection matrix, and view matrix of the depth volume are obtained.
[0046] In some embodiments, the method further includes using an occlusion culling thread to determine whether the depth volume of the scene is within the view frustum. If it is within the view frustum, it is stored in an array. After all determinations are completed, the distances between the depth volume and the view frustum position are sorted from smallest to largest.
[0047] S300: Create a culling thread to calculate the occlusion relationship of the depth volume in the target scene based on the position and length information.
[0048] In some embodiments, reference Figure 2 The process includes, but is not limited to, steps S310 to S330:
[0049] S310, the occlusion culling thread calculates the first depth value and the first influence space of the depth volume by performing the rotation matrix, projection matrix and view matrix of the depth volume within the view frustum.
[0050] S320, compare the first depth value and the first influence space with the second depth value and the second influence space in the memory space to obtain the comparison result;
[0051] S330 determines the occlusion relationships of all depth volumes based on the comparison results.
[0052] In some implementations, it can be understood that the first depth value and the first influence space are dynamically calculated depth volumes, while the second depth value and the second influence space are depth volumes stored in memory, which are equivalent to the depth volume position information and length information of the previous moment.
[0053] For example, refer to Figure 3 In this system, solid and dashed bounding boxes within the triangle (view frustum) represent unoccluded and occluded depth volumes, respectively, while those outside the triangle represent depth volumes outside the view frustum. This invention calculates the depth value and influence space of the depth volume within the view frustum by comparing it with the view frustum's projection matrix and view matrix. The calculated information is then compared with the currently stored memory space to determine if depth volume-related information can be written, thereby allowing the calculation of all occlusion relationships for depth volumes.
[0054] S400 performs dynamic processing on the unloading and loading of models in the target scene based on occlusion relationships.
[0055] In some embodiments, reference Figure 4 The illustrated process for dynamic unloading and loading includes, but is not limited to, steps S410-S420:
[0056] S410, the occlusion culling thread dynamically calculates the occlusion relationships of the depth volumes in the target scene and sends the occlusion relationship analysis results to the CPU main thread;
[0057] The S420 dynamically processes the unloading and loading of models through the CPU's main thread.
[0058] Through the embodiments of the present invention, the technical solution of the present invention has at least the following beneficial effects: by achieving excellent rendering quality through real-time depth volume occlusion culling, rendering performance is improved and memory consumption is reduced.
[0059] Figure 5 This is a schematic diagram of a device for real-time depth volume occlusion culling according to an embodiment of the present invention.
[0060] The device includes a first module 501, a second module 502, a third module 503, and a fourth module 504.
[0061] The first module is used to obtain the depth volume of the model in the target scene based on the real-time depth volume occlusion culling request; the second module is used to obtain the position information and length information of the depth volume; the third module is used to create a culling thread and calculate the occlusion relationship of the depth volume in the target scene based on the position information and length information; the fourth module is used to perform dynamic processing on the unloading and loading of the model in the target scene based on the occlusion relationship.
[0062] For example, with the cooperation of the first, second, third, and fourth modules in the device, the embodiment device can implement any of the aforementioned real-time depth volume occlusion culling methods. Specifically, based on a real-time depth volume occlusion culling request, it obtains the depth volume of the model in the target scene; obtains the position and length information of the depth volume; creates a culling thread; calculates the occlusion relationship of the depth volumes in the target scene based on the position and length information; and performs dynamic processing on the unloading and loading of the model in the target scene according to the occlusion relationship. The CPU performance consumption is very low because the depth volume itself already estimates the corresponding depth value and depth influence space. Occlusion culling of dynamic objects, monsters, and other players in the scene improves performance and reduces memory consumption.
[0063] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is altered and sub-operations described as part of a larger operation are executed independently.
[0064] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned real-time depth volume occlusion culling method.
[0065] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the described functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.
[0066] 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.
[0067] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0068] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0069] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0070] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0071] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0072] The above is a detailed description of the preferred embodiments of the present invention, but the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.
Claims
1. A real-time depth volume occlusion culling method, characterized in that, include: Based on the real-time depth volume occlusion culling request, obtain the depth volume of the model in the target scene; Obtain the position and length information of the depth volume; Create a culling thread to calculate the occlusion relationship of the depth volume in the target scene based on the position and length information; Dynamic processing is performed on the unloading and loading of the model in the target scene based on the occlusion relationship; The step of obtaining the depth volume of the model in the target scene based on the real-time depth volume occlusion culling request includes: The CPU main thread traverses the target scene to obtain all the depth volumes of the model, and also obtains the view frustum; The process of obtaining the position and length information of the depth volume includes: The position and length information of the dynamic object depth volume, NPC depth volume and view frustum are calculated using a fuzzy algorithm, and the rotation matrix, projection matrix and view matrix of the depth volume are obtained. The creation of the culling thread, based on the position and length information, calculates the occlusion relationship of the depth volume in the target scene, including: The occlusion culling thread determines whether the depth volume of the target scene is within the view frustum, and creates storage data to store the distance of the depth volume that exists within the view frustum range; The dynamic processing of unloading and loading the model in the target scene according to the occlusion relationship includes: The occlusion culling thread calculates the first depth value and the first influence space of the depth volume by performing calculations on the depth volume within the view frustum with the rotation matrix, projection matrix, and view matrix of the view frustum. The first depth value and the first influence space are compared with the second depth value and the second influence space in the memory space to obtain the comparison result. The second depth value and the second influence space are equivalent to the depth volume position information and length information of the previous moment. The occlusion relationships of all the depth volumes are determined based on the comparison results.
2. The real-time depth volume occlusion culling method according to claim 1, characterized in that, The dynamic processing of unloading and loading the model in the target scene according to the occlusion relationship includes: The occlusion culling thread dynamically calculates the occlusion relationship of the depth volume in the target scene and sends the occlusion relationship analysis results to the CPU main thread; The CPU main thread performs dynamic processing on the unloading and loading of the model.
3. A real-time depth volume occlusion removal device, characterized in that, include: The first module is used to obtain the depth volume of the model in the target scene based on the real-time depth volume occlusion culling request; The second module is used to obtain the position information of the depth volume; The third module is used to create a culling thread to calculate the occlusion relationship of the depth volume in the target scene based on the position information and length information. The fourth module is used to perform dynamic processing on the unloading and loading of the model in the target scene according to the occlusion relationship; The step of obtaining the depth volume of the model in the target scene based on the real-time depth volume occlusion culling request includes: The CPU main thread traverses the target scene to obtain all the depth volumes of the model, and also obtains the view frustum; The process of obtaining the position and length information of the depth volume includes: The position and length information of the dynamic object depth volume, NPC depth volume and view frustum are calculated using a fuzzy algorithm, and the rotation matrix, projection matrix and view matrix of the depth volume are obtained. The creation of the culling thread, based on the position and length information, calculates the occlusion relationship of the depth volume in the target scene, including: The occlusion culling thread determines whether the depth volume of the target scene is within the view frustum, and creates storage data to store the distance of the depth volume that exists within the view frustum range; The dynamic processing of unloading and loading the model in the target scene according to the occlusion relationship includes: The occlusion culling thread calculates the first depth value and the first influence space of the depth volume by performing calculations on the depth volume within the view frustum with the rotation matrix, projection matrix, and view matrix of the view frustum. The first depth value and the first influence space are compared with the second depth value and the second influence space in the memory space to obtain the comparison result. The second depth value and the second influence space are equivalent to the depth volume position information and length information of the previous moment. The occlusion relationships of all the depth volumes are determined based on the comparison results.
4. An electronic device, characterized in that, Including the processor and memory; The memory is used to store programs; The processor executes the program to implement the real-time depth volume occlusion culling method as described in any one of claims 1-2.
5. A computer-readable storage medium, characterized in that, The storage medium stores a program, which is executed by a processor to implement the real-time depth volume occlusion culling method as described in any one of claims 1-2.